Skip to content

chore(ci): strip GitHub Actions env vars in backfill-release-notes#5324

Merged
avallete merged 2 commits into
developfrom
claude/debug-backfill-ci-failure-OUtxN
May 20, 2026
Merged

chore(ci): strip GitHub Actions env vars in backfill-release-notes#5324
avallete merged 2 commits into
developfrom
claude/debug-backfill-ci-failure-OUtxN

Conversation

@avallete
Copy link
Copy Markdown
Member

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:

  • Create a filtered child environment that strips GitHub Actions detection variables (GITHUB_ACTIONS, GITHUB_REF, GITHUB_REF_NAME, GITHUB_HEAD_REF, GITHUB_BASE_REF, GITHUB_EVENT_NAME, CI)
  • Pass the filtered environment to semantic-release instead of the full process environment
  • This allows env-ci to fall back to reading the branch from git HEAD in the clone, which is the correct source of truth for the backfill operation

https://claude.ai/code/session_01QQsjHNdZTJHhLWr2FYSjhe

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.
@avallete avallete requested a review from a team as a code owner May 20, 2026 16:02
@avallete avallete enabled auto-merge (squash) May 20, 2026 16:03
@avallete avallete changed the title fix(cli): strip GitHub Actions env vars in backfill-release-notes chore(ci): strip GitHub Actions env vars in backfill-release-notes May 20, 2026
@avallete avallete merged commit 848fe45 into develop May 20, 2026
8 checks passed
@avallete avallete deleted the claude/debug-backfill-ci-failure-OUtxN branch May 20, 2026 16:21
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.

3 participants