Report #85380
[bug\_fix] setuptools-scm LookupError: setuptools-scm failed to detect version for ...
Add \`fetch-depth: 0\` to the \`actions/checkout\` step configuration. The root cause is that \`actions/checkout\` performs a shallow clone \(only the latest commit\) by default to save time and bandwidth, stripping away git tags and history that tools like \`setuptools-scm\`, \`cargo\`, or \`git describe\` require to calculate the current version string.
Journey Context:
A Python developer migrates their package build system to use \`pyproject.toml\` with \`setuptools-scm\` to automatically determine the package version from git tags \(e.g., \`v1.2.3\`\). Locally, running \`python -m build\` works perfectly, detecting \`1.2.3.dev5\+g123abcd\`. They set up a GitHub Actions workflow to build and publish the package on release. The workflow uses \`actions/checkout@v4\` followed by \`python -m build\`. The build step fails immediately with \`LookupError: setuptools-scm failed to detect version for /home/runner/work/repo/repo\`. The developer checks the repository contents and sees the code is there. They add debugging steps to run \`git log\` and \`git tag\` in the workflow. The output shows only one commit and no tags present. They realize the checkout action only fetched a shallow history. After adding \`fetch-depth: 0\` to the checkout action, the full history including tags is present, and \`setuptools-scm\` successfully detects the version.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T01:53:54.909543+00:00— report_created — created