Skip to content

feat: add centralized contributor governance workflow#3

Open
R-Lawton wants to merge 6 commits into
mainfrom
feat/contributor-governance
Open

feat: add centralized contributor governance workflow#3
R-Lawton wants to merge 6 commits into
mainfrom
feat/contributor-governance

Conversation

@R-Lawton

@R-Lawton R-Lawton commented Jun 18, 2026

Copy link
Copy Markdown

adds a reusable GitHub Actions workflow that enforces contributor governance across Kuadrant repos:

  • auto-labels new issues with triage/needs-triage
  • protects triage labels — only org members can change them
  • closes PRs from non-org-members that don't link to a triaged issue
  • limits external contributors to one active PR per repo (extras auto-drafted)

target repos adopt this via a thin caller workflow (~15 lines) with secrets: inherit.

TEST REPO https://github.com/Kuadrant/governance-test

requires

  • org-level secret ORG_MEMBER_TOKEN with read:org scope (done)
  • triage/* labels created in target repos (separate rollout step)

Summary by CodeRabbit

  • New Features
    • Added a reusable contributor governance workflow to automatically apply triage labels and manage triage label consistency.
    • Automatically comments and closes pull requests that don’t reference a linked issue, don’t target an open issue, or aren’t backed by a triage-accepted issue.
    • Added anti-piggyback protection to prevent multiple open pull requests targeting the same issue.
    • Introduced a workflow template for applying these governance checks.
  • Documentation
    • Added contribution guidelines covering triage labels and PR requirements.

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@R-Lawton, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 17 minutes and 34 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9043d585-3278-4c0c-ab4e-a49559b9ec5a

📥 Commits

Reviewing files that changed from the base of the PR and between 69c980b and b7ccec8.

📒 Files selected for processing (2)
  • CONTRIBUTING.md
  • workflow-templates/contributor-governance.yml
📝 Walkthrough

Walkthrough

Adds a reusable contributor-governance workflow for issue labelling, triage-label protection, and PR checks, plus a workflow template and contributing guidance for using it.

Changes

Contributor Governance Workflow

Layer / File(s) Summary
Workflow entrypoint and issue auto-labelling
.github/workflows/contributor-governance.yml
Declares the workflow_call trigger and the label-new-issues job, which automatically applies triage/needs-triage to newly opened issues.
Triage-label protection job
.github/workflows/contributor-governance.yml
Checks org membership for issue label changes, reverts unauthorized triage/* label edits, restores triage/needs-triage when needed, and posts an explanatory comment.
PR validation with linked-issue and anti-piggyback checks
.github/workflows/contributor-governance.yml
Resolves linked issues, requires an open linked issue with triage/accepted, and closes PRs that conflict with another open PR targeting the same issue.
Workflow template and contributor guidance
workflow-templates/contributor-governance.properties.json, workflow-templates/contributor-governance.yml, CONTRIBUTING.md
Adds the workflow template metadata, template trigger wiring, and contributor instructions covering triage labels, PR prerequisites, and the contribution workflow.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐇 I hop through labels with a careful nose,
Triage stays tidy where the garden grows.
PRs bring their issues, polite and neat,
And piggyback rabbits meet a swift retreat.
Governance hums in the moonlit burrow glow —
All paths are guided where the good hops go.

🚥 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 clearly and concisely summarises the main change: a centralised contributor governance workflow.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/contributor-governance

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.

@R-Lawton R-Lawton force-pushed the feat/contributor-governance branch from 70b691a to ef0cdfc Compare June 19, 2026 09:57
@R-Lawton R-Lawton marked this pull request as ready for review June 19, 2026 10:00

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

I wonder about adding some documentation in our contributors guides related to this governance workflow. Maybe some template in this repo so others can render their own?

Adds a reusable GitHub Actions workflow that enforces contributor
governance across Kuadrant repos:

- Auto-labels new issues with triage/needs-triage
- Protects triage labels from non-org-members
- Closes PRs without a linked, triaged issue

Org members are exempt from all enforcement.
Requires ORG_MEMBER_TOKEN secret with read:org and repo scope.

Signed-off-by: R-Lawton <rlawton@redhat.com>
@R-Lawton R-Lawton force-pushed the feat/contributor-governance branch from ef0cdfc to 4ed8c61 Compare June 23, 2026 14:44

@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: 7

🤖 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/contributor-governance.yml:
- Around line 319-341: The duplicate PR check only examines
closingIssuesReferences for existing open PRs, but the current PR uses a regex
fallback to detect plain references like `#123` without closing keywords. To
ensure consistency, apply the same regex fallback pattern used for the current
PR to the otherPrIssues check. This involves extracting issue references from
the other PR's body text using the same regex logic, not just relying on
closingIssuesReferences, so that PRs with informal issue references are also
properly detected as duplicates.
- Around line 205-207: The issueRegex pattern in the contributor-governance.yml
workflow does not recognize full GitHub issue URLs in the format
https://github.com/Kuadrant/<repo>/issues/<number>. Update the issueRegex
pattern to also match and extract the issue number from these complete GitHub
URLs, not just shorthand references like `#123` or Kuadrant/repo#123. This will
ensure that PRs containing full GitHub URLs in their body are correctly
identified as having linked issues.
- Around line 308-310: The current loop skips PRs authored by the same actor
using the condition `if (otherPr.user.login === actor) continue;`, which
prevents the one-active-PR-per-external-contributor rule from being enforced.
Remove this condition so that the loop checks all other active PRs by the same
external contributor, allowing the validation logic to detect and block multiple
active PRs from a single external contributor. Keep only the check that skips
the current PR by its number while ensuring the logic properly identifies when
an external contributor has other active PRs already in the repository.
- Around line 88-115: The workflow currently removes an unauthorised triage
label but only restores it with a default 'triage/needs-triage' label instead of
restoring the exact label that was removed. When the action is 'unlabeled',
capture the removed label name from context.payload.label.name (which is a
triage label based on the conditional check), and instead of only adding
'triage/needs-triage' when no triage label remains, directly re-add that
specific removed label to preserve the original triage status. This ensures that
removing a triage label like 'triage/accepted' restores 'triage/accepted' rather
than downgrading it to 'triage/needs-triage'.
- Around line 14-16: The workflow_call trigger in the on section does not
declare the ORG_MEMBER_TOKEN secret that is required by the
protect-triage-labels and check-pr jobs. Add a secrets section under
workflow_call to explicitly declare ORG_MEMBER_TOKEN as a required secret so
that callers of this reusable workflow are aware of the dependency at invocation
time rather than failing at runtime when the jobs attempt to access
secrets.ORG_MEMBER_TOKEN.
- Around line 313-318: The organisation membership check for other PR authors
lacks error handling for non-204 responses, unlike the primary actor check and
protect-triage-labels check elsewhere in the file. After the fetch call in the
otherRes section (around line 313-318), add error handling that throws an error
if the response status is neither 204 (member confirmed) nor 404 (non-member).
This ensures that 401, 403, and 5xx error responses are properly caught and
reported instead of falling through as if the user is a non-member, which could
cause an organisation member's PR to incorrectly block an external contributor's
PR.
- Around line 134-158: The job condition currently only triggers on pull_request
events, which prevents it from running when callers use the pull_request_target
trigger pattern needed for fork pull requests to access secrets. Since this job
performs only API-level operations without checking out untrusted code, modify
the if condition to allow both pull_request and pull_request_target event types
while keeping the action checks for opened and reopened. Update the condition to
include both event names using OR logic.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 350255b3-7261-41d4-ace0-8096ce615a61

📥 Commits

Reviewing files that changed from the base of the PR and between 4ba7a5e and 4ed8c61.

📒 Files selected for processing (1)
  • .github/workflows/contributor-governance.yml

Comment thread .github/workflows/contributor-governance.yml
Comment thread .github/workflows/contributor-governance.yml
Comment thread .github/workflows/contributor-governance.yml Outdated
Comment thread .github/workflows/contributor-governance.yml Outdated
Comment thread .github/workflows/contributor-governance.yml
Comment thread .github/workflows/contributor-governance.yml
Comment thread .github/workflows/contributor-governance.yml
R-Lawton added 2 commits June 23, 2026 16:03
- CONTRIBUTING.md explains the triage process and PR requirements
- workflow-templates/ provides a GitHub-native template that repos
  can adopt from the Actions > New Workflow page

Signed-off-by: R-Lawton <rlawton@redhat.com>
- Declare ORG_MEMBER_TOKEN as required secret in workflow_call
- Support pull_request_target for fork PRs accessing secrets
- Match full GitHub issue URLs (github.com/.../issues/N)
- Add error handling on anti-piggyback org membership check

Signed-off-by: R-Lawton <rlawton@redhat.com>

@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

🧹 Nitpick comments (2)
CONTRIBUTING.md (1)

15-15: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use British English phrasing.

"have a look" is more idiomatic in British English than "take a look".

-If you think an issue should be re-prioritised, leave a comment and a maintainer will take a look.
+If you think an issue should be re-prioritised, leave a comment and a maintainer will have a look.
🤖 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 `@CONTRIBUTING.md` at line 15, The wording in the maintainer guidance uses a
phrase that is less idiomatic for British English. Update the triage-label
sentence in CONTRIBUTING.md to use British phrasing by changing the “take a
look” wording to “have a look,” keeping the rest of the guidance unchanged.
workflow-templates/contributor-governance.yml (1)

13-13: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Pin the reusable workflow to an immutable ref.

Using @main means every adopting repository picks up future governance changes immediately, including breaking ones. A release tag or commit SHA makes roll-outs reviewable and reproducible.

🤖 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 `@workflow-templates/contributor-governance.yml` at line 13, The reusable
workflow reference currently points to `@main`, which is mutable and can change
behavior unexpectedly. Update the workflow reference in
contributor-governance.yml to use an immutable ref such as a release tag or
commit SHA instead of `@main`, so the adopted workflow remains reproducible and
reviewable.
🤖 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 `@workflow-templates/contributor-governance.yml`:
- Around line 6-14: The workflow in contributor-governance.yml is triggering
twice and failing on forked PRs because both pull_request and
pull_request_target are enabled. Remove the pull_request trigger from the
top-level event list and keep pull_request_target for the governance job so the
reusable workflow invoked by governance still gets the required secrets through
secrets: inherit without duplicate or failing runs.

---

Nitpick comments:
In `@CONTRIBUTING.md`:
- Line 15: The wording in the maintainer guidance uses a phrase that is less
idiomatic for British English. Update the triage-label sentence in
CONTRIBUTING.md to use British phrasing by changing the “take a look” wording to
“have a look,” keeping the rest of the guidance unchanged.

In `@workflow-templates/contributor-governance.yml`:
- Line 13: The reusable workflow reference currently points to `@main`, which is
mutable and can change behavior unexpectedly. Update the workflow reference in
contributor-governance.yml to use an immutable ref such as a release tag or
commit SHA instead of `@main`, so the adopted workflow remains reproducible and
reviewable.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 735bb239-4e13-4219-ac82-d06726c2f72a

📥 Commits

Reviewing files that changed from the base of the PR and between 4ed8c61 and 69c980b.

📒 Files selected for processing (4)
  • .github/workflows/contributor-governance.yml
  • CONTRIBUTING.md
  • workflow-templates/contributor-governance.properties.json
  • workflow-templates/contributor-governance.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/contributor-governance.yml

Comment thread workflow-templates/contributor-governance.yml Outdated
R-Lawton added 2 commits June 26, 2026 15:52
Having both pull_request and pull_request_target causes duplicate
runs. pull_request_target is needed for fork PRs to access secrets.

Signed-off-by: R-Lawton <rlawton@redhat.com>
General contribution guidance lives on the website. This file
now only covers the triage labels and PR requirements enforced
by the governance automation.

Signed-off-by: R-Lawton <rlawton@redhat.com>
@R-Lawton R-Lawton force-pushed the feat/contributor-governance branch from c367ef1 to 6cbc69e Compare June 26, 2026 15:01
@R-Lawton R-Lawton requested a review from eguzki June 26, 2026 15:04
Triage is now just needs-triage → accepted. Removed milestone
references — triage means the team has discussed, prioritised,
and approved the issue for work.

Signed-off-by: R-Lawton <rlawton@redhat.com>
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