Skip to content

fix(ci): correct DIST_BRANCH on release events for stream-dist deploy#1894

Merged
PatelUtkarsh merged 1 commit into
developfrom
fix/stream-dist-release-trigger
May 28, 2026
Merged

fix(ci): correct DIST_BRANCH on release events for stream-dist deploy#1894
PatelUtkarsh merged 1 commit into
developfrom
fix/stream-dist-release-trigger

Conversation

@PatelUtkarsh
Copy link
Copy Markdown
Member

Fixes the stream-dist deploy workflow failing on release events with:

error: src refspec refs/tags/v4.2.0 matches more than one
error: failed to push some refs to 'github.com:xwp/stream-dist.git'

Root cause

On a release event, GITHUB_REF is refs/tags/<tag>. The previous setup step did:

DIST_BRANCH="${GITHUB_REF#refs/heads/}"   # strip prefix that isn't there
DIST_TAG="${GITHUB_REF#refs/tags/}"

The refs/heads/ prefix strip is a no-op for tag refs, so DIST_BRANCH ended up as the literal string refs/tags/v4.2.0. The later git checkout -B "$DIST_BRANCH" then created a branch literally named refs/tags/v4.2.0 alongside the new tag of the same short name, making git push --tags origin refs/tags/v4.2.0 ambiguous (matched both the branch and the tag).

Fix

Branch on github.event_name to derive DIST_BRANCH correctly:

  • On release events: pull the branch from github.event.release.target_commitish (typically master) and the tag from the ref.
  • On push events: keep the previous behaviour, derive the branch from refs/heads/ and skip tagging.

Also tighten the release push to explicitly push just the target branch and the new tag instead of relying on --tags, which would push every local tag the runner happens to have.

Why this is a new failure

The release: trigger on this workflow was re-added in #1853 (2026-04-02). v4.2.0-rc.1 was the first release event to actually exercise this code path. The bug itself dates back to the September 2024 workflow rewrite and was dormant until then.

Verified failure runs

Follow-up

The v4.2.0 tag on xwp/stream-dist is missing as a result of this failure and will need to be created manually (the dist branch itself was updated successfully by the prior push-to-master run, so only the tag is missing).

Checklist

  • Project documentation has been updated to reflect the changes in this pull request, if applicable. (N/A: workflow-only fix.)
  • I have tested the changes in the local development environment (see contributing.md). (N/A: cannot exercise release-event workflow locally; will validate on next release.)
  • I have added phpunit tests. (N/A: workflow change.)

On a release event, GITHUB_REF is refs/tags/<tag>, so the previous
${GITHUB_REF#refs/heads/} stripping left DIST_BRANCH equal to the literal
'refs/tags/<tag>'. The downstream 'git checkout -B "$DIST_BRANCH"' then
created a branch literally named 'refs/tags/<tag>' alongside the new tag
of the same short name, making 'git push --tags origin refs/tags/<tag>'
ambiguous:

    error: src refspec refs/tags/<tag> matches more than one

Resolve by branching on github.event_name: derive DIST_BRANCH from the
release's target_commitish (typically master) on release events, and from
refs/heads/ on push events. Also tighten the release push to explicitly
push just the target branch and the new tag instead of relying on
--tags, which would push every local tag.

This bug was latent from the September 2024 workflow rewrite and only
became observable after PR #1853 re-added the release trigger, since
v4.2.0-rc.1 was the first release event to exercise this code path.

Verified failure on:
- runs/26573649458 (v4.2.0)
- runs/26493589602 (v4.2.0-rc.1)
@PatelUtkarsh PatelUtkarsh merged commit 7053447 into develop May 28, 2026
3 checks passed
@PatelUtkarsh PatelUtkarsh deleted the fix/stream-dist-release-trigger branch May 28, 2026 12:31
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