Skip to content

ci: check that a pull request's author is assigned to the issue it addresses - #240

Merged
petercorke merged 2 commits into
mainfrom
ci/assignment-check
Nov 8, 2026
Merged

petercorke merged 2 commits into
mainfrom
ci/assignment-check

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Enforces the rule in #239: ask to be assigned, and wait, before opening a pull request. Several people, and agents, picked up the same issues at once under the old wording, and nothing checked it.

The rule (.github/scripts/assignment_check.py, run by .github/workflows/assignment.yml), for an author who is not a maintainer or a bot:

Pull request Result
mentions an issue (Fixes #12, Addresses #12, or one GitHub links) the author must be assigned to it
mentions none, and changes only documentation passes, a typo needs no issue
mentions none, and changes anything else fails

Part of #118 does not count as a reference: that is an umbrella issue. OWNER, MEMBER and COLLABORATOR authors and bots pass. A maintainer can waive the rule with the no-issue-needed label (an outside contributor cannot add labels), and the check runs again when the label changes, when the description is edited, or when it is re-run after an assignment.

What a failure does: the check goes red, one comment explains the rule and the way out (it is updated, not repeated), and the needs-assignment label is added. It does not close the pull request, so a person who is assigned a day later is not turned away. Closing would be a one-line change after a trial.

Security. It runs on pull_request_target, which uses the base branch's workflow with a token that can write, also for a fork. So it never checks out, builds or runs anything from the pull request, and never puts text from the pull request into a shell command: the script only calls the GitHub API, with gh arguments as a list. This is stated at the top of both files.

Tested. tests/test_assignment_check.py (17 tests) covers the rule. The GitHub calls were run in dry-run mode against real pull requests: #229, #231 and #232 fail as expected (the issues are unassigned); #235 and #239 (maintainer) and #170 (bot) pass; #143 fails, because its author claimed #141 by comment and was never assigned, which is what the rule asks for.

Not tested: the workflow file itself. A new workflow cannot be dispatched until it is on main, and a pull_request_target workflow runs from main. After merging I will run it from Actions > Assignment with dry_run on (try #229, #143 and #235) before the first real pull request goes through it.

Behaviour: CI and contribution process only, no change to the package. It is written to be shared: if it works here, the plan is to offer it to the other repos through rvc-ecosystem.

AI assistance: written with Claude Code (Claude Sonnet 5.5), reviewed by the maintainer.

🤖 Generated with Claude Code

…dresses

A pull request that mentions an issue fails the check unless its author is assigned to
that issue; one that mentions none passes only if it changes just documentation.
Maintainers and bots pass, and a maintainer can waive the rule with the no-issue-needed
label.  A failure leaves one comment, kept up to date, and the needs-assignment label.

It runs on pull_request_target, so it only calls the GitHub API and never touches the
pull request's code.  Run it by hand, without commenting, from Actions > Assignment.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codacy-production

codacy-production Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 81 complexity · 0 duplication

Metric Results
Complexity 81
Duplication 0

View in Codacy

🟢 Coverage ∅ diff coverage · +0.00% coverage variation

Metric Results
Coverage variation ✅ +0.00% coverage variation (-1.00%)
Diff coverage ✅ ∅ diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (973c9b6) 6121 5128 83.78%
Head commit (762016c) 6121 (+0) 5128 (+0) 83.78% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#240) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@codecov

codecov Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.77%. Comparing base (973c9b6) to head (762016c).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #240   +/-   ##
=======================================
  Coverage   83.77%   83.77%           
=======================================
  Files          26       26           
  Lines        6121     6121           
=======================================
  Hits         5128     5128           
  Misses        993      993           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@petercorke
petercorke merged commit bdff2a6 into main Nov 8, 2026
24 checks passed
@petercorke
petercorke deleted the ci/assignment-check branch November 8, 2026 00:15
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