Skip to content

Give gh a repo to talk to, so the auto-merge label step stops failing - #4

Merged
soodoku merged 1 commit into
mainfrom
ci/gh-repo-for-label-step
Aug 10, 2026
Merged

Give gh a repo to talk to, so the auto-merge label step stops failing#4
soodoku merged 1 commit into
mainfrom
ci/gh-repo-for-label-step

Conversation

@soodoku

@soodoku soodoku commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

The auto-merge label step has been exiting 1 on every eligible Dependabot PR in every repo that carries this workflow. automerge-eligible exists in no repo in the fleet, and every scheduled sweep since the label design landed reports sweep acted on 0 PR(s) — the sweep keys off that label, so it classifies every PR as ineligible (no policy label) and does nothing.

The one classify run that ever reached an eligible PR — appeler/pranaam#35, run 31283649110:

ecosystem=uv group=security update-type=version-update:semver-minor eligible=true
Run gh label create "$ELIGIBLE_LABEL" --force ...
failed to run git: fatal: not a git repository
##[error]Process completed with exit code 1

Neither job checks out the repo — they do not need the code. Every other gh call passes a full PR URL and resolves the repo from that argument. gh label create takes no URL, so it falls back to reading a git remote, finds none, exits 1. Under bash -e the step dies there, so gh pr edit --add-label never runs; a failed step aborts the job, so neither does arming.

Reproduced outside CI in an empty directory (identical error string) and confirmed GH_REPO alone fixes it. Set at workflow level, which also removes the duplicate the sweep job carried on two of its steps.

It fails closed, so nothing merged that should not have — but every run stayed green while the automation did nothing at all.

Fixed first in finite-sample/calibre#12; this is the same file.

Verification

actionlint exit 0 and zizmor --offline exit 0, run separately.

🤖 Generated with Claude Code

The label-based sweep has never once run its write path. `automerge-eligible`
exists in no repo in the fleet, and every scheduled sweep since the design
landed reports `sweep acted on 0 PR(s)` -- because the sweep's first branch is
`if label not in names`, and the label is never applied.

appeler/pranaam#35, run 31283649110, has the whole story:

    ecosystem=uv group=security update-type=version-update:semver-minor eligible=true
    Run gh label create "$ELIGIBLE_LABEL" --force ...
    failed to run git: fatal: not a git repository
    ##[error]Process completed with exit code 1

Neither job checks out the repo; they do not need the code. Every other gh call
passes a full PR URL and resolves the repo from the argument. `gh label create`
takes no URL, so it falls back to reading a git remote, finds none, and exits 1.
Under `bash -e` that kills the step, so `gh pr edit --add-label` never runs, and
a failed step aborts the job, so the arming step never runs either.

Reproduced outside CI in an empty directory -- same error string -- and
confirmed that GH_REPO alone fixes it.

Set at workflow level rather than on the one broken step: the sweep job was
already setting it on two of its steps, so this removes that duplication and
makes the next gh call added to either job correct by default.

Fixed first in finite-sample/calibre#12; this is the same file.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2fac8123ac

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +231 to +233
absent = never_reported(pr)
reason = (f"required never ran: {','.join(absent)}" if absent
else pr["mergeStateStatus"])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Filter required checks by the PR's target branch

When a repository has different rulesets for multiple branches, required.txt contains the union of every ruleset returned by the repository-wide endpoint, but never_reported() applies that union to every PR. For example, a PR to main that is BLOCKED for another reason will be reported as required never ran: deploy if deploy is required only on a release branch, and this false reason replaces the actual mergeStateStatus. The rulesets endpoint is repository-scoped rather than scoped to a PR's base ref, so the workflow should collect baseRefName and evaluate each ruleset's conditions before computing absent contexts.

Useful? React with 👍 / 👎.

@soodoku
soodoku merged commit d5094ee into main Aug 10, 2026
11 checks passed
@soodoku
soodoku deleted the ci/gh-repo-for-label-step branch August 10, 2026 05:08
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