GoReleaser "failed to fetch tags" (shallow clone) in CI
GoReleaser reads tags from the local clone to pick the current and previous version for the changelog. A shallow CI checkout omits tags, so GoReleaser either fails or uses a stale version.
What this error means
GoReleaser warns "couldn't find any tags before ..." or produces a wrong version and an empty changelog because tags were not fetched into the shallow clone.
• couldn't find any tags before "v1.4.0"
⨯ release failed after 1s
error=failed to fetch tags: fatal: No names found, cannot describe anything.Common causes
Shallow checkout without tags
The default fetch-depth: 1 clones only the tip commit and no tag objects, so GoReleaser cannot describe the version.
Tags exist on the remote but were not fetched
Even a deeper fetch may skip tags unless fetch-tags or fetch-depth: 0 is set.
How to fix it
Do a full fetch with tags
Set fetch-depth: 0 so actions/checkout brings the entire history and all tags GoReleaser needs.
- uses: actions/checkout@v4
with:
fetch-depth: 0Fetch tags explicitly if you keep a shallow clone
When a full clone is too expensive, unshallow and fetch tags before running GoReleaser.
git fetch --prune --unshallow --tags
goreleaser release --cleanHow to prevent it
- Standardize on
fetch-depth: 0for every release workflow. - Verify the changelog is populated as a sign tags were fetched.
- Avoid shallow clones in jobs that call
git describesemantics.