fix: release workflow failing with "fatal: not in a git directory" - #16
Merged
Conversation
Two real, unrelated bugs surfaced by the first real trigger — neither is about the RELEASE_PUSH_TOKEN/PAT despite the failure looking auth-shaped: 1. The container job's checkout registers the checked-out path as a git safe.directory, but that doesn't reliably carry over to later plain run: steps executing inside a job-level container: (devkitpro/ devkitarm here) — they can fail on git ops the checkout step itself just did fine seconds earlier. Fixed with an explicit `git config --global --add safe.directory '*'` step right after checkout, in the same execution context later steps use. 2. The version-format check used bash's `[[ ... =~ ... ]]`, but this step's shell is POSIX sh (dash), not bash — `[[` doesn't exist there, and a failing `if` *condition* doesn't trigger `sh -e`, so the check was silently skipped rather than failing, letting "2.4" through instead of requiring "2.4.0". Rewritten with grep -Eq (already used elsewhere in this script) and verified against real dash.
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.
Summary
The
Releaseworkflow's first real trigger (withRELEASE_PUSH_TOKENconfigured) failed at the "Commit and push version bump" step withfatal: not in a git directory— looked auth-related but wasn't. Pulled the job logs and found two real, unrelated bugs:actions/checkoutstep registers the checkout path as a gitsafe.directory, but that doesn't reliably carry over to later plainrun:steps executing inside a job-levelcontainer:(this workflow runs insidedevkitpro/devkitarm) — they can fail on git operations the checkout step itself just did fine seconds earlier. Fixed with an explicitgit config --global --add safe.directory '*'step right after checkout, in the same execution context later steps use.[[ ... =~ ... ]], but this step's shell is POSIXsh(dash) in this container, not bash —[[doesn't exist there, and since a failingifcondition doesn't triggersh -e, the broken check was silently skipped rather than failing the step. This is exactly what let2.4(missing the patch number) through as the actual failed run's input, instead of requiring2.4.0. Rewritten withgrep -Eq, already used elsewhere in this same script, and portable POSIX.Test plan
python3 -c "import yaml; yaml.safe_load(...)"— workflow YAML parses cleanly/bin/shin this sandbox isdash, same as the failing container — ran the newgrep -Eqcheck directly under realdash: rejects2.4,v2.4.0, garbage; accepts2.4.0sh -eagainst a mockCHANGELOG.md/source/types.h, confirming the correct## v2.4.0 (date)heading andVERSION_STRINGbumpReleaseworkflow (this fix can only be fully confirmed by actually running it — will need to be triggered again after merge)Generated by Claude Code