Skip to content

ci: add issue approval workflows for maintainer triage - #2192

Open
batchu5 wants to merge 6 commits into
asyncapi:masterfrom
batchu5:feat/issue-approval-workflows
Open

ci: add issue approval workflows for maintainer triage#2192
batchu5 wants to merge 6 commits into
asyncapi:masterfrom
batchu5:feat/issue-approval-workflows

Conversation

@batchu5

@batchu5 batchu5 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Description

  • Adds issue-awaiting-approval.yml — automatically labels every newly opened issue with Awaiting Approval
  • Adds issue-approve-command.yml — lets authorized maintainers (derberg, Adi-204) approve issues via /approve comment command, which removes Awaiting Approval, adds Approved Issue, and posts a contributor instruction comment with approval attribution
  • Adds close-prs-for-unapproved-issues.yml — automatically closes PRs that either reference an unapproved issue (still labeled Awaiting Approval) or don't reference any issue at all, with an explanatory comment in both cases
  • All workflows follow existing repo patterns (actions/github-script@v7, secrets.GH_TOKEN) and auto-create labels if they don't exist yet

Related issue(s)

Resolves #1838

AI assistance

  • This PR was created with AI assistance — Generated-by: Claude Opus 4.6
  • No AI assistance was used

Summary by CodeRabbit

  • New Features
    • Added an issue approval workflow with an /approve command for authorized maintainers, including feedback for unauthorized attempts.
    • New issues are automatically labeled as awaiting approval.
    • Pull requests referencing missing or unapproved issues are automatically closed with an explanatory comment.
  • Documentation
    • Updated pull request guidance with clearer related-issue examples.

@changeset-bot

changeset-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: e83afe8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@asyncapi-bot

Copy link
Copy Markdown
Contributor

What reviewer looks at during PR review

The following are ideal points maintainers look for during review. Reviewing these points yourself beforehand can help streamline the review process and reduce time to merge.

  1. PR Title: Use a concise title that follows our Conventional Commits guidelines and clearly summarizes the change using imperative mood (it means spoken or written as if giving a command or instruction, like "add new helper for listing operations")

    Note - In Generator, prepend feat: or fix: in PR title only when PATCH/MINOR release must be triggered.

  2. PR Description: Clearly explain the issue being solved, summarize the changes made, and mention the related issue.

    Note - In Generator, we use Maintainers Work board to track progress. Ensure the PR Description includes Resolves #<issue-number> or Fixes #<issue-number> this will automatically close the linked issue when the PR is merged and helps automate the maintainers workflow.

  3. Documentation: Update the relevant Generator documentation to accurately reflect the changes introduced in the PR, ensuring users and contributors have up-to-date guidance.

  4. Comments and JSDoc: Write clear and consistent JSDoc comments for functions, including parameter types, return values, and error conditions, so others can easily understand and use the code.

  5. DRY Code: Ensure the code follows the Don't Repeat Yourself principle. Look out for duplicate logic that can be reused.

  6. Test Coverage: Ensure the new code is well-tested with meaningful test cases that pass consistently and cover all relevant edge cases.

  7. Commit History: Contributors should avoid force-pushing as much as possible. It makes it harder to track incremental changes and review the latest updates.

  8. Template Design Principles Alignment: While reviewing template-related changes in the packages/ directory, ensure they align with the Assumptions and Principles. If any principle feels outdated or no longer applicable, start a discussion these principles are meant to evolve with the project.

  9. Reduce Scope When Needed: If an issue or PR feels too large or complex, consider splitting it and creating follow-up issues. Smaller, focused PRs are easier to review and merge.

  10. Bot Comments: As reviewers, check that contributors have appropriately addressed comments or suggestions made by automated bots. If there are bot comments the reviewer disagrees with, react to them or mark them as resolved, so the review history remains clear and accurate.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6fa702cf-7652-43b7-b02d-f138caf3e75c

📥 Commits

Reviewing files that changed from the base of the PR and between 2ffb87f and e83afe8.

📒 Files selected for processing (1)
  • .github/pull-request-template.md

Included review availability: Your plan includes up to 4 reviews per rolling hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

New GitHub Actions workflows label new issues, process maintainer-only /approve commands, and enforce linked-issue approval on pull requests.

Changes

Issue approval enforcement

