Repository navigation
fix(ci): commit CHANGELOG.md on the first release - #19
Merged
Merged
Conversation
The release pipeline's "Update CHANGELOG.md" job guarded its commit with `git diff --quiet -- CHANGELOG.md`, which only inspects tracked files. On the first release the freshly generated CHANGELOG.md is untracked, so the check reported "no change" and silently skipped the commit while the step still exited 0 — which is why v0.0.3 produced a release but no CHANGELOG.md on main. Stage the file first, then test the staged diff (`git diff --cached --quiet`), which correctly detects a new file. Verified locally: the old guard skips an untracked CHANGELOG.md, the new guard commits it. Also seed CHANGELOG.md (generated by git-cliff through v0.0.3, using the repo's cliff.toml) so history is complete and future releases append to a tracked file.
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.
What
Fixes the release pipeline's
Update CHANGELOG.mdjob, which silently skipped its commit, and seeds the initialCHANGELOG.md. This is why v0.0.3 produced a published release but noCHANGELOG.mdlanded onmain.Root cause
The job guarded its commit like this:
git diff --quietonly inspects tracked files. On the first release the freshly generatedCHANGELOG.mdis untracked, so the check reports "no change" → the else-branch never runs → the file is never committed, yet the step exits 0 (green). It would stay broken on every release until the file became tracked.Fix
Stage first, then test the staged diff:
git diff --cached --quietcorrectly detects a newly-added file. Proven locally on a throwaway repo:CHANGELOG.md→ "unchanged → SKIP" (the bug)Also seeds CHANGELOG.md
Generated with git-cliff (v2.13.1, the action's version) using the repo's
cliff.toml, covering history through v0.0.3. So the file is complete now, and future releases append to a tracked file (which also keeps the guard on its normalgit diff --cachedpath going forward).Validation
release.ymlparses as valid YAML.ok: true) —CHANGELOG.mdis markdown at the repo root, outside the lint/dup/typecheck scopes, so it doesn't affect any gate.CHANGELOG.mdand the workflow so it won't recur.Note
The change touches
.github/workflows/release.yml, so the fixed job only actually runs on the next tagged release — butCHANGELOG.mdis committed in this PR, so the file is present onmainimmediately regardless.