Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetch-tags: true doesn't actually fetch any tags #1471

Open
dataviruset opened this issue Sep 13, 2023 · 6 comments
Open

fetch-tags: true doesn't actually fetch any tags #1471

dataviruset opened this issue Sep 13, 2023 · 6 comments

Comments

@dataviruset
Copy link

dataviruset commented Sep 13, 2023

After #579 was merged and released with v3.6.0, the fetch-tags option was introduced and it's kind of a breaking change for projects that depend on reading tags from the git history. It sets --no-tags in the git fetch command run by this action. I think this new option should have defaulted to true or introduced in v4 instead where it could possibly have had the default false.

Nevertheless, using fetch-tags: true without overriding the default fetch-depth: 1 actually doesn't fetch any tags unless the workflow was triggered by a tag push. So I think it's misleading and should be changed to fetch all tags if fetch-tags is set to true. The change to the git fetch command run by this action would be to append '+refs/tags/*:refs/tags/*' (tagsRefSpec) to the end even though fetch-depth is > 0.

Related issue: #1467

A possible workaround would be to run another git fetch after using this checkout action like in #579 (comment), but that feels hacky.

Seems the author of the #579 PR also discussed supporting my use-case here: #579 (comment)
I'm sure that this added functionality would be very appreciated. Thanks for your consideration!

@tatiesmars
Copy link

Up, it would be nice to address this.

@ozancaglayan
Copy link

This is so annoying and confusing. I set fetch-depth: 1 and fetch-tags: true to express my intention to not checkout all the commits but indeed have all the tags, but no tags are fetched.

@zoj613
Copy link

zoj613 commented Oct 8, 2023

Reporting here because I spent a few days trying to figure out why my project's release workflow was failing due to the wheels having the wrong version number. After some digging, it turned out that this change was the cause of this failure since cibuildwheels could not use the tag information when buidling wheels. I had to explicitly set fetch-depth: 0 and fetch-tags: true to fix this.

@arthurfiorette
Copy link

Can confirm its still broken...

fetch-depth: 0 will be slow for big repositories... I simply added another step to manually fetch tags, which solves this issue perfectly for now.

- name: Checkout
  uses: actions/checkout@v4

- name: Fetch tags
  run: git fetch --prune --unshallow --tags

@benoit-pierre
Copy link

Another possible option is to use filters:

- uses: actions/checkout@v3
  with:
    fetch-depth: 0
    filter: tree:0

See #1396.

@ilyamt-tandemg
Copy link

Can confirm its still broken...

fetch-depth: 0 will be slow for big repositories... I simply added another step to manually fetch tags, which solves this issue perfectly for now.

- name: Checkout
  uses: actions/checkout@v4

- name: Fetch tags
  run: git fetch --prune --unshallow --tags

Please note that git fetch without --depth is like git fetch --depth 0 so basically you are doing a shallow fetch followed by a deep fetch (this is why you need --unshallow), which is similar, but with more steps, compared to just running one deep fetch once using actions/checkout.

So it is true that your solution works, it is not better but more worldly than just using this:

- name: Checkout
  uses: actions/checkout@v4
  with:
    fetch-depth: 0
    fetch-tags: true

liskin added a commit to liskin/strava-offline that referenced this issue Nov 2, 2023
kpushkaryov added a commit to plesk/debian11to12 that referenced this issue Dec 20, 2023
thatch added a commit to python-packaging/honesty that referenced this issue Jan 22, 2024
parkerbxyz added a commit to parkerbxyz/.github that referenced this issue Mar 12, 2024
thegamecracks added a commit to thegamecracks/dum-dum-irc that referenced this issue Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants
@ozancaglayan @dataviruset @benoit-pierre @tatiesmars @zoj613 @arthurfiorette @ilyamt-tandemg and others