File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -99,11 +99,17 @@ jobs:
9999 ancestor_commit=$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})
100100 files=$(git diff --diff-filter=AM --name-only $ancestor_commit ${{ github.event.pull_request.head.sha }})
101101 else
102- # Get changed files by comparing the current commit to the commit before the push event or with its parent:
103- if [ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]; then
104- files=$(git diff --diff-filter=AM --name-only HEAD~ ${{ github.event.after }})
102+ # Check if the commit SHA exists:
103+ if git rev-parse ${{ github.event.before }} >/dev/null 2>&1 && git rev-parse ${{ github.event.after }} >/dev/null 2>&1; then
104+ # Get changed files by comparing the current commit to the commit before the push event or with its parent:
105+ if [ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]; then
106+ files=$(git diff --diff-filter=AM --name-only HEAD~ ${{ github.event.after }})
107+ else
108+ files=$(git diff --diff-filter=AM --name-only ${{ github.event.before }} ${{ github.event.after }})
109+ fi
105110 else
106- files=$(git diff --diff-filter=AM --name-only ${{ github.event.before }} ${{ github.event.after }})
111+ echo "Commit SHA not found, skipping file changes detection..."
112+ files=""
107113 fi
108114 fi
109115 # Keep only benchmark files:
You can’t perform that action at this time.
0 commit comments