Skip to content

feat(build-wheelhouse): add opt-in inputs to fetch full git history & tags for versioning#1269

Closed
viseshrp wants to merge 2 commits intomainfrom
feat/git-checkout-opts-wheelhouse
Closed

feat(build-wheelhouse): add opt-in inputs to fetch full git history & tags for versioning#1269
viseshrp wants to merge 2 commits intomainfrom
feat/git-checkout-opts-wheelhouse

Conversation

@viseshrp
Copy link
Copy Markdown
Contributor

@viseshrp viseshrp commented Apr 20, 2026

Similar to #1024

Why

I am modifying pydynamicreporting to obtain its package version from Git metadata using hatch-vcs. The existing build action performs a shallow checkout (fetch-depth: 1) and does not fetch tags, which prevents Hatch’s VCS plugin from detecting version tags during python -m build. As a result, the build falls back to a default 0.1 version instead of the actual version to be obtained from git tags.

What changed

  • Added two optional, pass-through inputs to the composite action’s checkout step:
    • checkout-fetch-depth (default: '1')
    • checkout-fetch-tags (default: 'false')
  • These map directly to actions/checkout inputs, allowing repositories to opt in to fetching full Git history and tags when required.
  • Default behavior remains unchanged to avoid side effects for existing consumers.

Backwards compatibility

  • No breaking changes — all existing workflows should continue to perform shallow checkouts.
  • Projects that require full tag history for VCS-based versioning can explicitly opt in.

How to opt in (example)

- uses: ansys/actions/build-wheelhouse@v10
  with:
    checkout-fetch-depth: '0'    # fetch full history
    checkout-fetch-tags:  'true' # fetch tags for hatch-vcs

Note: Hatch’s vcs or vcs-dev version sources rely on both commit history and annotated tags.
Use fetch-depth: 0 together with fetch-tags: true to ensure accurate version resolution.

When this is needed

  • Projects using:
    • hatch-vcs
    • Hatch vcs or vcs-dev version sources
    • setuptools_scm or other Git tag–based versioning tools
  • Any build logic that uses git describe, git tag, or commit metadata during build time.

@viseshrp viseshrp requested a review from a team as a code owner April 20, 2026 17:10
@github-actions github-actions Bot added the enhancement General improvements to existing features label Apr 20, 2026
Copy link
Copy Markdown
Contributor

@SMoraisAnsys SMoraisAnsys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aligns with what was already performed in #1024.

I missed that in the previous PR but couldn't you handled this logic by setting inputs.checkout to false and handling the checkout on your side ?

I'm asking that because this change could be performed on basically every action afterward or we should revert #1024 and let users handle the checkout logic however they want.

@RobPasMue
Copy link
Copy Markdown
Member

I'm asking that because this change could be performed on basically every action afterward or we should revert #1024 and let users handle the checkout logic however they want.

I agree - after thinking it through a bit more it might be best to check out the repo yourself with the desired conditions and then enabling the checkout: false option on your side. This would streamline things on our side - and we would have to revert #1024 as well.

@viseshrp
Copy link
Copy Markdown
Contributor Author

viseshrp commented Apr 21, 2026 via email

@viseshrp viseshrp closed this Apr 21, 2026
@viseshrp viseshrp deleted the feat/git-checkout-opts-wheelhouse branch April 21, 2026 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement General improvements to existing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants