From 3c8adcf3704a5f979a69fb09c5a7b53e2489d38f Mon Sep 17 00:00:00 2001 From: Adam Perkowski Date: Sun, 22 Sep 2024 18:04:58 +0200 Subject: [PATCH] Changed the CI to only run when `.sh` files are changed (#588) --- .github/workflows/bashisms.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/bashisms.yml b/.github/workflows/bashisms.yml index d4d1490f..44b4a191 100644 --- a/.github/workflows/bashisms.yml +++ b/.github/workflows/bashisms.yml @@ -18,14 +18,21 @@ jobs: steps: - uses: actions/checkout@v4 - run: git fetch origin ${{ github.base_ref }} + + - name: Get a list of changed script files + run : | + sh_files=$(git diff --name-only origin/${{ github.base_ref }} HEAD core/tabs | grep '\.sh$' || true) + echo "sh_files=$sh_files" >> $GITHUB_ENV - name: Install devscripts + if: env.sh_files != '' run: sudo apt-get update && sudo apt-get install devscripts - - name: Check for bashisms in changed files + - name: Check for bashisms + if: env.sh_files != '' run: | - for file in $(git diff --name-only origin/${{ github.base_ref }} HEAD core/tabs); do - if [[ "$file" == *.sh ]] && [[ -f "$file" ]]; then + for file in ${{ env.sh_files }}; do + if [[ -f "$file" ]]; then checkbashisms "$file" fi done