fix(safe-paths): pass --repo to gh pr diff#24
Merged
Conversation
The reusable workflow runs `gh pr diff "$PR" --name-only` without
checking out the caller repo first. Without a local git checkout, gh
falls back to spawning git locally and fails with:
failed to run git: fatal: not a git repository (or any of the
parent directories): .git
Pass `--repo "$GITHUB_REPOSITORY"` so gh hits the API directly. No
checkout step needed.
Caught by the very first install on topcoder1/webcrawl#130 — the
install-the-caller PR triggered the workflow on itself and surfaced
the bug. Self-test paying off.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
No issues found. Fix is correct — |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
safe-paths-automerge.ymlreusable from #22 runsgh pr diff "\$PR" --name-onlywithout a local checkout. gh falls back to spawning git locally and fails:Pass
--repo "\$GITHUB_REPOSITORY"so gh hits the API directly. No checkout step needed.How it surfaced
The very first install of the caller (
topcoder1/webcrawl#130) triggered the workflow on the install PR itself. The workflow's diff was the workflow file — not a safe path — so it should have logged "deferring" and exited 0. Instead it crashed at thegh pr diffline. Net effect on #130: the workflow shows red but doesn't block merge (it's not a required check); the PR can still merge manually.Self-test caught it before the user merged the install — exactly what the self-test step was for.
Auto-merge rationale
Workflow file → manual click-merge per CLAUDE.md. Same caveat as #22 — fleet-wide blast radius if the regex change is wrong, even though this is a 1-line
--repoaddition.🤖 Generated with Claude Code