Skip to content

ci: Fix the publish loop guard and push before publishing - #11

Merged
howaskew merged 2 commits into
mainfrom
ci/fix-publish-workflow
Oct 20, 2026
Merged

howaskew merged 2 commits into
mainfrom
ci/fix-publish-workflow

Conversation

@howaskew

Copy link
Copy Markdown
Contributor

Summary

Fixes the publish loop guard, makes the publish safe to rerun, moves publishing to Node 18, and brings package.json back in line with npm.

Changes

Publish workflow (publish-to-npm.yaml)

  • Loop guard. The if: checked for hello@openactive.io, but the bot has committed as 207210293+openactive[bot] since May 2025, so a successful push of the version bump would start another publish. The job now skips runs started by openactive[bot], and the version bump commit message carries a skip-CI marker, so the guard does not depend on an email address.
  • Push before publishing. The version bump is pushed to main before npm publish. If the push is rejected, the job stops and nothing is published, so npm cannot get ahead of GitHub.
  • Node 18.17.1 instead of Node 14 for the publish job. npm ci and npm test pass locally on 18.17.1 (28 passing).
  • Publishes with a repository-level npm token.
  • One publish runs at a time; permissions reduced to contents: read; actions/setup-node v4.

Version

  • package.json and package-lock.json set to 1.0.4, which has been on npm since April 2023 but whose version bump never reached main. Without this, every release would try to publish 1.0.4 again and npm would reject it.

Verification

  • actionlint: no issues.
  • A simulated version bump produces the commit message 1.0.5 with the skip-CI marker, authored by openactive[bot], changing only package.json and package-lock.json.

When merged

Merging starts a publish: tests, bump to 1.0.5, push, publish. 1.0.5 contains the same code as 1.0.4 plus the CI changes merged since 2023. If the push to main is rejected, the run stops before publishing and nothing changes.

When squash-merging, check the suggested commit message does not contain a skip-CI marker, or no workflows will run.

Note: the required test (10.x), test (12.x) and test (14.x) checks have not run for some time; if Node 10 or 12 no longer installs on current runners, the test matrix will need updating before this can merge.

howaskew and others added 2 commits October 19, 2026 15:15
- Loop guard: skip runs started by openactive[bot] and add a skip-CI marker to
  the version bump commit. The previous guard checked for
  hello@openactive.io, but the bot has committed as
  207210293+openactive[bot] since May 2025, so every bump commit
  would start another publish.
- Push the version bump before publishing, so a rejected push stops the
  run before anything reaches npm.
- Publish on Node 18.17.1 instead of Node 14 (tests pass locally on 18).
- Publish with NPM_TOKEN2, a repo-level token to be added (the org
  NPM_TOKEN is rejected by npm).
- Run one publish at a time, and update actions to current versions.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1.0.4 is already published on npm, but the version bump commit never
reached GitHub because the push after publishing failed. Without this,
the next release would try to publish 1.0.4 again and npm would reject it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@howaskew
howaskew marked this pull request as ready for review October 19, 2026 15:32
@howaskew
howaskew requested a review from hkir-dev October 19, 2026 15:32
@howaskew
howaskew merged commit cb1ba8d into main Oct 20, 2026
3 checks passed
@howaskew
howaskew deleted the ci/fix-publish-workflow branch October 20, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants