Skip to content

fix(hook): allow github-actions bot to commit on main for lockstep bumps#73

Merged
vivek7405 merged 1 commit into
mainfrom
fix/hook-allow-github-actions-bot
May 22, 2026
Merged

fix(hook): allow github-actions bot to commit on main for lockstep bumps#73
vivek7405 merged 1 commit into
mainfrom
fix/hook-allow-github-actions-bot

Conversation

@vivek7405
Copy link
Copy Markdown
Collaborator

Summary

The release workflow's "Lockstep-bump wrappers" step (added in #72) commits the create-webjs + webjsdev version bumps directly to main as github-actions[bot]. The pre-commit hook's gate 1 (block commits to main) fires on those bot commits and fails the workflow.

Add an early short-circuit at the top of the hook. When $GITHUB_ACTIONS=true, skip every gate. The bot's commit is a mechanical version-field write to two package.json files; there is nothing to validate.

Human commits still hit every gate as designed.

Caught by

Failed workflow run 26293696071. cli@0.8.5 published cleanly, but the lockstep step errored on git commit -m ... with "Cannot commit directly to 'main'".

Recovery plan after merge

  1. Merge this PR. The merge push triggers nothing because no changelog files are touched, so release.yml stays idle.
  2. Re-run the failed release workflow run 26293696071 via gh run rerun 26293696071. The earlier "Publish to npm" / "Publish to GitHub Packages" / "Create GitHub Releases" steps are idempotent and will skip already-published cli@0.8.5. The Lockstep-bump step will now succeed, bump create-webjs + webjsdev to 0.8.5, commit + push, and publish both to npm.

Test plan

  • npm test passes (1151/1151)
  • No invariant-11 punctuation violations

The release workflow's "Lockstep-bump wrappers" step commits the
create-webjs + webjsdev version bumps directly to main as
github-actions[bot]. The pre-commit hook's gate 1 (block commits
to main) was firing on those bot commits, failing the workflow
and leaving the wrappers un-bumped after a cli release.

Add an early short-circuit at the top of the hook: when
$GITHUB_ACTIONS=true (set automatically by every GitHub Actions
runner), skip every gate and exit 0. The bot's commit is a
mechanical version-field write to two package.json files; there's
nothing to validate.

Human commits hit every gate as designed. The exception applies
only to environments where Actions is genuinely running.

Caught by the failed workflow on the merge of #72 (run
26293696071): cli@0.8.5 published cleanly, but the lockstep
wrappers step errored on `git commit -m ...` with "Cannot commit
directly to 'main'". After this fix lands and the failed run is
re-run, the lockstep step will succeed and publish create-webjs
+ webjsdev at 0.8.5.
@vivek7405 vivek7405 merged commit f89af07 into main May 22, 2026
@vivek7405 vivek7405 deleted the fix/hook-allow-github-actions-bot branch May 22, 2026 14:38
vivek7405 added a commit that referenced this pull request May 22, 2026
…#74)

* fix(hook): skip wrapper packages in the changelog-file requirement

create-webjs and webjsdev are version-lockstep mirrors of
@webjsdev/cli and are explicitly NOT tracked in the framework's
changelog system. Bumping their package.json version is intentional
(driven by the release workflow's lockstep step, or rarely by a
manual recovery commit) and does NOT need a matching
changelog/<pkg>/<version>.md file.

The hook previously detected ANY packages/*/package.json version
bump and demanded a changelog file. For wrappers it would then run
scripts/backfill-changelog.js, which doesn't list them in PACKAGES,
so no file was generated, and the hook errored "expected file but
generator didn't produce it".

Add a name-check in the TO_GENERATE loop: skip create-webjs and
webjsdev entirely. The framework-package bump-detection logic for
core / server / cli / ts-plugin / ui is unchanged.

This also un-blocks manual lockstep recoveries (like the
0.8.5 wrapper bumps that follow this commit) on a feature branch
without --no-verify.

* chore(release): manual lockstep bump create-webjs + webjsdev to 0.8.5

One-time manual sync. The automated lockstep step (added in #72)
failed on the cli@0.8.5 release workflow run because the pre-commit
hook blocked the bot's commit on main. PR #73 fixed the hook for
new workflow runs, but `gh run rerun` replays the workflow at the
original commit's SHA (which still has the un-fixed hook), so the
re-run failed the same way.

Easiest recovery: bump the wrapper package.json files manually in
this commit, then publish the new versions out-of-band. Future cli
bumps will trigger the workflow against the latest main (which now
includes both the GITHUB_ACTIONS short-circuit AND the
wrapper-skip in the changelog-file check), so the lockstep step
will succeed automatically.

No changelog files are touched here, so this push to main does not
re-trigger release.yml.

After merge, publish manually:
  cd packages/create-webjs && npm publish
  cd ../webjsdev && npm publish
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.

1 participant