Skip to content

Comments

fix(release): switch to master before creating version bump PR#466

Merged
jens-maus merged 3 commits intojens-maus:masterfrom
KristjanESPERANTO:fix/release-version-bump
Feb 22, 2026
Merged

fix(release): switch to master before creating version bump PR#466
jens-maus merged 3 commits intojens-maus:masterfrom
KristjanESPERANTO:fix/release-version-bump

Conversation

@KristjanESPERANTO
Copy link
Contributor

@KristjanESPERANTO KristjanESPERANTO commented Feb 22, 2026

The 0.25.4 release was published to npm successfully, but the automated version bump PR was never created — package.json on master still says 0.25.3.

This happened because the release workflow (which I refactored in PR #463) checks out the release tag, which results in a detached HEAD. peter-evans/create-pull-request then fails with git exit code 128 because it cannot push a branch from a detached state.

Failed run: https://github.com/jens-maus/node-ical/actions/runs/22280144048

Sorry for the oversight! This PR fixes it by explicitly switching to master after the npm publish step and re-applying npm version there, so create-pull-request has a proper branch to work from.

Also includes the missing package.json bump to 0.25.4. No new release needed — the published npm package is correct, this just syncs master and prevents the issue from recurring.

Summary by CodeRabbit

  • Chores
    • Released version 0.25.4.
    • Improved release flow to reliably reapply the version bump on the default branch and automatically create a follow-up pull request (branch naming, labels, and auto-delete enabled) to streamline post-release version management and cleanup.

The release event checks out the tag (detached HEAD), which causes
peter-evans/create-pull-request to fail with git exit code 128.
Switch to master and re-apply the version bump before creating the PR.

Also bumps package.json to 0.25.4 (missed by the failed workflow).
@coderabbitai
Copy link

coderabbitai bot commented Feb 22, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

Adds a workflow step that restores intermediate changes, checks out the repository default branch, and re-applies the npm version bump without creating a git tag; updates the create-pull-request action to v8 and targets the default branch; bumps package.json 0.25.3 → 0.25.4.

Changes

Cohort / File(s) Summary
Release workflow
​.github/workflows/release.yml
Adds "Switch to default branch for version bump" step that restores intermediate package.json state, checks out the repo default branch, and runs npm version --no-git-tag-version; updates peter-evans/create-pull-request to v8, sets PR base to the repository default branch, and expands PR inputs (branch name chore/release-${version}, delete-branch: true, labels: release, and a fuller PR body).
Package metadata
package.json
Version bump from 0.25.3 to 0.25.4.

Sequence Diagram(s)

sequenceDiagram
  participant WF as Workflow
  participant Repo as Repository (checkout)
  participant NPM as npm
  participant PR as Create-Pull-Request Action

  WF->>Repo: restore intermediate files
  WF->>Repo: checkout default branch
  WF->>NPM: run `npm version --no-git-tag-version`
  NPM-->>Repo: updated package.json (no tag)
  WF->>PR: open PR targeting default branch (chore/release-${version})
  PR-->>Repo: creates PR with labels/body
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • CI Workflow Modernization #463 — also modifies .github/workflows/release.yml and updates workflow actions/runtime; likely related to CI/release workflow changes.

Poem

🐇 I nudged a bump, then hopped back to main,
Restored my files, then re-applied the gain.
A PR I stitched with labels bright and sure,
Version nudged to 0.25.4 — tidy and pure. 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main fix: switching to master before creating the version bump PR to resolve the detached HEAD issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
.github/workflows/release.yml (2)

78-81: Hard-coded master in a step named "Switch to default branch"

git checkout master will silently break if the default branch is ever renamed. The step's own name acknowledges the concept of "default branch" — use the context expression to match:

♻️ Proposed fix
-      - name: Switch to default branch for version bump
-        run: |
-          git checkout master
-          npm version "${{ steps.ver.outputs.version }}" --no-git-tag-version
+      - name: Switch to default branch for version bump
+        run: |
+          git checkout "${{ github.event.repository.default_branch }}"
+          npm version "${{ steps.ver.outputs.version }}" --no-git-tag-version

The same applies to the unchanged base: master on line 86 — worth updating to base: ${{ github.event.repository.default_branch }} in the same pass.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release.yml around lines 78 - 81, In the "Switch to
default branch for version bump" step replace the hard-coded git checkout master
with checkout of the repository default branch using the GitHub context
expression (use ${{ github.event.repository.default_branch }}), and in the later
step that still uses base: master update that value to base: ${{
github.event.repository.default_branch }} so the workflow follows the
repository's actual default branch; update the two locations (the step named
"Switch to default branch for version bump" and the action input named base)
accordingly.

