Skip to content

Phase 1: Org-wide PR template, label taxonomy, and reusable workflows#2

Merged
bryanbeverly merged 1 commit into
mainfrom
feat/pr-labeling-phase-1
Apr 20, 2026
Merged

Phase 1: Org-wide PR template, label taxonomy, and reusable workflows#2
bryanbeverly merged 1 commit into
mainfrom
feat/pr-labeling-phase-1

Conversation

@bryanbeverly
Copy link
Copy Markdown
Contributor

@bryanbeverly bryanbeverly commented Apr 20, 2026

Summary

Phase 1 of a cross-repo PR labeling and hygiene rollout. Populates this repo with shared building blocks that consumer repos in the org will call.

What this PR adds:

File Purpose
.github/PULL_REQUEST_TEMPLATE.md Default PR template inherited by every repo without its own
labels.yml Single source of truth for the 11-label taxonomy (size/*, risk/*, review/urgent, status/stale, complexity/high)
.github/workflows/pr-labeler-reusable.yml Reusable workflow: applies size/risk/checkbox labels
.github/workflows/label-sync-reusable.yml Reusable workflow: syncs labels.yml into a caller repo
.github/workflows/stale-reusable.yml Reusable workflow: wraps actions/stale@v9 (14d stale, 16d close, exempts review/urgent and drafts)
.github/workflows/lint.yml ruff (Python) + actionlint (workflow YAML)
.github/workflows/test-scripts.yml Runs unit tests on PRs and pushes
.github/scripts/pr_labeler.py Labeler logic: size buckets, Bugbot risk parsing, checkbox state
.github/scripts/label_sync.py Label sync logic via `gh label create --force` (additive)
.github/scripts/test_pr_labeler.py 35 unit tests for labeler logic
README.md Documents what lives here, perms model, how to add a label

Permissions model: No reusable workflow declares its own `permissions:` block — they inherit from callers. Each consumer caller declares the minimum its reusable needs (documented in README).

Versioning: Caller workflows reference these reusables at `@main`. Pushes to this branch immediately affect every consumer once they merge their callers in subsequent phases. Branch protection on `main` requires PR review.

Required follow-up after merge (manual UI step)

Set org default labels: `Organization settings > Repository defaults > Repository labels` → replace GitHub's defaults with the 11 labels from `labels.yml` so brand-new repos get them on day one. Existing repos are populated by the sync workflow in subsequent phases.

(No "enable Actions access" step is needed — this repo is public, so its reusable workflows are callable from anywhere by default.)

Test plan

  • All 35 unit tests pass locally (size buckets, Bugbot risk regex incl. unmapped levels, three-state checkbox parsing, label reconciliation that doesn't strip manual labels)
  • All YAML files parse cleanly
  • `ruff check` and `ruff format --check` clean on all Python sources
  • `actionlint` clean on all 5 workflow files
  • Lint and test-scripts CI workflows run green on this PR

Made with Cursor


Note

Medium Risk
Medium risk because it introduces reusable GitHub Actions and automation that can modify labels and stale/close PRs across consumer repos once adopted.

Overview
Adds org-wide GitHub tooling in this .github repo: a default PULL_REQUEST_TEMPLATE.md, a canonical labels.yml, and reusable workflows for label syncing, PR auto-labeling, and PR staleness handling.

Implements Python scripts to (1) sync labels into a target repo via gh label create --force (additive) and (2) compute/apply PR size/*, risk/* (from <!-- CURSOR_SUMMARY -->), and author-declared review/urgent / complexity/high labels from template checkboxes, with unit tests plus CI linting (ruff, actionlint) and script test coverage.

Reviewed by Cursor Bugbot for commit e55e76b. Bugbot is set up for automated code reviews on this repo. Configure here.

This populates trufflesecurity/.github with shared building blocks that
consumer repos in the org will call:

* `.github/PULL_REQUEST_TEMPLATE.md` — default PR template inherited by
  any repo without its own
* `labels.yml` — single source of truth for the 11-label taxonomy
  (size/risk/review/status/complexity)
* `.github/workflows/pr-labeler-reusable.yml` — applies size/risk/checkbox
  labels to PRs (size from additions+deletions, risk parsed from Bugbot's
  CURSOR_SUMMARY block, three-state checkbox labels from the template)
* `.github/workflows/label-sync-reusable.yml` — additively syncs labels.yml
  into a caller repo via `gh label create --force`
* `.github/workflows/stale-reusable.yml` — wraps actions/stale@v9 with the
  org's PR hygiene policy (14d stale, 16d close, exempts review/urgent and
  drafts, throttled to 30 ops/run)
* `.github/scripts/{pr_labeler,label_sync}.py` — labeler/sync logic
* `.github/scripts/test_pr_labeler.py` — 35 unit tests for labeler logic
* `.github/workflows/test-scripts.yml` — runs unit tests on PRs and pushes
* `.github/workflows/lint.yml` — ruff (Python) + actionlint (workflow YAML)
* `README.md` — documents what lives here, the perms model, and how to
  add a label

No reusable workflow declares its own `permissions:` block — they inherit
from callers, so each consumer must grant the minimum needed (documented
in the README).

Made-with: Cursor
@bryanbeverly bryanbeverly self-assigned this Apr 20, 2026
@bryanbeverly bryanbeverly marked this pull request as ready for review April 20, 2026 04:37
@bryanbeverly bryanbeverly merged commit c4c3771 into main Apr 20, 2026
4 checks passed
@bryanbeverly bryanbeverly deleted the feat/pr-labeling-phase-1 branch April 20, 2026 05:01
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