ci(npm-publish): group event guards so manual publish is not skipped - #5226
Draft
eliseo-juan wants to merge 1 commit into
Draft
ci(npm-publish): group event guards so manual publish is not skipped#5226eliseo-juan wants to merge 1 commit into
eliseo-juan wants to merge 1 commit into
Conversation
`&&` binds tighter than `||` in GitHub Actions expressions, so the flat condition parsed as: (contains(release.tag_name, 'react-v') && … && event_name == 'workflow_dispatch') || event_name == 'release' || (workflow_run.conclusion == 'success' && workflow_run.outputs.new_version) On a workflow_dispatch `github.event.release` is null, so the tag check fails and the first group is false while the other two branches cannot match either — every manual run of this workflow was skipped, leaving no escape hatch when the release-triggered publish fails. Parenthesise the per-event branches and give each one its own tag filter: dispatch now matches on the `release_tag` input it already checks out, and a release event only starts the job for the package it belongs to instead of starting all three and letting two no-op. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
🔍 Review policy: Code changeDefault rule: any other change needs one approval from f0-devs (rule 4). Required approvals
How this was decided
Policy source: |
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.
Description
Manual runs of Publish packages were always skipped, so when the release-triggered publish broke there was no way to retry it by hand. Discovered while investigating why
@factorialco/f0-reacthas been stuck on 6.38.1 on npm since 19 Aug while releases kept being cut up to 6.51.1.&&binds tighter than||in GitHub Actions expressions, so the flat condition on each job parsed as:On a
workflow_dispatchthere is nogithub.event.release, socontains(null, 'react-v')is false and the whole first group collapses. The second branch needsevent_name == 'release'and the third needs aworkflow_runpayload, so neither can match a dispatch either → all three jobs skip. Example: run 32831792413, 3/3 jobsskippedin 2s. Therelease_taginput the checkout step already reads was never reachable.Type of change
Implementation details
Parenthesised the per-event branches into one group ANDed with the shared guards, and gave each branch its own tag filter:
release— filters ongithub.event.release.tag_name, as before. New: this now actually filters. Previouslyevent_name == 'release'alone satisfied the condition, so every release started all three jobs and two of them no-op'd with a misleading green tick (published=false, Slack step skipped). Only the job for the released package starts now.workflow_dispatch— filters on therelease_taginput, consistent with whatactions/checkoutalready resolves. This is the path that was dead.workflow_run— unchanged logic, now explicitly gated onevent_nametoo.The tag filters discriminate cleanly, so no dispatch can fan out to the wrong package:
react-vreact-native-vcore-vf0-react-v6.51.1f0-react-native-v0.59.0f0-core-v2.1.0Replaced the two stale comments with one line recording the precedence trap, since that is the part a future edit could silently undo.
Not addressed here (flagging for the owning team)
Two pre-existing issues found while tracing this, left out to keep the diff to the reported bug:
github.event.workflow_run.outputsdoes not exist. Theworkflow_runpayload does not carry a called workflow's outputs, so that branch can never be true — which is why every push tomainleaves a skipped Publish packages run behind. The pipeline runs entirely off thereleasetrigger. Given release-please authenticates withRELEASE_PLEASE_GH_TOKEN(a PAT, notGITHUB_TOKEN), release events do fire and theworkflow_runtrigger the comment inon:justifies looks redundant. Worth deleting, but that changes release behaviour and did not belong in a hotfix.github.head_refandgithub.event.pull_request.labelsare always empty here. This workflow has nopull_requesttrigger, so both release-please guards are inert. Kept them rather than widen the blast radius.Verification
npm-publish.yamlparses as valid YAML; all threeifexpressions render as intended.main. Worth a manual dispatch withrelease_tag: f0-react-v6.51.1after merge to confirm the path is live.Context
The npm side of the incident is separate and not fixed by this PR: the publish itself was failing with
npm error code E404 … PUT https://registry.npmjs.org/@factorialco%2ff0-react, which is npm's response to a token without write access to the scoped package.NPMJS_TOKENwas rotated on 25 Aug 09:10 UTC and the v6.51.1 release run has been re-run to pick it up.🤖 Generated with Claude Code