Skip to content

Commit

Permalink
stop workflow early if no new files
Browse files Browse the repository at this point in the history
  • Loading branch information
pchampin committed Feb 21, 2025
1 parent 02dfde2 commit 4d871e5
Showing 1 changed file with 27 additions and 31 deletions.
58 changes: 27 additions & 31 deletions .github/workflows/minutes2github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,14 @@ on:
push:
branches:
- main
# paths: ## DEBUG: uncomment this when everything works
# - minutes/*.html
paths:
- minutes/*.html

jobs:
minutes_to_gh:
runs-on: ubuntu-latest

steps:
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Checkout minutes_to_gh
uses: actions/checkout@v2
with:
repository: pchampin/minutes_to_gh
path: ./m2g

- name: Build minutes_to_gh
working-directory: ./m2g
run: cargo build --verbose

- name: Checkout this repository
uses: actions/checkout@v2
with:
Expand All @@ -55,21 +39,33 @@ jobs:
| sed 's!^A\s\+!!'
)
echo -e "NEW_FILES=\n" $NEW_FILES
# echo "NEW_FILES=$NEW_FILES" >> $GITHUB_ENV
# DEBUG: hack to force action on each act
if [ "$NEW_FILES" = "" ]; then
echo "NEW_FILES=minutes/minutes1.html" >> $GITHUB_ENV
else
echo "NEW_FILES=$NEW_FILES" >> $GITHUB_ENV
fi
echo "NEW_FILES=$NEW_FILES" >> $GITHUB_ENV
- name: Set up Rust
if: ${{ env.NEW_FILES }}
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Checkout minutes_to_gh
if: ${{ env.NEW_FILES }}
uses: actions/checkout@v2
with:
repository: pchampin/minutes_to_gh
path: ./m2g

- name: Build minutes_to_gh
if: ${{ env.NEW_FILES }}
working-directory: ./m2g
run: cargo build --verbose

- name: Run minutes_to_gh for each new file
if: ${{ env.NEW_FILES }}
working-directory: ./m2g
run: |
if [ "$NEW_FILES" != "" ]; then
for FILE in $NEW_FILES; do
echo $FILE
cargo run -- manual --repository pchampin/test_action --file ../repo/$FILE --url $URL_BASE$FILE --transcript
done
fi
for FILE in $NEW_FILES; do
echo -------- $FILE
cargo run -- manual --repository pchampin/test_action --file ../repo/$FILE --url $URL_BASE$FILE --transcript
done

0 comments on commit 4d871e5

Please sign in to comment.