ci: gate audit-deps to PRs into main for lib/* workflows#847
Open
SnowboardTechie wants to merge 1 commit into
Open
ci: gate audit-deps to PRs into main for lib/* workflows#847SnowboardTechie wants to merge 1 commit into
SnowboardTechie wants to merge 1 commit into
Conversation
The lib/* CI workflows (ci-lib-ts-sdk, ci-lib-cli, ci-lib-core, ci-lib-changelog-emitter) ran the audit-deps step on every PR matching their path filters, regardless of base branch. When an advisory lives on main and can only be fixed there (e.g. brace-expansion in #842), PRs into HOLD-* batching branches failed audit with no path to action for the PR author — the fix has to land on main first, then HOLD rebases. Under the HOLD-* batching strategy, each HOLD branch eventually opens a single PR into main at the checkpoint. That PR re-runs audit, so any advisory live at merge time is gated at the actionable boundary. Auditing intermediate PRs into HOLD-* shifts noise earlier without shifting the fix earlier. Gate is base_ref == 'main' OR ref == 'refs/heads/main' so it also covers any future workflow_call invocation from a main-push context.
02b7975 to
699ddfc
Compare
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
Changes proposed
Add a step-level
if:gate to theAudit dependenciesstep in the fourlib/*CI workflows:.github/workflows/ci-lib-ts-sdk.yml.github/workflows/ci-lib-cli.yml.github/workflows/ci-lib-core.yml.github/workflows/ci-lib-changelog-emitter.ymlGate:
if: github.base_ref == 'main' || github.ref == 'refs/heads/main'.Result: audit runs for PRs targeting
main(and for any futureworkflow_callinvocation from a main-push context), and is skipped for PRs intoHOLD-*and other non-mainbases.Context for reviewers
The problem this fixes. Under the HOLD-* batching strategy, PRs into a HOLD branch can fail
audit-depsfor advisories the PR author cannot resolve — the fix lives onmainand has to land there first, then the HOLD branch rebases. Recent concrete example: PR #825 (Transforms PoC, targetsHOLD-transforms) fails on the brace-expansion advisory GHSA-jxxr-4gwj-5jf2, whose fix is part of PR #842 targetingmain. PR #825's diff has nothing to do with the advisory; the failure is pure noise to that PR's author.Why gating at the base-branch boundary is the right shape. The HOLD → main checkpoint PR re-runs full CI, including audit, so any advisory live at merge time is gated at the actionable boundary — the moment someone with a path to action (rebase + pull the fix in) is reviewing the change. Auditing intermediate PRs into HOLD-* shifts noise earlier without shifting the fix earlier.
This is the converse pattern to commit
9d72028(poetry audit →continue-on-error: truefor templates/examples). That commit kept audit running with diagnostic visibility but removed the block. This PR removes both the run and the block on non-main targets — appropriate where running the audit produces signal nobody can act on, rather than signal that's useful as a diagnostic.Why not extend to other audit-running workflows.
ci-template-quickstart.yml,ci-template-express-js.yml— JS template workflows have a similar concern; left for a separate change (also touchesengines.nodeand template-specific shape).ci-template-fast-api.yml,ci-example-california-api.yml,ci-example-pennsylvania-api.yml— already addressed viacontinue-on-error: truein9d72028.ci-catalog-validation.yml— catalog PRs targetmainby design, so the gate would be a no-op.ci-website-preview.yml— different concern (deploy preview) and different audit semantics (--level high). Left out of scope.What I verified.
if:right aboverun:, with explanatory comment).if:(GitHub auto-evaluates without${{ }}wrapping);github.base_refandgithub.refare both well-known contexts that are not user-controllable, so this is not in the GitHub Actions injection class.base_refrefmainmainrefs/pull/N/mergeHOLD-transformsHOLD-transformsrefs/pull/N/mergeworkflow_callfrom main-push eventrefs/heads/mainpush: maintriggerrefs/heads/mainOut of scope
mainitself. Today's per-package CIs arepull_request-only; the PR-into-main case still catches advisories at merge time, so a scheduled audit is a separate hardening question.ci-website-preview.yml. Same principle applies; different shapes warrant a separate look.