Skip to content

Commit e980e5d

Browse files
lane711claude
andcommitted
fix(ci): add fetch-depth:0 so origin/main available for PR diff
Shallow checkout (depth=1) means origin/main isn't fetched and HEAD~1 doesn't exist — git diff exits 128, failing the detect step. With fetch-depth:0 all history is present so origin/main...HEAD works. Also switch fallback to echo "" so it degrades to @smoke not a hard fail. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent b2476d8 commit e980e5d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

.github/workflows/pr-tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
with:
3838
# For pull_request_target, we need to checkout the PR head
3939
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
40+
fetch-depth: 0
4041

4142
- name: Setup Node.js
4243
uses: actions/setup-node@v4
@@ -194,7 +195,7 @@ jobs:
194195
run: |
195196
# Get changed files vs base branch (PR diff) or last commit (push)
196197
if [ "${{ github.event_name }}" = "pull_request_target" ]; then
197-
CHANGED=$(git diff --name-only origin/${{ github.base_ref }}...${{ github.event.pull_request.head.sha }} 2>/dev/null || git diff --name-only HEAD~1)
198+
CHANGED=$(git diff --name-only origin/${{ github.base_ref }}...HEAD 2>/dev/null || echo "")
198199
else
199200
CHANGED=$(git diff --name-only HEAD~1 2>/dev/null || echo "")
200201
fi

0 commit comments

Comments
 (0)