diff --git a/.github/workflows/script-formatting.yaml b/.github/workflows/script-formatting.yaml index 26bb9848..e878ffde 100644 --- a/.github/workflows/script-formatting.yaml +++ b/.github/workflows/script-formatting.yaml @@ -7,6 +7,7 @@ on: pull_request: paths: - "**/*.sh" + - "**/*.func" jobs: shfmt: @@ -33,9 +34,9 @@ jobs: id: changed-files run: | if ${{ github.event_name == 'pull_request' }}; then - echo "files=$(git diff --name-only -r HEAD^1 HEAD | grep '\.sh$' | xargs)" >> $GITHUB_OUTPUT + echo "files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -E '\.(sh|func)$' | xargs)" >> $GITHUB_OUTPUT else - echo "files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep '\.sh$' | xargs)" >> $GITHUB_OUTPUT + echo "files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep -E '\.(sh|func)$' | xargs)" >> $GITHUB_OUTPUT fi - name: Run shfmt @@ -48,13 +49,13 @@ jobs: exit 0 else echo "diff=\"$(echo -n "$shfmt_output" | base64 -w 0)\"" >> $GITHUB_OUTPUT - echo -e $shfmt_output + printf "%s" "$shfmt_output" exit 1 fi - name: Post comment with results if: always() && github.event_name == 'pull_request' - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: script: | const result = '${{ job.status }}' === 'success' ? 'success' : 'failure';