Add shared labeling scripts + label taxonomy#3
Merged
Conversation
…lows Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds shared label and labeling-script artifacts used by org reusable workflows. These files live here (rather than in an internal repo) because GitHub's auto-generated
GITHUB_TOKENis scoped to the workflow's calling repo and cannotactions/checkoutan internal repo, even with "Actions > Access" enabled. Hosting these data/script files in this public repo lets reusable workflows in our internal.github-privaterepo check them out without a PAT or App credential.The reusable workflow YAML itself, the operator docs, and rollout-specific configuration continue to live in
.github-private. Only the non-sensitive shared data and scripts move here.Files added
labels.yml— standard label taxonomy (size/risk/review/status/complexity)..github/scripts/pr_labeler.py— computes size, risk (from Bugbot CURSOR_SUMMARY), and template-checkbox labels for one or more PRs. Idempotent; handles event, single-PR, and full-backfill modes..github/scripts/label_sync.py— readslabels.ymland runsgh label create --forcefor each entry. Additive (never deletes) so legacy labels are preserved..github/scripts/test_pr_labeler.py— 35 pytest unit tests covering size buckets, risk parsing, checkbox state, and reconciliation..github/workflows/lint.yml—ruff check+ruff format --checkon.github/scripts/, andactionlinton workflow YAML. Same conventions as our other repos..github/workflows/test-scripts.yml— pytest CI for the scripts (path-filtered to.github/scripts/**)..gitignore— Python venv/cache patterns.Why this is safe to be public
The scripts and label list contain no internal-only information:
"owner/repo", no real repo names)actions/checkout@v4and standard public actionsLocal development
Test plan
ruff check .github/scripts/passes locallyruff format --check .github/scripts/passes (3 files already formatted)pytest .github/scripts/— 35/35 passingactionlintpasses on all workflow YAML.github-privateupdates its reusable workflows toactions/checkout repository: trufflesecurity/.githuband removes the duplicated files there. Both PRs should land in close succession.Note
Medium Risk
Adds automation that mutates repo labels and PR labels via the GitHub CLI; misconfiguration or parsing edge cases could apply incorrect labels across many open PRs during backfill.
Overview
Introduces a shared
labels.ymltaxonomy and alabel_sync.pyscript to upsert those labels into a target repo viagh label create --force(additive; no deletions).Adds a
pr_labeler.pytool (with pytest coverage) that computes and reconciles PRsize/*,risk/*(from Bugbot<!-- CURSOR_SUMMARY -->), and template checkbox labels (review/urgent,complexity/high), supporting event/single-PR andallopen-PR backfill modes.Wires in CI via new
lint.yml(ruff + actionlint) andtest-scripts.yml(pytest), plus a Python-focused.gitignore.Reviewed by Cursor Bugbot for commit 6e32bb0. Bugbot is set up for automated code reviews on this repo. Configure here.