Skip to content
Latchkey

semantic-release shallow clone / fetch-depth 0 history missing in CI

actions/checkout defaults to a shallow clone (fetch-depth 1) with no tags. semantic-release reads the full commit history and tags to find the last release and the commits since. Without them it can compute the wrong version or find no prior release at all.

What this error means

semantic-release reports it found no previous release, releases 1.0.0 on an established package, or analyzes only the latest commit because history and tags are missing.

semantic-release
[semantic-release] No git tag version found on branch main
[semantic-release] There is no previous release, the next release version is 1.0.0

Common causes

The default shallow checkout omits history and tags

With fetch-depth 1, only the latest commit is present and tags are not fetched, so semantic-release cannot see prior releases.

Tags were not fetched even with full depth

Some setups fetch depth but skip tags; semantic-release then misidentifies the last released version.

How to fix it

Fetch the full history in checkout

  1. Set fetch-depth: 0 so all commits and tags are available.
  2. Keep the default persist-credentials so the push can authenticate.
  3. Re-run so semantic-release sees the real last release.
.github/workflows/release.yml
- uses: actions/checkout@v4
  with:
    fetch-depth: 0

Fetch tags if you customized the checkout

If you fetch manually, make sure tags come along so the last version is detected.

Terminal
git fetch --prune --unshallow --tags

How to prevent it

  • Always set fetch-depth: 0 for semantic-release jobs.
  • Ensure tags are fetched, not just commit depth.
  • Verify the detected last release in the log after config changes.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →