mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:10:52 +01:00
[PR #155] [MERGED] ci: label pull requests that conflict with main needs rebase (PR-CONFLICT-LABEL) #206
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#206
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/155
Author: @Mouad-Scriptz-0
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism
Base:
main← Head:ci/needs-rebase-label📝 Commits (1)
4f7a347ci: label pull requests that conflict with mainneeds rebase(PR-CONFLICT-LABEL)📊 Changes
6 files changed (+373 additions, -8 deletions)
View changed files
📝
.github/pull_request_template.md(+6 -0)➕
.github/workflows/conflict-label.yml(+41 -0)📝
CONTRIBUTING.md(+10 -0)📝
tests/test_docs_pr_template.py(+10 -8)➕
tests/test_pr_conflict_label.py(+157 -0)➕
tools/pr_conflict_label.py(+149 -0)📄 Description
Claimed in the coordination issue as: PR-CONFLICT-LABEL (#14)
Depends on: none. #56 and #100 also edit
CONTRIBUTING.md, but only its lines 15–25; this adds a section at the end of the file and does not conflict with either.What and why
Every pull request here is reviewed by hand, and 109 are open. Right now, 23 of them conflict with
mainand can't be merged until their authors rebase, but nothing marks which ones. This adds aneeds rebaselabel so a reviewer can skip them and their authors know what to do. It's modelled on AnyPS5's contributing pipeline. The code was written here, not copied (AnyPS5 is GPL-2.0).tools/pr_conflict_label.py(standard library only)--pr), it reads GitHub'smergeableanswer and labels the conflicting onesneeds rebase. Once a pull request merges cleanly again, the label is removed.mergeablein the background and answersnulluntil it's done. An unknown answer is asked again up to 4 times, 10 s apart, and otherwise left alone for the next run. The tool never guesses.d93f0b, "Conflicts with the base branch: rebase it on main").--dry-runprints what it would change and writes nothing..github/workflows/conflict-label.ymlruns the tool:main, checking all open pull requests, since a merge can make others conflict;pull_request_targetopened/reopened/synchronize, checking that one pull request, since a rebase can clear a conflict;workflow_dispatch.Security.
pull_request_targetis what gives a fork's pull request a token that can write labels. Here it's safe:persist-credentials: false.permissions: {}. The job getscontents: readandpull-requests: writeonly.actions/checkoutis pinned to the same SHA as the other workflows.tests/test_pr_conflict_label.pychecks all of these properties in the workflow file.PR template and CONTRIBUTING.md
Fixes:(Fixes: #Ncloses the issue on merge) andGPUs tested:(vendor, model, driver and OS).mainand merges cleanly" and "one topic; follow-up work goes in a new pull request". The existing claim,Depends on:andAI-assisted:lines are kept.tests/test_docs_pr_template.pynow requires the new prompts.CONTRIBUTING.mdgets a short Pull requests section at the end: one topic per pull request, fill in the template, and what the label means.This workflow only starts running once it's on
main, becausepull_request_targetuses the base branch's copy. So it can't label anything from this pull request.Tested
tests/test_pr_conflict_label.py: 12 tests against a fake GitHub API, all OK. They cover everydecide()case, retrying an uncomputed merge and then leaving it alone, creating the label once and only when needed, an existing label (422), a label removed in the meantime (404), closed pull requests being skipped, dry runs writing nothing, paging past 100, and the workflow's checkout and permission rules. Breakingdecide()makes the suite fail.--dry-run, read-only GETs with my token):109 checked: 23 labeled, 0 unlabeled, 0 not computed yet. I spot-checked against GitHub: #100, #52 and #141 reportCONFLICTINGand were flagged; #98 and #24 reportMERGEABLEand were not.tests/test_docs_pr_template.py,test_ci_registration.py(the new test file is picked up by the standard-library loop),test_docs_links.py,test_text_write_line_endings.py,test_runtime_paths.py,test_no_game_data_workflow.py,python -m compileall -q make_game.py tools tests, andscripts/check_no_game_data.pyon every changed file.actionlintisn't installed here, so thejactionlintjob in CI is the first lint of it.GPUs tested: n/a (CI and docs only)
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.