ci: gate PR jobs with trunk-io/dynamic-ci - #1170
Merged
Merged
Conversation
|
😎 Stack merged successfully - details. |
TylerJang27
force-pushed
the
tyler/dynamic-ci
branch
from
August 27, 2026 15:37
014c110 to
acd96a3
Compare
|
|
TylerJang27
force-pushed
the
tyler/dynamic-ci
branch
from
August 27, 2026 16:23
cbd9918 to
f8eb175
Compare
Adds the Dynamic CI Filter in pre-job mode to the four PR workflows (pull_request, pyo3, ruby, wasm): one upstream job asks Trunk for a per-job verdict and every downstream job gates on its output. Gating is scoped to pull_request explicitly -- every gate leads with `github.event_name != 'pull_request' ||`, so push (main), tags and workflow_dispatch run everything outright rather than relying on the skipped filter job's empty outputs. Unlike trunk2, TRUNK_PUBLIC_API_ADDRESS is left unset so the action talks to prod (api.trunk.io) with TRUNK_PROD_ORG_API_TOKEN -- this repo's merge queue and CI history are in prod, not staging.
TylerJang27
force-pushed
the
tyler/dynamic-ci
branch
from
August 27, 2026 16:27
f8eb175 to
7ef04cf
Compare
acatxnamedvirtue
approved these changes
Aug 27, 2026
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.
Adds
trunk-io/dynamic-ci(the Dynamic CI Filter) to the four PR workflows, in the pre-job mode trunk2 uses: one upstreamdynamic-ci-filterjob asks Trunk for a per-job verdict, and every downstream job gates on its output.Difference from trunk2:
TRUNK_PUBLIC_API_ADDRESSis deliberately not overridden, so the action hits prod (api.trunk.io) withsecrets.TRUNK_PROD_ORG_API_TOKEN. This repo's merge queue and CI history live in prod, not staging.pull_request.ymlbuild_release,test,trunk_check_runner,build_pyo3,build_wasmgate(must always report)pyo3.ymllinux,linux-pytest,macos,sdistget-date-sha,publish-annotation(non-PR only),gateruby.ymlbuild,build-ruby-gem,test-ruby-gem-uploadsgatewasm.ymlbuildgaterelease_cli.ymlis untouched — itspull_requesttrigger is alreadypaths-scoped.Nothing changes outside pull requests
Every gate leads with an explicit event escape, so push-to-
main, tags andworkflow_dispatchrun everything outright:The escape is redundant with fail-open (a skipped filter job exports empty outputs, and
'' != 'false'already runs everything) but is written out so main's behavior can't depend on that side effect — and so widening the filter job topushlater can't start skipping jobs on main.Stacked on #1173
Based on #1173, which adds the fan-in
gatejob each workflow needs before any of this is mergeable. Without it, a matrix job skipped at job level reports one check under the unexpanded name and the 12 required per-leg contexts hang on "Expected" forever. Read that PR first; merge order is #1173 -> ruleset context swap -> this.The
gatejobs are deliberately not gated by Dynamic CI and are not in the filter'soutputs:block. A gate that could be skipped could not report, which defeats its whole purpose.Wiring notes
!= 'false', never== 'true'. A missing verdict — outage, unseen job, unresolved key — emits no output, and'' != 'false'runs the job.!cancelled()on every gate so the skipped filter job doesn't auto-skip its dependents.!cancelled()replaced a plainneeds, an explicitneeds.<upstream>.result == 'success'keeps the behavior that a failed upstream skips its consumers:test→build_release,linux-pytest→linux,linux/macos/sdist→get-date-sha,test-ruby-gem-uploads→build-ruby-gem.build_releasealso runs whentestis wanted,linuxwhenlinux-pytestis wanted,build-ruby-gemwhentest-ruby-gem-uploadsis wanted — otherwisedownload-artifactwould have nothing to fetch.trunk-merge/branches to run-everything. That covers draft merge-queue PRs, which arrive aspull_requestevents.actions/checkoutin the filter job (trunk2 has one): the action reads only runner env vars and the event payload; the service derives the diff frombaseSha/commitShavia the GitHub App.@v1, matching this repo's convention. The action's README suggests an immutable tag (v0.1.0) if we want it held still during beta.Trade-off to weigh
Fewer dogfood uploads.
pull_request.yml'stest, all ofruby.yml, andpyo3.yml'slinux-pytestexist partly to push real results into Trunk (EWhNPVic,2tYJWMu7,T5yKSn9h,z2dzjLHm,4B2wfoEU,6E6WINjl,68IdP3pq). A skipped job uploads nothing, so PR-side dogfood data thins out on changes the engine judges unrelated.Verification so far
trunk checkclean on all four workflows (actionlint, prettier, yamllint, checkov, shellcheck, shfmt). actionlint validates eachneeds.dynamic-ci-filter.outputs.<key>against the filter's declaredoutputs:, so the re-export wiring is checked mechanically.acd96a3b(which touched the workflows)linux×2,macos×2 andsdistall ran; on the empty commit729bf24bevery gated job across all four workflows skipped, and all four runs still concludedsuccess.