PR Approval Workflow Automation#
The asyncapi/generator repository enforces a maintainer-triage gate: every issue must carry an Approved Issue label before a contributor's PR can stay open. Three GitHub Actions workflows implement the gate end-to-end; a bot-author bypass and a downstream automerge workflow handle automation-generated PRs that fall outside the gate.
Label State Machine#
Issue opened
β
βΌ
[Awaiting Approval] ββ applied to every new issue (color fbca04)
β
β maintainer comments /approve
βΌ
[Approved Issue] ββ PR can now remain open (color 0e8a16)
PRs that reference an issue still tagged Awaiting Approval, or that have no issue reference at all, are automatically closed by the enforcement workflow .
Workflow 1 β issue-awaiting-approval.yml#
Trigger: issues.opened
Applies the Awaiting Approval label (hex fbca04) to every newly opened issue. If the label does not yet exist in the repository, it is created first using a 422-idempotent guard so that concurrent runs cannot fail. See .github/workflows/issue-awaiting-approval.yml.
Workflow 2 β issue-approve-command.yml#
Trigger: issue_comment.created where the body is exactly /approve or starts with /approve
The workflow is skipped for PR threads and closed issues .
Authorization is derived at runtime from CODEOWNERS. The workflow sparse-checks out only that file, finds the catch-all * line, extracts all @handles, and filters out any username containing "bot" . This keeps the authorized approver list in sync with CODEOWNERS without hard-coding usernames. Only the catch-all line is used β path-specific CODEOWNERS entries (e.g. packages/, *.md) do not grant /approve rights .
The current catch-all * line is:
* @derberg @magicmatatjahu @jonaslagoni @Adi-204 @asyncapi-bot-eve
After bot-filtering, the effective approvers are derberg, magicmatatjahu, jonaslagoni, and Adi-204.
On a valid /approve, the workflow :
- Removes
Awaiting Approval - Adds
Approved Issue(creates the label if absent, 422-idempotent) - Posts a contributor instruction comment crediting the approver
Unauthorized attempts receive an error comment listing who can approve . Already-approved issues receive a short notice and no label changes .
Key gotcha:
@Florence-Njeri(Docs Champion) is listed as a CODEOWNER for specific paths but cannot use/approvebecause the workflow only reads the catch-all line. To grant approval rights, add the username to the*catch-all line inCODEOWNERS, not a path-specific entry .
Workflow 3 β close-prs-for-unapproved-issues.yml#
Trigger: pull_request_target β opened, edited, reopened
pull_request_target (not pull_request) is used so that GH_TOKEN has write access to close fork-originated PRs and post comments .
Bot-author bypass: The workflow first checks the PR author against a hardcoded allowlist β asyncapi-bot, dependabot[bot], dependabot-preview[bot], github-actions[bot] β and returns early without enforcement if matched . This bypass was added specifically to prevent changeset release PRs and dependency-bump PRs from being auto-closed (see issue #2249).
Issue-link detection: The PR body is scanned with the regex /(close[sd]?|fix(?:e[sd])?|resolve[sd]?)\s#(\d+)/gi to extract linked issue numbers .
| Condition | Action |
|---|---|
| No issue reference in PR body | Closes PR; instructs author to add Fixes #NNN |
Linked issue has Awaiting Approval | Closes PR; instructs author to wait for /approve |
| Linked issue returns 404 | Closes PR; instructs author to fix the reference |
All linked issues are Approved Issue | PR stays open |
Bot PRs & Automerge#
Automated PRs bypassed by the enforcement workflow are handled downstream by .github/workflows/automerge.yml . That workflow auto-approves bot PRs using GH_TOKEN_BOT_EVE, applies autoapproved/autoupdate labels, and squash-merges them. It is centrally managed in asyncapi/.github and should not be edited in this repo.
Incident Reference: Bot PR Auto-Close (2026-09-17)#
Within hours of the gate being deployed via PR #2192, the changesets release PR #2248 was auto-closed 8 seconds after opening, blocking the 3.5.0 release pipeline. The original workflow had no bot-author bypass (issue #2249). The fix β the botAuthors allowlist check β was shipped in the updated workflow .
Quick Reference#
| File | Purpose |
|---|---|
.github/workflows/issue-awaiting-approval.yml | Labels every new issue Awaiting Approval |
.github/workflows/issue-approve-command.yml | /approve command for CODEOWNERS catch-all maintainers |
.github/workflows/close-prs-for-unapproved-issues.yml | Closes PRs linked to unapproved issues; bypasses bots |
.github/workflows/automerge.yml | Auto-approves and squash-merges bot PRs (centrally managed) |
CODEOWNERS (catch-all * line) | Source of truth for authorized /approve actors |