Skip to content

Dispatch push_gem against the tag ref, not main - #2703

Merged
joelhawksley merged 1 commit into
mainfrom
joelhawksley-redesigned-sniffle
Aug 24, 2026
Merged

Dispatch push_gem against the tag ref, not main#2703
joelhawksley merged 1 commit into
mainfrom
joelhawksley-redesigned-sniffle

Conversation

@joelhawksley

Copy link
Copy Markdown
Member

Follow-up to #2702. The workflow_dispatch --ref main I added was rejected by the release environment:

Branch "main" is not allowed to deploy to release due to environment protection rules.
The deployment was rejected or didn't satisfy other protection rules.

Root cause

The release environment restricts deployments to v* tag refs. Dispatching from main was never going to satisfy that rule.

Fix

Dispatch push_gem.yml with --ref "$tag" instead of --ref main. That way the deployment runs against the tag itself, which the environment allows. As a nice consequence, github.ref in push_gem.yml now already points at the tag, so the tag input and ref override are no longer needed — dropped both to simplify the workflow.

Caveat for v4.14.0 recovery

workflow_dispatch requires the trigger to exist on the target ref. The v4.14.0 tag was created before we added workflow_dispatch to push_gem.yml, so it does not carry the trigger. Once this PR is merged you have two options to ship the gem for 4.14.0:

Option A — retag v4.14.0 at current main (recommended):

git checkout main && git pull
git tag -f v4.14.0
git push origin v4.14.0 --force

The tag push will fire push_gem.yml naturally via the existing push: tags: v* trigger — no dispatch needed. (This also correctly points the tag at HEAD once the release fixes are in.)

Option B — temporary env change: Repo Settings → Environments → release → add main to allowed deployment branches, dispatch Push Gem manually with --ref main, then revert the env change. Riskier; Option A is cleaner.

Future releases don't hit this issue because the workflow_dispatch trigger will always be present on any newly cut tag.

The 'release' environment restricts deployments to v* tag refs — 'main'
is not allowed to deploy. So my previous 'gh workflow run --ref main'
was blocked with:

  Branch "main" is not allowed to deploy to release due to environment
  protection rules.

Fix: dispatch push_gem.yml with --ref "$tag" instead. That way the
deployment runs against the tag ref, satisfying the environment's v*
restriction. The workflow's checkout can then use github.ref directly,
so drop the redundant 'tag' input and ref override.

Note: this dispatch requires the workflow_dispatch trigger to exist on
the tag itself. Because push_gem.yml lands on main before any future
release cuts a tag, that tag will always include the trigger. Only the
already-created v4.14.0 tag (from before we added workflow_dispatch)
lacks it — that has to be recovered manually by re-tagging v4.14.0 at
current main HEAD.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 217f0a0d-a9f2-4607-9643-5fcb3e34f20f
@joelhawksley
joelhawksley merged commit efc3085 into main Aug 24, 2026
22 of 24 checks passed
@joelhawksley
joelhawksley deleted the joelhawksley-redesigned-sniffle branch August 24, 2026 20:42
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.

1 participant