chore(ci): strip GitHub Actions env vars in backfill-release-notes#5324
Merged
Conversation
semantic-release uses env-ci to detect the current branch, which reads GITHUB_REF from the GitHub Actions environment. The `noCi: true` option only bypasses the "not in CI" guard - it does not stop env-ci from resolving the branch from CI vars. When backfilling a stable tag like v2.100.1 from a workflow that runs on develop, env-ci returned "develop" even though the clone's HEAD was checked out on main, so semantic-release ran with branch=develop and bailed with "local branch develop is behind the remote one". Strip the GitHub Actions detection vars before invoking semantic-release so env-ci falls back to reading HEAD from the clone, which the script has already positioned on the correct branch for the tag.
Coly010
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix the backfill-release-notes script to correctly detect the git branch when running semantic-release in dry-run mode.
The script was passing the full process environment to semantic-release, which includes GitHub Actions detection variables (GITHUB_REF, GITHUB_ACTIONS, etc.). The semantic-release library uses env-ci to detect the current branch, and env-ci prioritizes these CI environment variables over the actual git HEAD state. This caused env-ci to report the wrong branch when backfilling from a workflow that ran on a different branch than the current clone's HEAD, leading to semantic-release errors about local branches being behind remote.
Key changes:
https://claude.ai/code/session_01QQsjHNdZTJHhLWr2FYSjhe