Correctly check for changed files in Shellcheck workflow (#1156)

This commit is contained in:
Sébastiaan 2025-01-01 18:26:23 +01:00 committed by GitHub
parent 7c0f85d0b3
commit b8671b97af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 != ''