Validate publish tags before checkout/build/publish - #49
Merged
Conversation
Copilot
AI
changed the title
[WIP] Update publish.yml to validate release tag format
Validate publish tags before checkout/build/publish
May 22, 2026
barentine
approved these changes
May 22, 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.
The Publish to PyPI workflow accepted the release tag inline at checkout time, which left tag format unchecked and duplicated tag resolution logic. This change resolves the tag once, validates it against the required
XX.XX.XXformat, and reuses that value for checkout.Tag resolution
Determine release tagstep inrelease-buildworkflow_dispatchinput or release tag) to$GITHUB_OUTPUTTag validation
^[0-9]{2}\.[0-9]{2}\.[0-9]{2}$Checkout update
Original prompt
Please create a pull request in repository
barentine/double_helixmaking the minimal change to.github/workflows/publish.ymlso the workflow validates release tags in the exact formatXX.XX.XXbefore checkout/build/publish.Context:
.github/workflows/publish.yml.releaseandworkflow_dispatchtriggers.refs/tags/${{ inputs.tag || github.event.release.tag_name }}directly.^[0-9]{2}\.[0-9]{2}\.[0-9]{2}$, and then uses that validated tag for checkout.Suggested implementation:
release-build, add a step to determine the tag and write it to$GITHUB_OUTPUT.Please open a pull request with a concise title and summary of the minimal change.
The following is the prior conversation context from the user's chat exploration (may be truncated):
User:
pypi-publish
Tag "26.05.21" is not allowed to deploy to pypi due to environment protection rules.
Assistant: The failure is because GitHub environment protection blocked the deploy.
Your
pypi-publishjob is attached to thepypienvironment in.github/workflows/publish.yml:And GitHub told you exactly why it stopped:
So the difference between the successful April 1, 2026 run and the failed May 21, 2026 run is probably not the package build or PyPI upload credentials. The workflow reached the deployment gate, but the tag name
26.05.21did not match the deployment policy configured for thepypienvironment.Most likely cause:
pypienvironment has a deployment branch/tag rule restricting which tags may deploy.26.05.21did not.What to check in GitHub:
26.05.21Common examples of mismatches:
v*, but your tag is26.05.21release/*So if your intended release format is
26.05.21, the fix is one of:26.05.21, orv26.05.21if the rule expectsv*If you want, I can help you with either of these next:
publish.ymlso your manualworkflow_dispatchinput description and release process are consistent.User: please start by 1. infer the likely tag
Assistant: The likely allowed tag pattern is
v*, and your failed tag26.05.21probably missed the required leadingv.Why I think that:
That example strongly suggests your intended convention is tags like
v26.03.03, not26.05.21.26.05.21That is exactly the kind of failure you’d expect if the environment allows something like:
v*or a narrower pattern such as:
v*.*.*So my best inference is:
v26.05.2126.05.21v*orv*.*.*What I’d do next:
This pull request was created from Copilot chat.