mirror of
https://github.com/headroomlabs-ai/headroom.git
synced 2026-11-22 13:29:19 +08:00
## Description Every third-party action in `.github/` ran from a version tag like `actions/checkout@v7`. A tag can be moved to other code at any time. That is how `tj-actions/changed-files` leaked CI secrets from ~23,000 repos in March 2025. Here a moved tag would run with the release job's PyPI OIDC token (`id-token: write`) and the Docker job's `packages: write` token. Pinning to a commit SHA closes that, and a new test keeps it closed. Closes # ## Type of Change - [ ] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [ ] Performance improvement - [x] Code refactoring (no functional changes) ## Changes Made - All 195 third-party `uses:` refs in 25 files now name the commit their tag points to today, with the version as a comment: `actions/checkout@3d3c42e5... # v7.0.1`. No action version changes. - Dependabot's existing `github-actions` config updates SHA pins and their version comments, so the pins stay current. - Pin dtolnay/rust-toolchain stable and 1.95.0 branches to their existing commit heads. The stable action retains its runtime toolchain input/default; the 1.95.0 action embeds toolchain: 1.95.0. This preserves each call site's existing toolchain selection. - New `test_every_action_is_pinned_to_a_commit_sha` in `scripts/tests/test_ci_workflow.py` fails on any tag-pinned action and lists each one. - Three tests in `tests/test_release_workflows.py` matched the old tag text (`setup-buildx-action@v4`, `gh-action-pypi-publish@vX.Y.Z`, `release-please-action@v4/v5`). They now match the SHA pin and its version comment. ## Testing - [x] Unit tests pass (`pytest`) - [x] Linting passes (`ruff check .`) - [ ] Type checking passes (`mypy headroom`) - [x] New tests added for new functionality - [x] Manual testing performed ### Test Output ```text $ uv run --frozen --extra dev pytest -q scripts/tests/test_ci_workflow.py scripts/tests/test_pr_health_workflow.py scripts/tests/test_normalize_release_pr_bodies.py tests/test_release_workflows.py 87 passed in 0.87s $ uv run --frozen --extra dev pytest -q scripts/tests/test_pr_health_labels.py scripts/tests/test_version_sync.py tests/test_cli/test_wrap_copilot.py tests/test_learn/test_subagent_scanning.py tests/test_plugin_manifests.py tests/test_pr208_changes.py 114 passed in 1.32s $ uvx ruff check scripts/tests/test_ci_workflow.py tests/test_release_workflows.py && uvx ruff format --check <same> All checks passed! ``` ## Real Behavior Proof - Environment: macOS, Python 3.12 via `uv run --frozen --extra dev`, branch cut from `main` atc01cf07d. - Exact command / steps: resolved each tag with `git ls-remote --tags --heads https://github.com/<owner>/<repo>` (peeled for annotated tags), rewrote only the `uses:` lines, then ran the test files above and a `yaml.safe_load` over every file in `.github/`. - Observed result: 195 lines changed, 195 removed, no other line touched (mixed LF/CRLF in `pr-health.yml` kept). All 201 tests pass. On `main` the new test fails and lists the unpinned refs. - Not tested: `scripts/validate-workflows.sh` (actionlint plus act dry runs) was not run locally. The `workflow-validation` job runs it on this PR. ## Runtime Rollout Safety - Rollout-managed feature(s): None. CI workflow files and their tests only. - Minimum rollout channel: N/A, no runtime code changes. - Stable/default behavior changed: No. Each SHA is the commit its tag points to today. - Kill switch / disable path: N/A, revert the commit. - Unsafe override required: No. - Qualification impact: None. - Rollback path: Revert this PR. ## Review Readiness - [x] I have performed a self-review - [x] This PR is ready for human review ## Checklist - [x] My code follows the project's style guidelines - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] I did **not** edit `CHANGELOG.md` — it is generated by release-please from my Conventional Commit PR title (a CI guard enforces this) ## Screenshots (if applicable) N/A, no UI change. ## Additional Notes - mypy and docs are N/A: no `headroom/` code or documented behavior changes. - Dependabot does not bump branch pins, so the two `dtolnay/rust-toolchain` pins stay on today's branch head until someone moves them. That action rarely changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/4671" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4" alt="Devin Review"></picture></a> <!-- devin-review-badge-end --> ### Maintainer current-main requalification Exact head `57b7edd8d05b6dc5e3bc4eac1dff55f21519afe8`, upstream main `c01cf07d943d816cfd9d97e6838ed4e38f1ff9a4`. Reviewed the27-file delta and existing discussion/Devin no-issues result against current upstream mainc01cf07d94, already included in the contributor head. Independent full-workflow comparison proves only uses refs/comments change across the25 workflow/action files. All195 replaced refs resolve exactly to their original upstream tag/branch commits (29 unique pins across26 repositories), with annotated tags peeled; no mismatches. Pinned dtolnay action source independently confirms stable runtime default versus embedded1.95.0 branch behavior, preserving toolchain selection.87 workflow/release tests and113 adjacent tests pass,1skip; changed Python lint/format passes. Maintainer fix only removes CRLF endings on two edited pr-health lines to clear whitespace; provenance reverified afterward. No contributor workflow logic altered. Description is corrected to explain embedded1.95.0 semantics. No publish/release workflow execution claimed; full hosted qualification must run on this new mechanical-fix head. Maintainers handle CI. Nothing merged. Exact-head hosted checks are being handled by maintainers. No new finding in the reviewed scope; formal approval awaits exact-head hosted qualification; nothing merged. --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: JerrettDavis <mxjerrett@gmail.com>
83 lines
3.9 KiB
YAML
83 lines
3.9 KiB
YAML
name: Release Please
|
|
|
|
# What this does
|
|
# ----------------
|
|
# release-please watches `main` for conventional-commit traffic and
|
|
# maintains a single "Release vX.Y.Z" PR that aggregates everything
|
|
# released since the last tag. Merging that PR is what triggers an
|
|
# actual PyPI / npm / GitHub-Release publish (via release.yml, which
|
|
# fires on the published-release event the bot emits at merge time).
|
|
#
|
|
# This replaces the prior "every push to main is a release" pattern
|
|
# that burned PyPI's per-project storage quota by uploading a fresh
|
|
# wheel matrix (~200 MB) for each merged `fix:` / `feat:` PR.
|
|
#
|
|
# Day-to-day:
|
|
# - Merge a `fix:` PR into main -> bot updates the release PR
|
|
# - Merge a `feat:` PR into main -> bot bumps minor in release PR
|
|
# - Merge `ci:` / `docs:` / `chore:` -> no PR change (hidden)
|
|
# - Ready to ship -> merge the release PR
|
|
# (bot tags + emits release event;
|
|
# release.yml does the actual builds + publishes)
|
|
#
|
|
# Config lives in `.release-please-config.json`; current versions
|
|
# tracked in `.release-please-manifest.json`.
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
concurrency:
|
|
# Serialize bot runs on main so two pushes don't race the
|
|
# release-PR update. We never cancel mid-flight — losing a manifest
|
|
# write would mean the next push computes the wrong base version.
|
|
group: release-please-${{ github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
release-please:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# Prefer a short-lived, repo-scoped GitHub App installation token. A
|
|
# personal PAT carries the maintainer's whole account — with a classic
|
|
# `repo` scope that reaches every other repository they can access — and
|
|
# this credential can tag past branch protection and reaches PyPI, npm and
|
|
# GHCR through the `release: published` publishes. An installation token is
|
|
# scoped to this repository and expires in an hour. Gated on the repo
|
|
# variable so an unconfigured app falls through instead of blocking a
|
|
# release. See #2955.
|
|
- name: Mint installation token
|
|
id: app-token
|
|
if: ${{ vars.RELEASE_APP_ID != '' }}
|
|
continue-on-error: true
|
|
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
|
|
with:
|
|
app-id: ${{ vars.RELEASE_APP_ID }}
|
|
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
|
|
|
|
# A Windows body edit can introduce CRCRLF. release-please strips one CR,
|
|
# then cannot find its exact `---` delimiters and silently skips release
|
|
# creation. Repair only merged, pending release PR envelopes before the
|
|
# action reads them; do not infer versions or rewrite generated notes.
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
- name: Normalize pending release PR body line endings
|
|
env:
|
|
GH_TOKEN: ${{ steps.app-token.outputs.token || secrets.RELEASE_PLEASE_TOKEN || secrets.GITHUB_TOKEN }}
|
|
run: python scripts/normalize_release_pr_bodies.py --repo "${{ github.repository }}" --apply
|
|
|
|
- uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
|
|
with:
|
|
# Neither an app token nor a PAT is GITHUB_TOKEN, and that matters: a
|
|
# release/tag created by GITHUB_TOKEN does NOT emit events that trigger
|
|
# other workflows, so release.yml (PyPI/npm) and docker.yml — which fire
|
|
# on `release: published` — never ran, and releases had to be cut by
|
|
# hand. Falls back to GITHUB_TOKEN when nothing else is set (the release
|
|
# PR still opens; it just won't trigger the downstream publishes).
|
|
token: ${{ steps.app-token.outputs.token || secrets.RELEASE_PLEASE_TOKEN || secrets.GITHUB_TOKEN }}
|
|
config-file: .release-please-config.json
|
|
manifest-file: .release-please-manifest.json
|