Skip to content

Replace CODEOWNERS with /merge command#32

Open
magicmark wants to merge 20 commits into
mainfrom
replace-codeowners-with-merge-bot
Open

Replace CODEOWNERS with /merge command#32
magicmark wants to merge 20 commits into
mainfrom
replace-codeowners-with-merge-bot

Conversation

@magicmark
Copy link
Copy Markdown
Contributor

@magicmark magicmark commented May 15, 2026

Oops!

CODEOWNERS is currently invalid:

CODEOWNERS errors
Unknown owner on line 1: make sure @rebello95 exists and has write access to the repository
/gaps/GAP-10/ @magicmark @rebello95

This makes sense.... most authors will not be "members" of the repo. So CODEOWNERS as a gating mechanism doesn't really work.

Proposal: /merge

Instead, claude and I propose /merge which is a command that can be run to merge on behalf of authors. It will only merge iff:

  1. all required status checks pass (e.g. validate-stucture.js)
  2. any branch protection rules in place are met (we don't currently require a minimum number of reviews, but if we change this, /merge will respect it.
  3. crucially: only GAP authors may run /merge for file(s) changed in their GAP directory.

Bonus: this means we can re-enable Require a pull request before merging

cc @benjie wdyt?

magicmark and others added 10 commits May 15, 2026 12:43
CODEOWNERS requires all listed users to have repo write access, which
doesn't work for external GAP authors. Replace it with a GitHub Action
that reads metadata.yml to determine who can merge PRs scoped to a
single GAP directory.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Remove auto-merge on PR approval — merging should always be an
explicit action via /merge comment.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Rename author-merge.yml -> merge.yml
- Rename job to "merge"
- Use contains() for slightly more forgiving /merge detection
- Remove redundant comments

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Fix shell injection: route all ${{ }} through env vars
- Fix empty-grep bug: explicit check for zero GAP dirs
- Fix regex matching: use grep -qFx for username comparison
- Use portable grep -oE instead of Perl -oP
- Add concurrency guard to prevent merge races
- Remove redundant "Get PR details" step

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@magicmark magicmark changed the title Replace CODEOWNERS with author-merge bot Replace CODEOWNERS with /merge command May 15, 2026
@magicmark magicmark requested review from benjie and martinbonnin and removed request for benjie May 15, 2026 18:08
magicmark and others added 5 commits May 15, 2026 13:11
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Bash step resolves metadata (authors/sponsor as JSON), then a
github-script step does the authorization and path-scoping checks
using the GitHub API.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Comment thread .github/workflows/merge.yml Outdated
Use actions/github-script for verification logic instead of shell.
Checks changed files via the GitHub API and reads metadata.yml with
js-yaml to authorize the commenter.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@magicmark magicmark marked this pull request as ready for review May 15, 2026 18:40
Comment thread .github/workflows/merge.yml
magicmark and others added 4 commits May 15, 2026 16:00
Addresses review feedback: move JS out of YAML into
scripts/verify-merge.js.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@magicmark magicmark requested a review from benjie May 15, 2026 21:16
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.

2 participants