Dispatch push_gem against the tag ref, not main - #2703
Merged
Conversation
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
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.
Follow-up to #2702. The
workflow_dispatch --ref mainI added was rejected by thereleaseenvironment:Root cause
The
releaseenvironment restricts deployments tov*tag refs. Dispatching frommainwas never going to satisfy that rule.Fix
Dispatch
push_gem.ymlwith--ref "$tag"instead of--ref main. That way the deployment runs against the tag itself, which the environment allows. As a nice consequence,github.refinpush_gem.ymlnow already points at the tag, so thetaginput andrefoverride are no longer needed — dropped both to simplify the workflow.Caveat for v4.14.0 recovery
workflow_dispatchrequires the trigger to exist on the target ref. The v4.14.0 tag was created before we addedworkflow_dispatchtopush_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 --forceThe tag push will fire
push_gem.ymlnaturally via the existingpush: 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→ addmainto allowed deployment branches, dispatchPush Gemmanually with--ref main, then revert the env change. Riskier; Option A is cleaner.Future releases don't hit this issue because the
workflow_dispatchtrigger will always be present on any newly cut tag.