fix: sanitize version string for PR Windows builds#13
Merged
Conversation
On pull_request events, GitHub Actions checks out the merge ref (pull/N/merge), making GITHUB_REF_NAME resolve to 'N/merge'. The version injection logic used this raw ref name as-is, producing version strings like '12/merge-test'. The '/' character is invalid in Inno Setup's OutputBaseFileName, causing ISCC to fail with: Value of [Setup] section directive 'OutputBaseFileName' is invalid. Fix: use GITHUB_HEAD_REF (the actual PR branch name) as the version source when building from a pull_request event, falling back to GITHUB_REF_NAME for push events. Sanitize any remaining '/' for safety. Also corrects local git identity to Sparsh Sam <sparshsam@gmail.com> for all future commits.
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.
Root Cause
On
pull_requestevents, GitHub Actions checks out the auto-generated merge ref (refs/pull/N/merge), makingGITHUB_REF_NAMEresolve to12/mergeinstead of the actual branch name. The version injection logic used this raw ref name directly:This version string containing
/was passed to Inno Setup'sOutputBaseFileName, which is a filename directive —/is invalid, causing ISCC to fail with:This only affected the
pull_requesttrigger becausepushevents use the branch ref (refs/heads/main→GITHUB_REF_NAME=main).Fix
Use
GITHUB_HEAD_REF(the actual PR source branch, e.g.docs/post-v1.0.6-doc-review) as the version source for pull_request events, falling back toGITHUB_REF_NAMEfor push events. Also sanitize/→-as a safety net.Files Changed
.github/workflows/build-windows.yml— 2 lines added, 1 removedVerification
CI will run on this PR. The
Build Windows EXE / build (pull_request)check should now pass.Author Note
Commit is authored as
Sparsh Sam <sparshsam@gmail.com>(correct GitHub identity). The previous documentation commit onmain(4b6a4e3) was authored with a Git Bash local identity (sparsh@users.noreply.github.com) that resolved to the wrong GitHub user — that commit cannot be re-authored without rewritingmainhistory, which was explicitly avoided here.