Repository navigation
ci: check that a pull request's author is assigned to the issue it addresses - #240
Conversation
…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>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 81 |
| Duplication | 0 |
🟢 Coverage ∅ diff coverage · +0.00% coverage variation
Metric Results Coverage variation ✅ +0.00% coverage variation (-1.00%) Diff coverage ✅ ∅ diff coverage 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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
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:Fixes #12,Addresses #12, or one GitHub links)Part of #118does not count as a reference: that is an umbrella issue.OWNER,MEMBERandCOLLABORATORauthors and bots pass. A maintainer can waive the rule with theno-issue-neededlabel (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-assignmentlabel 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, withgharguments 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 apull_request_targetworkflow runs frommain. After merging I will run it from Actions > Assignment withdry_runon (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