From b8671b97af2b6070f840ac8e719c80c0d4d5dda3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastiaan?= Date: Wed, 1 Jan 2025 18:26:23 +0100 Subject: [PATCH] Correctly check for changed files in Shellcheck workflow (#1156) --- .github/workflows/shellcheck.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index a01a978d..394229e6 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -20,7 +20,11 @@ jobs: - name: Get changed files id: changes run: | - echo "::set-output name=files::$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '\.sh$')" + if ${{ github.event_name == 'pull_request' }}; then + echo "files=$(git diff --name-only -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT + else + echo "files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_OUTPUT + fi - name: Run ShellCheck if: steps.changes.outputs.files != ''