Skip to content

Restore PR label automation for release note grouping, safer this time - #2089

Open
jhodges10 wants to merge 4 commits into
AcademySoftwareFoundation:mainfrom
jhodges10:codex/restore-safe-pr-labeling
Open

jhodges10 wants to merge 4 commits into
AcademySoftwareFoundation:mainfrom
jhodges10:codex/restore-safe-pr-labeling

Conversation

@jhodges10

@jhodges10 jhodges10 commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Restore automatic file-based labels on PRs, including fork PRs, so Release Drafter can group them in the release-note categories. Release Preview keeps its existing manual release-branch and announcement controls.

This uses GitHub's actions/labeler, a small inline API lookup, and YAML configuration. There are no repository-local JavaScript files, npm dependencies, package installs, or custom label-matching/update implementations.

Background

Why the security boundary is different

GitHub's secure-use guidance and workflow_run documentation warn that both pull_request_target and workflow_run can be privileged. Changing the trigger alone is not a security fix; keeping PR-controlled code out of the privileged job is essential.

  • A pull_request workflow emits a signal with permissions: {}. It checks out no code, uses no secrets, and produces no artifacts or caches.
  • A workflow_run follow-up executes the default-branch workflow. It validates the source event, workflow path, and repository, and has only contents: read and pull-requests: write permissions.
  • The inline lookup queries current PRs in the base repository, including forks whose run payload has an empty pull_requests list. It skips superseded heads, foreign PRs, closed unmerged PRs, and PRs exceeding GitHub's file-list limit. Manual backfill accepts only a positive integer PR number and runs from the default branch.
  • The privileged job performs no checkout, package installation, artifact download, or cache restore. The only repository file it downloads is .github/labeler.yml at the trusted default-branch github.sha, through a fixed GitHub API route. PR metadata is passed as data and never interpolated into executable scripts.
  • Both actions are pinned to full commit hashes. The labeler reads file paths from GitHub's API and uses the trusted YAML rules. A successful signal is not treated as proof that its PR code is trustworthy.

Upstream labeler and concurrent edits

The labeler is pinned to b7a88044754812b108a54feec878dd5c328bba59, which includes actions/labeler#957. That fix uses selective additions/removals instead of replacing the full label list, preserving concurrent changes to unrelated labels. It is newer than the current v7.0.0 release, so updating the pin must retain this fix.

The runtime test also exposed double-encoding of path separators in this pin's remote configuration fetch. The metadata step therefore downloads the trusted YAML through a literal contents-API route and passes its temporary local path to the action. No PR file is checked out or executed.

Label coverage and release-note categories

The repository label inventory was reviewed, and .github/labeler.yml now manages 14 existing labels using the upstream action's changed-files syntax:

  • documentation: documentation trees, Doxygen, Markdown, and reStructuredText.
  • ci and github_actions: CI settings and Actions workflows, scripts, and configuration.
  • build, cmake, and wheels: build configuration, CMake, Python packaging, and wheel/publishing workflows.
  • dependencies and submodules: dependency declarations, requirements files, and submodule paths.
  • python and python-bindings: Python code and package/binding sources.
  • opentime, time calculations, and color: their implementation, binding, and test paths.
  • maintenance: maintainer tools or changes confined entirely to tests/.

All 14 automatically managed labels are connected to Release Drafter. Python & Bindings, Time, and Color get dedicated sections; build-related labels go into Maintenance. The existing enhancement and maintenance labels are recognized. Release Drafter v7.1.1 may list a PR in multiple matching sections, such as Bug Fixes and Python & Bindings.

Intent and triage labels such as bug, enhancement, security, good first issue, and WIP stay manual. The stale release-candidate rule is removed because that label is absent from the repository. The inactive Release Drafter autolabeler block is removed so the active automation has one configuration source.

Configured labels remain automation-managed; concurrent edits to those same labels are not transactional. Rollout and backfill details are in maintainers/release-notes.md.

Validation

  • Both new workflows pass actionlint; git diff --check passes.
  • All 14 managed labels were checked against the live repository inventory and Release Drafter mappings.
  • 17 representative file-change scenarios passed against the actual pinned labeler in a local mock-API harness, including root documentation, build files, submodules, Python, OpenTime, color, and mixed test/production changes (19 checks total including configuration checks).
  • Six temporary local checks pass for the inline lookup and workflow boundaries: fork PR resolution, stale/foreign/closed/oversized PR handling, manual backfill and invalid input, API failures, trusted configuration retrieval, and restricted workflow structure.
  • The pinned upstream actions/labeler action was tested against a local mock GitHub API with dummy credentials. This used a temporary copy of the action's own bundled JavaScript outside the OTIO repository; no bundled JavaScript is added by this PR. It successfully consumed the migrated YAML and preserved a concurrently added unrelated label and a concurrently removed unrelated label while adding/removing the expected managed labels. No GitHub labels were changed by these tests.
  • Live end-to-end fork verification remains a rollout check because both workflows must exist on the default branch before the handoff can operate.

Assisted-by: OpenAI Codex / GPT-6.1 Sol

@codecov-commenter

codecov-commenter commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.70%. Comparing base (f38b2cb) to head (42ce08f).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2089   +/-   ##
=======================================
  Coverage   86.70%   86.70%           
=======================================
  Files         186      186           
  Lines       13762    13762           
  Branches     1280     1280           
=======================================
  Hits        11932    11932           
  Misses       1660     1660           
  Partials      170      170           
Flag Coverage Δ
cpp-unittests 64.67% <ø> (ø)
py-unittests 83.87% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f38b2cb...42ce08f. Read the comment docs.

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

@jhodges10 jhodges10 added the ci label Oct 30, 2026
@jhodges10 jhodges10 changed the title Restore release-note labels without pull_request_target Restore PR label automation for release note grouping, safer this time Oct 31, 2026

@timlehr timlehr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this is pretty cool, thanks @jhodges10!

Separate the unprivileged PR signal from trusted default-branch labeling. Apply managed labels incrementally to preserve concurrent unrelated label edits, with validation and regression tests.

Assisted-by: OpenAI Codex / GPT-6
Signed-off-by: Jeff Hodges <jeff@jeffhq.com>
Restore the original YAML rule format using a pinned parser installed from the trusted lockfile with lifecycle scripts disabled. Preserve incremental label writes and add YAML validation coverage.

Assisted-by: OpenAI Codex / GPT-6
Signed-off-by: Jeff Hodges <jeff@jeffhq.com>
Pin the selective-label-update fix and retain the trusted workflow_run handoff. Remove custom label code, dependencies, and CI tests; download only trusted YAML to work around the pinned action configuration-path encoding bug.

Assisted-by: OpenAI Codex / GPT-6
Signed-off-by: Jeff Hodges <jeff@jeffhq.com>
Use the existing repository taxonomy for build, CMake, packaging, Python, OpenTime, color, and maintenance changes. Wire every managed label into Release Drafter and remove inactive autolabeler configuration and the obsolete release-candidate rule.

Assisted-by: OpenAI Codex
Signed-off-by: Jeff Hodges <jeff@jeffhq.com>
@timlehr
timlehr force-pushed the codex/restore-safe-pr-labeling branch from c88b142 to 42ce08f Compare November 24, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants