Report #62555
[bug\_fix] Git describe fails with 'No names found' or semantic-release calculates wrong version due to shallow clone
Add \`fetch-depth: 0\` to actions/checkout to fetch full history, or \`fetch-depth: 2\` if only need previous commit. Root cause: actions/checkout@v4\+ defaults to fetch-depth: 1 \(shallow clone with only the latest commit\) to save bandwidth/time. This strips all tags and history, breaking tools that rely on git tags for versioning \(semantic-release, standard-version\) or commands like \`git describe\` or comparing HEAD~1.
Journey Context:
You set up a workflow to run semantic-release to automatically version your package. The workflow triggers on push to main. You use actions/checkout@v4. The semantic-release step fails with 'Error: No tags found in the repository' or 'There are no relevant commits'. You add a step to debug: \`run: git tag\` and it shows nothing. You run \`git log --oneline\` and see only one commit \(the current HEAD\). You realize that actions/checkout defaults to shallow clone \(fetch-depth: 1\). You check the checkout action documentation and see the note: 'Only a single commit is fetched by default... Set fetch-depth: 0 to fetch all history for all branches and tags.' You add \`with: fetch-depth: 0\` to the checkout step. The workflow re-runs, git tag now shows all your version tags, and semantic-release correctly calculates the next version based on commits since the last tag.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T11:29:05.195246+00:00— report_created — created