Repository navigation
fix(release): dispatch the release PR's CI on the branch pr reports, and fail when it cannot - #41
Merged
Merged
Conversation
…and fail when it cannot The dispatch step looked up the release branch with gh pr list --label release, a search query that missed the PR pr had created 0.5s earlier, then skipped the dispatch and exited 0. pr --output now writes outcome, number and branch; release.yml dispatches on created or updated and fails on any other outcome. The e2e runs the version job's steps as release.yml writes them, with a gh stub that records dispatches
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
stryker-js-effect Release run 37731706181 created release PR #236 at 05:29:09.7072Z. The next step, "Run the caller's CI on the release PR", ran at 05:29:09.719Z. It printed nothing, exited 0 and dispatched nothing, so #236 has no CI.
Cause
.github/workflows/release.yml:84-85(on0449f15b):gh pr listwith a--labelfilter goes through the search API, not the pulls list. In cli/clipkg/cmd/pr/list/http.go,shouldUseSearchreturns true whenlen(filters.Labels) > 0, and the call then goes tosearchPullRequests.236 changeset-release/main, so the PR was missing from the index at that moment, not from the repo.branchthen skipped the dispatch silently, and the step exited 0. That is a false green.Fix
github-release-management pr --output <file>appendsoutcome=created|updated|closed|vacant,number=<n>andbranch=<ref>, the same wayplan --outputdoes.branchis the branch thatprpushed or closed.release.ymlgives theprstepid: prand passes it--output "$GITHUB_OUTPUT". The dispatch step readssteps.pr.outputs.outcome/branch:createdorupdatedrunsgh workflow run "$CI_WORKFLOW" --ref "$PR_BRANCH". An empty branch aborts the step through${PR_BRANCH:?}, and a failedghcall fails the job because Actions runs bash with-e.closedorvacantprints that there is nothing to dispatch.::error::.I chose the step output over two alternatives: polling the search until it shows the PR, and making a pulls-list call with
head=. The tool already knows the branch it pushed, so a second lookup would only be a second source of truth.Test (e2e lane, real tools, real git, GitHub emulator)
e2e/harness.tsgainsworld.job(name). It runs a job'srun:steps fromrelease.ymlas written, in order:bash --noprofile --norc -eo pipefail, like Actions does;GITHUB_OUTPUTfile;${{ steps.<id>.outputs.<k> }},${{ inputs.ci-workflow }}and${{ github.token }}are resolved, and any other expression throws;nix develop --command <app>maps to the built binaries.ghis a stub on the step'sPATH. It refuses withoutGH_TOKEN(with gh's own message), recordsgh workflow run …to a log, and rejects every other subcommand. The emulator has no workflow store, so a real dispatch would return 404.prprintscreated release PR #1, and the dispatch log is exactlyworkflow run ci.yml --ref changeset-release/main;prprintsclosed release PR #1 …, the dispatch step printsno open release PR (closed); nothing to dispatch, and the log is unchanged.Failing before: I copied the new e2e files onto
origin/main0449f15b, keeping main'srelease.ymland tools.Tests 1 failed, in phase "version job opens the release PR and dispatches CI on its branch":expected [ { …(4) } ] to deeply equal []. The failing step is the dispatch step, exit 2:gh stub: only 'gh workflow run' is modelled, got: gh pr list --label release --state open --json headRefName --jq .[0].headRefName // empty. Main can't dispatch without a search lookup, and that lookup is what raced.On the branch:
Tests 1 passed (1), with all three version-job steps exiting 0 in both phases (commands.jsonl above).Why the PR's own
pull_requestruns areaction_requiredGitHub docs ("Triggering a workflow", https://docs.github.com/en/actions/how-tos/write-workflows/choose-when-workflows-run/trigger-a-workflow): events triggered by
GITHUB_TOKENcreate no workflow run. One exception: when a workflow usingGITHUB_TOKENcreates or updates a pull request, theopened/synchronize/reopenedpull_requestruns are created in an "approval-required" state, and a user with write access has to "Approve workflows to run". The changelog entry is https://github.blog/changelog/2026-06-11-bot-created-pull-requests-can-run-workflows-if-approved/. So the CI 37732606663, Nix 37732606712, Commitlint 37732606625 and Changeset Check 37732607247 runs on #236 are GitHub's gate working as documented, and they will never run without approval.workflow_dispatchis not covered by that gate ("workflow_dispatchandrepository_dispatchevents always create workflow runs"). The dispatch is how the reusable workflow gets the release PR its checks, and nothing else in it needs to change for this. Dispatched runs don't attach to the PR's checks aspull_requestevents, though: they report on the head SHA. So branch protection has to require check names that aworkflow_dispatchrun of the caller's CI produces. That is the caller's configuration, and I changed nothing there.Notes
changeset-management check origin/mainreports "no publishable package changed".apps/github-release-managementis private, and the rest is the workflow, the private e2e package and the README.pr --outputcontract.ee2a595:pnpm typecheck0, e2e and applint0,pnpm check:ci0 (72/72, then 17/17),dprint check0, e2e laneTests 1 passed (1).