Layer / File(s) Summary
Automatic issue approval status
.github/workflows/issue-awaiting-approval.yml
Labels newly opened issues as Awaiting Approval, creating the label when necessary.
Maintainer approval command
.github/workflows/issue-approve-command.yml
Rejects unauthorized /approve commands and lets derberg and Adi-204 apply Approved Issue, remove Awaiting Approval, and post contributor instructions.
Pull request approval enforcement
.github/workflows/close-prs-for-unapproved-issues.yml, .github/pull-request-template.md
Checks pull request references on opened, edited, and reopened events. It comments on and closes pull requests with missing, nonexistent, or unapproved linked issues. The template retains only resolving issue-reference examples.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to e83af

This PR adds issue-approval and unapproved-issue PR-handling workflows; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title uses a Conventional Commits prefix, imperative wording, and clearly describes the added issue approval workflows.
Linked Issues check ✅ Passed The workflows implement automatic pending labels, maintainer approval, contributor guidance, and PR prevention requirements from [#1838].
Out of Scope Changes check ✅ Passed All changes support the issue approval flow, including pending labels, approval commands, PR enforcement, and related template guidance.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

🧹 Nitpick comments (2)
.github/workflows/issue-approve-command.yml (1)

14-19: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

startsWith prefix match can be triggered by unintended comments.

startsWith(github.event.comment.body, '/approve') also matches comments like /approved, /approve-later, or /approves this. Consider requiring the command to be the whole first line or followed by whitespace/end-of-string.

🩹 Suggested tightening
-      startsWith(github.event.comment.body, '/approve')
+      (github.event.comment.body == '/approve' || startsWith(github.event.comment.body, '/approve '))

Also applies to: 43-48

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/issue-approve-command.yml around lines 14 - 19, Update the
command condition in the workflow’s issue-comment approval check to accept
/approve only when it is the complete first line or is followed by
whitespace/end-of-string, rather than using an unrestricted prefix match.
Preserve the existing pull-request, state, actor, and command-flow checks while
preventing variants such as /approved, /approve-later, and /approves from
triggering.
.github/workflows/issue-awaiting-approval.yml (1)

26-39: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Unhandled race on label creation in both "ensure label exists" blocks. Both workflows check listLabelsForRepo then call createLabel if absent, with no try/catch. If two workflow runs execute this check concurrently (e.g., two issues opened together, or an approve + an issue-open racing), the loser's createLabel call throws (422 duplicate label) and aborts the job before the label is actually added to the issue.

  • .github/workflows/issue-awaiting-approval.yml#L26-L39: wrap createLabel for 'Awaiting Approval' in try/catch (ignore 422/"already_exists" errors) so addLabels on Line 42 still runs.
  • .github/workflows/issue-approve-command.yml#L84-L97: wrap createLabel for 'Approved Issue' in try/catch (ignore 422/"already_exists" errors) so addLabels on Line 100 still runs.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/issue-awaiting-approval.yml around lines 26 - 39, Handle
the label-creation race in both .github/workflows/issue-awaiting-approval.yml
lines 26-39 and .github/workflows/issue-approve-command.yml lines 84-97 by
wrapping each createLabel call in try/catch, ignoring only 422 or already_exists
errors and rethrowing other failures; ensure the subsequent addLabels call still
executes in both workflows.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/close-prs-for-unapproved-issues.yml:
- Around line 55-83: Update the error handling around
github.rest.issues.listLabelsOnIssue in the PR validation loop so a 404 response
is treated as an invalid issue reference and closes the associated PR using the
same comment-and-pulls.update flow as an unapproved issue. Preserve logging and
loop continuation for other API errors, and ensure nonexistent or mistyped issue
numbers cannot pass validation silently.

In @.github/workflows/issue-approve-command.yml:
- Around line 113-130: Update the commentBody template in the approval workflow
to close the Markdown italics around the approver attribution, preserving the
existing message text and interpolated approver value.
- Around line 42-130: Add a guard before the approval actions, using the
existing issue labels to detect whether “Approved Issue” is already present, and
return or skip the workflow when it is. Ensure the guard covers the subsequent
label and “Post approval instruction comment” steps so repeated or concurrent
/approve commands do not create duplicate approval comments.

---

Nitpick comments:
In @.github/workflows/issue-approve-command.yml:
- Around line 14-19: Update the command condition in the workflow’s
issue-comment approval check to accept /approve only when it is the complete
first line or is followed by whitespace/end-of-string, rather than using an
unrestricted prefix match. Preserve the existing pull-request, state, actor, and
command-flow checks while preventing variants such as /approved, /approve-later,
and /approves from triggering.

In @.github/workflows/issue-awaiting-approval.yml:
- Around line 26-39: Handle the label-creation race in both
.github/workflows/issue-awaiting-approval.yml lines 26-39 and
.github/workflows/issue-approve-command.yml lines 84-97 by wrapping each
createLabel call in try/catch, ignoring only 422 or already_exists errors and
rethrowing other failures; ensure the subsequent addLabels call still executes
in both workflows.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 12ced23b-b589-4b5f-be1f-7605a2fe17b5

📥 Commits

Reviewing files that changed from the base of the PR and between d5113c4 and a99a039.

📒 Files selected for processing (3)
  • .github/workflows/close-prs-for-unapproved-issues.yml
  • .github/workflows/issue-approve-command.yml
  • .github/workflows/issue-awaiting-approval.yml

Comment thread .github/workflows/close-prs-for-unapproved-issues.yml
Comment thread .github/workflows/issue-approve-command.yml
Comment thread .github/workflows/issue-approve-command.yml

@coderabbitai coderabbitai 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/close-prs-for-unapproved-issues.yml (1)

62-62: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Require Approved Issue, rather than absence of Awaiting Approval.

Line 62 lets a PR through whenever the pending label is absent. A PR opened immediately after its issue can therefore pass before the issue-labeling workflow adds Awaiting Approval; it will not be reevaluated unless edited. Require the approval workflow’s positive Approved Issue label instead.

Proposed fix
             const awaitingLabel = 'Awaiting Approval';
+            const approvedLabel = 'Approved Issue';
 
-                if (labels.some(l => l.name === awaitingLabel)) {
+                if (!labels.some(l => l.name === approvedLabel)) {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/close-prs-for-unapproved-issues.yml at line 62, Update the
label condition around the visible labels check to require the positive Approved
Issue label, rather than allowing the PR when Awaiting Approval is absent.
Preserve the existing close/skip behavior for PRs without approval, and use the
workflow’s established approval-label symbol if one exists.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.github/workflows/close-prs-for-unapproved-issues.yml:
- Line 62: Update the label condition around the visible labels check to require
the positive Approved Issue label, rather than allowing the PR when Awaiting
Approval is absent. Preserve the existing close/skip behavior for PRs without
approval, and use the workflow’s established approval-label symbol if one
exists.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c18a9617-66c3-4b5d-b3ef-456dbc5ea08c

📥 Commits

Reviewing files that changed from the base of the PR and between a99a039 and 5608c3a.

📒 Files selected for processing (3)
  • .github/workflows/close-prs-for-unapproved-issues.yml
  • .github/workflows/issue-approve-command.yml
  • .github/workflows/issue-awaiting-approval.yml
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/issue-awaiting-approval.yml
  • .github/workflows/issue-approve-command.yml

@derberg derberg moved this to In Progress in Maintainers work Jul 29, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/issue-awaiting-approval.yml:
- Around line 17-20: Replace the checkout action with actions/github-script
pinned to a full commit SHA wherever the JavaScript script runs:
.github/workflows/issue-awaiting-approval.yml lines 17-20; all four script steps
in .github/workflows/issue-approve-command.yml at lines 25-30, 54-57, 82-85, and
120-125; and .github/workflows/close-prs-for-unapproved-issues.yml lines 19-22.
Preserve each step’s existing script and inputs while ensuring github and core
are provided by github-script.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 647627c2-68ce-4b7e-b4c9-9689394bf8db

📥 Commits

Reviewing files that changed from the base of the PR and between 5608c3a and e135524.

📒 Files selected for processing (3)
  • .github/workflows/close-prs-for-unapproved-issues.yml
  • .github/workflows/issue-approve-command.yml
  • .github/workflows/issue-awaiting-approval.yml

Comment thread .github/workflows/issue-awaiting-approval.yml Outdated
Comment thread .github/workflows/close-prs-for-unapproved-issues.yml

@Adi-204 Adi-204 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@batchu5 A couple of remaining edge cases see inline notes.

Comment thread .github/workflows/close-prs-for-unapproved-issues.yml
@sonarqubecloud

Copy link
Copy Markdown

@Adi-204 Adi-204 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm @derberg can you please have a final look and merge it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Improve contributor workflow: Introduce “Awaiting Maintainer Approval” status for new issues

4 participants