File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 1717 with :
1818 fetch-depth : 0
1919
20+ - name : Fetch PR head ref
21+ run : |
22+ git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-head
23+
2024 - name : Set up Python
2125 uses : actions/setup-python@v4
2226 with :
3034 - name : Get changed files
3135 id : changed-files
3236 run : |
33- # Get changed files but exclude .github directory
34- echo "files=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep -v '^\.github/' | grep '\.ya\?ml$' | tr '\n' ' ')" >> $GITHUB_OUTPUT
37+ set -euo pipefail
38+ BASE_SHA=${{ github.event.pull_request.base.sha }}
39+ HEAD_REF=pr-head
40+ MERGE_BASE=$(git merge-base "$BASE_SHA" "$HEAD_REF")
41+ echo "Diffing $MERGE_BASE...$HEAD_REF"
42+ files=$(git diff --name-only "$MERGE_BASE" "$HEAD_REF" | grep -v '^\.github/' | grep -E '\.ya?ml$' || true)
43+ files=$(echo "$files" | tr '\n' ' ' | sed -e 's/[[:space:]]*$//')
44+ echo "files=$files" >> $GITHUB_OUTPUT
3545
3646 - name : Validate changes
3747 id : validate
You can’t perform that action at this time.
0 commit comments