83-96: Upgrade peter-evans/create-pull-request@v6 to @v8 — multiple breaking changes require attention

The latest available version is v8.1.0 (current as of January 2026). Upgrading is recommended, but be aware of breaking changes introduced between v6 and v8:

  • Input git-token renamed to branch-token (v7) — update the with: section if used
  • Environment variable PULL_REQUEST_NUMBER removed (v7) — use step output pull-request-number instead
  • Output pull-request-operation can now be none (v7) — verify any conditional logic checking this value
  • Node.js runtime upgraded from 20 to 24 — self-hosted runners must use Actions Runner ≥ 2.327.1

Review the migration path to ensure none of these affect your workflow before upgrading.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release.yml around lines 83 - 96, Update the action
reference to peter-evans/create-pull-request@v8 and adjust inputs/consumers for
breaking changes: if you pass a token input, rename input key git-token to
branch-token in the with: block (the step named "Create PR for version bump back
to default branch"); replace any references to the removed environment variable
PULL_REQUEST_NUMBER with the step output pull-request-number (use the action's
step ID) wherever consumed; update any conditional logic that checks the action
output pull-request-operation to handle the new possible value "none"; and
ensure self-hosted runners meet the Node/runner requirement (Actions Runner ≥
2.327.1) because the action now runs on Node 24.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/release.yml:
- Around line 78-81: In the "Switch to default branch for version bump" step
replace the hard-coded git checkout master with checkout of the repository
default branch using the GitHub context expression (use ${{
github.event.repository.default_branch }}), and in the later step that still
uses base: master update that value to base: ${{
github.event.repository.default_branch }} so the workflow follows the
repository's actual default branch; update the two locations (the step named
"Switch to default branch for version bump" and the action input named base)
accordingly.
- Around line 83-96: Update the action reference to
peter-evans/create-pull-request@v8 and adjust inputs/consumers for breaking
changes: if you pass a token input, rename input key git-token to branch-token
in the with: block (the step named "Create PR for version bump back to default
branch"); replace any references to the removed environment variable
PULL_REQUEST_NUMBER with the step output pull-request-number (use the action's
step ID) wherever consumed; update any conditional logic that checks the action
output pull-request-operation to handle the new possible value "none"; and
ensure self-hosted runners meet the Node/runner requirement (Actions Runner ≥
2.327.1) because the action now runs on Node 24.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/release.yml:
- Line 80: The checkout step uses an unquoted Actions expression; assign the
expression to a named env var and use that quoted env var in the shell so the
branch name is passed as a single word to git; specifically set an environment
variable like DEFAULT_BRANCH to ${{ github.event.repository.default_branch }} in
the job/step env and replace the current git checkout ${{
github.event.repository.default_branch }} invocation with git checkout
"$DEFAULT_BRANCH" (refer to the checkout command and the new DEFAULT_BRANCH env
variable).
- Around line 78-81: Uncommitted package.json/package-lock.json changes from the
earlier npm version call will block git checkout; before switching branches in
the step that runs git checkout ${{ github.event.repository.default_branch }}
and npm version "${{ steps.ver.outputs.version }}", discard those intermediate
changes (e.g., run git restore package.json package-lock.json or git checkout --
package.json package-lock.json) so the checkout succeeds, and use an env var for
the default branch name instead of inline quoting to avoid quoting issues;
update the step around the git checkout/npm version commands (referencing the
git checkout and npm version "${{ steps.ver.outputs.version }}" lines) to run
the discard command first.

@KristjanESPERANTO
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Feb 22, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@KristjanESPERANTO
Copy link
Contributor Author

That's a complex piece of stuff 🤯 I almost regret touching it 😅 But Coderabbit seems satisfied now 🙂

@jens-maus jens-maus merged commit b1654fa into jens-maus:master Feb 22, 2026
17 checks passed
@KristjanESPERANTO KristjanESPERANTO deleted the fix/release-version-bump branch February 22, 2026 18:56
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