Skip to content

fix(ci): normalize release target_commitish for bump-back PR base#1616

Merged
leecalcote merged 1 commit into
masterfrom
claude/fix-release-base-ref
Jun 5, 2026
Merged

fix(ci): normalize release target_commitish for bump-back PR base#1616
leecalcote merged 1 commit into
masterfrom
claude/fix-release-base-ref

Conversation

@leecalcote
Copy link
Copy Markdown
Member

Problem

When v0.21.19 was released, the Publish Node.js Package workflow's "Open PR with package.json version bump" step failed with:

fatal: refusing to fetch into branch 'refs/heads/master' checked out at '/home/runner/work/sistent/sistent'
##[error]The process '/usr/bin/git' failed with exit code 128

The step is continue-on-error: true, so the publish itself still succeeded — but the version-bump-back PR was never opened and master's package.json drifted from the version published to npm (it had to be opened manually as #1610).

Root cause

The step passed github.event.release.target_commitish straight into peter-evans/create-pull-request as base. That value can be either a bare branch name (master) or a fully-qualified ref (refs/heads/master), depending on how the release was created. create-pull-request's base must be a short branch name; given a full ref it tries to fetch into the currently checked-out branch, which git refuses (exit 128).

Fix

Resolve the target branch once in a new Resolve target branch step, stripping any refs/heads/ prefix, and reuse the normalized value for both the checkout ref and the bump-back PR base.

- name: "Resolve target branch"
  id: target_branch
  env:
    TARGET: ${{ github.event.release.target_commitish || 'master' }}
  run: echo "name=${TARGET#refs/heads/}" >> "$GITHUB_OUTPUT"

Testing

  • python3 -c "import yaml; yaml.safe_load(...)" — workflow parses.
  • The shell normalization is a standard ${VAR#prefix} strip: refs/heads/mastermaster, and a bare master is unchanged.
  • End-to-end validation occurs on the next published release (the bump-back PR should open automatically instead of erroring).

The Publish workflow's version-bump-back step passed the release's
target_commitish straight into peter-evans/create-pull-request as `base`.
When a release carries a fully-qualified target (refs/heads/master) rather
than a bare branch name, the action tries to fetch into the currently
checked-out branch and fails with 'refusing to fetch into branch ...
checked out' (git exit 128), so the bump-back PR is never opened and master
drifts from the published npm version.

Resolve the target branch once, stripping any refs/heads/ prefix, and reuse
it for both the checkout ref and the PR base.

Signed-off-by: Lee Calcote <leecalcote@gmail.com>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@github-actions github-actions Bot added the area/ci Continuous integration | Build and release label Jun 5, 2026
@leecalcote leecalcote merged commit 5e4629c into master Jun 5, 2026
5 checks passed
@leecalcote leecalcote deleted the claude/fix-release-base-ref branch June 5, 2026 01:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ci Continuous integration | Build and release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant