Skip to content

fix(safe-paths): pass --repo to gh pr diff#24

Merged
topcoder1 merged 1 commit into
mainfrom
fix/safe-paths-checkout
May 3, 2026
Merged

fix(safe-paths): pass --repo to gh pr diff#24
topcoder1 merged 1 commit into
mainfrom
fix/safe-paths-checkout

Conversation

@topcoder1

Copy link
Copy Markdown
Owner

Summary

The safe-paths-automerge.yml reusable from #22 runs gh pr diff "\$PR" --name-only without a local checkout. gh falls back to spawning git locally and fails:

failed to run git: fatal: not a git repository (or any of the parent directories): .git
##[error]Process completed with exit code 1.

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 the gh pr diff line. 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 --repo addition.

🤖 Generated with Claude Code

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]>
@claude

claude Bot commented May 3, 2026

Copy link
Copy Markdown

No issues found. Fix is correct — github.repository is runner-set (not user-controlled), argument order is valid gh CLI syntax, and set -euo pipefail already ensures error propagation.

@topcoder1
topcoder1 merged commit 1de7a83 into main May 3, 2026
4 checks passed
@topcoder1
topcoder1 deleted the fix/safe-paths-checkout branch May 3, 2026 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant