mirror of
https://github.com/jbowdre/capsule.git
synced 2024-11-25 22:32:19 +00:00
end workflow early if no md files to process
This commit is contained in:
parent
de5a2ef099
commit
92390b0145
2 changed files with 23 additions and 10 deletions
7
.github/actions/markdown2gempost/convert.sh
vendored
7
.github/actions/markdown2gempost/convert.sh
vendored
|
@ -11,13 +11,6 @@ input_dir="${1%/}"
|
||||||
output_dir="${2%/}"
|
output_dir="${2%/}"
|
||||||
processed_dir="${3%/}"
|
processed_dir="${3%/}"
|
||||||
|
|
||||||
# Find all .md files and check if the array is empty
|
|
||||||
mapfile -t md_files < <(find "$input_dir" -type f -name "*.md")
|
|
||||||
if [ ${#md_files[@]} -eq 0 ]; then
|
|
||||||
echo "No Markdown files to process."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Iterate over .md files in input directory
|
# Iterate over .md files in input directory
|
||||||
for file in "$input_dir"/*.md; do
|
for file in "$input_dir"/*.md; do
|
||||||
file=$(basename "$file")
|
file=$(basename "$file")
|
||||||
|
|
26
.github/workflows/markdown2gempost.yml
vendored
26
.github/workflows/markdown2gempost.yml
vendored
|
@ -10,14 +10,36 @@ on:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: md2gmi
|
group: md2gmi
|
||||||
cancel-in-progress: true
|
cancel-in-progress: false
|
||||||
|
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
setup:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
work_to_do: ${{ steps.check_markdown.outputs.work_to_do }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.MY_GH_TOKEN }}
|
||||||
|
- name: Check for files to be processed
|
||||||
|
id: check_markdown
|
||||||
|
run: |
|
||||||
|
mapfile -t md_files < <(find markdown/incoming -type f -name "*.md")
|
||||||
|
if [ ${#md_files[@]} -eq 0 ]; then
|
||||||
|
echo "No Markdown files to process, exiting early."
|
||||||
|
echo "work_to_do=false" >> $GITHUB_OUTPUT
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "work_to_do=true" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
md2gmi:
|
md2gmi:
|
||||||
|
needs: setup
|
||||||
|
if: needs.setup.outputs.work_to_do == 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
@ -31,5 +53,3 @@ jobs:
|
||||||
- uses: stefanzweifel/git-auto-commit-action@v5
|
- uses: stefanzweifel/git-auto-commit-action@v5
|
||||||
with:
|
with:
|
||||||
commit_message: 'convert Markdown post to Gempost'
|
commit_message: 'convert Markdown post to Gempost'
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue