Skip to content

npm-publish: also publish for manual ci dispatches on main#7886

Merged
jkschneider merged 1 commit into
mainfrom
npm-publish-allow-manual-dispatch
Jun 3, 2026
Merged

npm-publish: also publish for manual ci dispatches on main#7886
jkschneider merged 1 commit into
mainfrom
npm-publish-allow-manual-dispatch

Conversation

@knutwannheden

Copy link
Copy Markdown
Contributor

Problem

npm-publish only proceeds for push-triggered ci runs on main:

github.event.workflow_run.name == 'ci' &&
github.event.workflow_run.event == 'push' &&
github.event.workflow_run.head_branch == 'main'

So a green ci started via workflow_dispatch on main triggers npm-publish (the workflow_run fires) but the job is skipped.

That matters because of how the parser is resolved downstream. The rewrite-javascript jar bundles rewrite-javascript-version.txt = 8.84.0-<git-commit-timestamp>, and consumers launch the parser via npx --package=@openrewrite/rewrite@<that-version> rewrite-rpc. The npm package is published with the same commit-timestamp version. So a commit whose only green ci came from a manual dispatch (e.g. after re-running a flaky build to green) never gets its parser published to npm — and any consumer resolving that commit's Maven snapshot then fails with RPC process shut down early with exit code 1 (the npx 404).

Change

Allow workflow_dispatch-triggered ci runs on main to publish, in addition to push:

github.event.workflow_run.name == 'ci' &&
(github.event.workflow_run.event == 'push' ||
 github.event.workflow_run.event == 'workflow_dispatch') &&
github.event.workflow_run.head_branch == 'main'

The conclusion == 'success' and head_branch == 'main' guards are unchanged, so PRs and non-main dispatches remain excluded, and a red ci still won't publish. The existing "version already published → skip" guard makes re-dispatching a no-op.

Notes

  • workflow_run workflows execute the default-branch copy of the YAML, so this takes effect once merged to main (it won't retroactively publish already-skipped runs).
  • This is the minimal first step; it does not address the separate case where an unrelated failing test elsewhere in ci skips the JS publish even though the JS build is green.

The npm-publish job only proceeded for `push`-triggered `ci` runs, so a green
`ci` started via `workflow_dispatch` on main was skipped. The parser is launched
downstream via `npx --package=@openrewrite/rewrite@<version>`, where `<version>`
is the commit-timestamp baked into the `rewrite-javascript` jar's
`rewrite-javascript-version.txt`. A commit whose only green `ci` came from a
manual dispatch therefore never publishes its parser to npm, leaving consumers'
Maven snapshots pointing at a version that 404s ("RPC process shut down early").

Allow `workflow_dispatch`-triggered `ci` runs on main to publish too. The
`conclusion == 'success'` and `head_branch == 'main'` guards still apply, so PRs
and non-main dispatches remain excluded.
@github-project-automation github-project-automation Bot moved this from In Progress to Ready to Review in OpenRewrite Jun 3, 2026
@jkschneider
jkschneider merged commit 5311049 into main Jun 3, 2026
1 check passed
@jkschneider
jkschneider deleted the npm-publish-allow-manual-dispatch branch June 3, 2026 18:57
@github-project-automation github-project-automation Bot moved this from Ready to Review to Done in OpenRewrite Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants