Skip to content

chore: require hub-team approval via Actions check#7

Closed
andresbayon wants to merge 1 commit into
mainfrom
chore/require-hub-approval-check
Closed

chore: require hub-team approval via Actions check#7
andresbayon wants to merge 1 commit into
mainfrom
chore/require-hub-approval-check

Conversation

@andresbayon

Copy link
Copy Markdown
Collaborator

The changes I made

Adds a require-hub-approval GitHub Actions workflow that gates merges on an approval from a hub-team member — the protection CODEOWNERS used to provide — without committing the team name to the source tree.

How it stays clean of internal references:

  • Team slug lives in the repo Actions variable HUB_TEAM_SLUG (set to hub), not in the workflow file.
  • Org is derived from github.repository_owner.

How the check works:

  • Triggers on pull_request (opened/reopened/synchronize) and pull_request_review (submitted/dismissed/edited).
  • Computes each reviewer's latest review state (a later CHANGES_REQUESTED/DISMISSED overrides an earlier APPROVED; COMMENTED is ignored).
  • Passes only if at least one current approver is an active member of @<org>/${{ vars.HUB_TEAM_SLUG }}.

Prerequisites before this becomes effective

  1. Repo secret HUB_APPROVAL_TOKEN — a token with read:org + pull-request read (the default GITHUB_TOKEN can't read org team membership). A classic PAT with repo, read:org scopes (ideally from a bot/service account) works.
  2. After merge, add require-hub-approval to main's required status checks.

How To Test/Validate

  1. Set the HUB_APPROVAL_TOKEN secret.
  2. Merge this PR; open a test PR.
  3. With no hub approval → check fails. After a hub member approves → check passes. Push a new commit → stale approval dismissed → check fails again.

🤖 Generated with Claude Code

Adds a 'require-hub-approval' workflow that passes only when the latest
review from a member of the hub team is an approval. Replaces the
CODEOWNERS team-review requirement without committing the team name to
the source tree: the team slug lives in the HUB_TEAM_SLUG Actions
variable and the org is derived from github.repository_owner.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@andresbayon andresbayon closed this Jun 8, 2026
@andresbayon andresbayon deleted the chore/require-hub-approval-check branch June 8, 2026 08:10
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