Add the merge-bot workflow - #38
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #38 +/- ##
========================================
Coverage 44.96% 44.96%
========================================
Files 25 25
Lines 3398 3398
Branches 259 259
========================================
Hits 1528 1528
Misses 1824 1824
Partials 46 46 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds the missing GitHub Actions workflow that auto-manages Dependabot PR merging for this repo, aligning with the fleet “merge-bot” contract by enabling auto-merge on new/reopened bot PRs and disabling it when a maintainer pushes to the bot branch (to avoid merging maintainer commits unintentionally).
Changes:
- Introduces a
pull_request_targetworkflow to enable auto-merge on in-repo Dependabot PRs using a GitHub App token. - Adds an idempotent job that disables auto-merge when a non-bot actor pushes to a Dependabot PR branch.
Suppressed comments (1)
.github/workflows/merge-bot-pull-request.yml:80
- This job also authenticates
ghusing the GitHub App token (GH_TOKEN), so it shouldn’t needGITHUB_TOKENpermissions. Setting permissions to none reduces exposure for a secrets-usingpull_request_targetworkflow.
permissions:
pull-requests: write
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (3)
.github/workflows/merge-bot-pull-request.yml:79
- This job doesn't use GITHUB_TOKEN to write to PRs (it uses GH_TOKEN from the GitHub App token), so the current pull-requests: write permission is unnecessary. Reduce permissions to least privilege.
permissions:
pull-requests: write
.github/workflows/merge-bot-pull-request.yml:37
- Job-level permissions currently grant GITHUB_TOKEN write access (contents/pull-requests), but the job uses GH_TOKEN (GitHub App token) for the merge. Tighten the job permissions to avoid granting unnecessary write permissions to GITHUB_TOKEN.
permissions:
contents: write
pull-requests: write
.github/workflows/merge-bot-pull-request.yml:24
- This workflow uses a GitHub App token via GH_TOKEN for all write operations, so GITHUB_TOKEN can be constrained at the workflow level to least privilege to reduce the blast radius if a future step accidentally uses it.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: false
jobs:
Suppressed findings answeredAll four collapsed findings, across both rounds on Round 1, Suppressed comments (1)1.
Accurate, including the point about it being a secrets-using Round 2, Suppressed comments (3)2.
3.
4.
This one names the real risk most precisely. The grant is not exploitable today, since no step reads Verified rather than assumed: The upstream issue also asks whether the audit should compare permissions at all. It does not today, because the contract for this file checks required job keys rather than the body, which is why this drift would not be flagged on any repo carrying it. 4 of 4 suppressed findings, plus the inline thread, are now answered. |
Dependabot opens pull requests against both branches here, and nothing merged them, so every dependency bump waited on a manual merge and the action pins went stale between sweeps. Carry the two jobs the contract requires. The fleet canonical also carries merge-codegen and merge-upstream-version, and this repository runs neither, so both are left out rather than carried as conditions that can never match. The App-token secrets the workflow needs are already configured in both the Actions and Dependabot stores. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Closes the
merge-bot-pull-request.ymlgap from the 2026-08-02 hub audit (audit run 2026-08-02T16:10Z | hub 69688ec).Why it matters here
Dependabot already opens pull requests against both
mainanddevelop(both ecosystems dual-target, per.github/dependabot.yml), and nothing merged them. Every dependency and action bump waited on a manual merge, which is how action pins go stale between sweeps. The audit classified the absence as drift rather than a letter miss, since the file is declaredappliesTo: "*"withfidelity: interface.What it carries
The two jobs the contract requires (
requiredJobKeysinspec/files.json):merge-dependabot- enables auto-merge on an in-repo Dependabot pull request, squash ontodevelopand merge ontomain. Every tier auto-merges, semver-major included, because the required checks are the gate rather than the size of the bump.disable-auto-merge-on-maintainer-push- fires when a maintainer pushes to a bot's branch, so their commits do not merge along with the bot's. Idempotent, and re-enabled by hand.The fleet canonical also carries
merge-codegenandmerge-upstream-version. This repository runs neither codegen nor an upstream-version tracker, so both are N/A under WORKFLOW.md section 1 and are left out rather than carried as conditions that can never match. The file isinterfacefidelity, so it is checked by required job names and wiring rather than byte-for-byte.Dependencies checked, not assumed
The workflow needs an App token, and
CODEGEN_APP_CLIENT_ID/CODEGEN_APP_PRIVATE_KEYare already configured in both the Actions and Dependabot stores. These arebaselinesecrets inspec/secrets.json, implicit for every fleet repo and deliberately not repeated in the registry'srequiredSecrets, so no registry change is needed.pull_request_targetis used rather thanpull_requestbecause the jobs hold the App key, so the workflow and action SHAs resolve from the trusted base. It is safe here because no job checks out pull request code; each runsgh pr mergeby URL. Thecreate-github-app-tokenpin matches the hub canonical exactly.Verification
actionlint, editorconfig-checker, and the hub prose gate all report clean, and the parsed job keys are exactly the two the contract requires.