You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a CI action that depends on information from annotated tags. Specifically, the name of the person who applied the tag: git tag --list --points-at HEAD --format '%(taggeremail)' (I can't use ${{ github.actor }} for reasons).
The workaround is to run git fetch -f origin ${{ github.ref }}:${{ github.ref }}. But it would be better not to need this workaround.
Reacted by Carl Hörberg, Christopher J. Morrone, Brett Ausmeier, Andrey Novikov, Zaar Hai, Peter Johnson, Claudio Bley, Michael Behrisch, Omair Majid, Mike Detwiler and 66 more
Reacted by DiveInto, Arjan Speiard | Asgard Sings!, Ihor Dutchak and Mark Callow
I realize now that this is complicated by a desire to checkout the specific code identified by the hash when the tag has been re-applied on the repository. I would be happy to have an option that would cause the checkout to fail if the hash didn't match.
@martinthomson does the input depth: 0 help? It will cause all history for all branches and tags to be fetched?
I didn't try 0, but I tried "fetch-depth: 2000" at one point. It fetched the other tags in that history correctly, but if the thing that triggered the workflow was itself an annotated tag, that one tag will still be converted from an annotated tag into a lightweight tag.
Reacted by oakkitten, Jon Bettinger, Dean Sheather, Davide Pesavento and Iustin Pop
fetch-depth: 0 does solve the issue. I don't see how it wouldn't because it fetch all branches, all tags
Reacted by Benjamin Hodgson, Pedro Alvarez Piedehierro, Adam Hellberg, Alexey Palazhchenko, Atif Ali, Alexander Mihajlovic, Ross Goldberg, Jason Pickens and Brandon Casey
Reacted by Phebe S, Jon Bettinger, Ihor Dutchak, Katherine Pata, Mark Callow, Adam Hellberg, Alexey Palazhchenko, Alexander Mihajlovic, Ross Goldberg, Philippe Coval and 1 more
Reacted by Benjamin Staneck, Aleksandr Mogilnikov, Georgy Moiseev, Mohammed Al Sahaf, Matt Holt, Laura Murgatroyd, Phebe S, Sylvie, hydai, Hannes Tydén and 5 more
That's the same workaround I originally suggested, just more broadly targets (all tags, not just one). As you say --depth 0 has no effect.
The main problem is that the code fetches using a hash and then re-applies its own tag if the build was initiated as a result of applying a tag. That's also why you need to add --force, because you need to overwrite that bad tag. Hence my suggestion to fetch the tag rather than applying it, along with a check that the tag still points to the fetched content.
I only needed to git describe --always to discover the latest tag since I'm release docker images myself, and indeed in GH Actions it was discovering one-before-the-current tags. In my case it was another to add --tags to git describe to make it consider non-annotated tags well.
While it was an easy workaround I believe there is way too much details involved in getting this work properly.
Reacted by Georgy Moiseev, freddyrios, Kyle Benesch and Iustin Pop
This bit me as well. We use annotated tags in our build/release process and this was a little tough to track down. Another confirmation that fetch-depth: 0 does not address this. Adding git fetch --force --tags as an additional build step after checkout seems to be a valid workaround, at least for us.
Activity
morrone commentedon Jul 17, 2020
Agreed! This breaks the "git describe" command too. We need tags to be in their correct original form.
martinthomson commentedon Jul 20, 2020
I realize now that this is complicated by a desire to checkout the specific code identified by the hash when the tag has been re-applied on the repository. I would be happy to have an option that would cause the checkout to fail if the hash didn't match.
For example:
ericsciple commentedon Jul 20, 2020
@martinthomson does the input
depth: 0help? It will cause all history for all branches and tags to be fetched?morrone commentedon Jul 20, 2020
I didn't try 0, but I tried "fetch-depth: 2000" at one point. It fetched the other tags in that history correctly, but if the thing that triggered the workflow was itself an annotated tag, that one tag will still be converted from an annotated tag into a lightweight tag.
ericsciple commentedon Jul 31, 2020
fetch-depth: 0triggers a different behavior. Curious if that solves the issue?Stanzilla commentedon Aug 13, 2020
It does not solve the issue, I ran into this today. Looks like the action is not using the tag itself, just the commit the tag points to.
andreineculau commentedon Aug 24, 2020
fetch-depth: 0does solve the issue. I don't see how it wouldn't because it fetch all branches, all tagsStanzilla commentedon Aug 24, 2020
@andreineculau sadly does not.
Fix issue where release would fail validation.
Envek commentedon Aug 25, 2020
+1 on preserving tag annotations.
fetch-depth: 0alone doesn't help,git fetch --tags --forcedoes help.martinthomson commentedon Aug 27, 2020
That's the same workaround I originally suggested, just more broadly targets (all tags, not just one). As you say
--depth 0has no effect.The main problem is that the code fetches using a hash and then re-applies its own tag if the build was initiated as a result of applying a tag. That's also why you need to add
--force, because you need to overwrite that bad tag. Hence my suggestion to fetch the tag rather than applying it, along with a check that the tag still points to the fetched content.bixu commentedon Aug 28, 2020
Also seeing that
fetch_depth: 0doesn't work for all Actions that handle/search for tags in the repo history.haizaar commentedon Oct 6, 2020
I only needed to
git describe --alwaysto discover the latest tag since I'm release docker images myself, and indeed in GH Actions it was discovering one-before-the-current tags. In my case it was another to add--tagstogit describeto make it consider non-annotated tags well.While it was an easy workaround I believe there is way too much details involved in getting this work properly.
chrislambe commentedon Oct 22, 2020
This bit me as well. We use annotated tags in our build/release process and this was a little tough to track down. Another confirmation that
fetch-depth: 0does not address this. Addinggit fetch --force --tagsas an additional build step after checkout seems to be a valid workaround, at least for us.ericcornelissen commentedon Oct 22, 2020
Same here, exact same scenario as chrislambe described. I can also confirm that
fetch-depth: 0doesn't help, but addinggit fetch --force --tagsdoes.131 remaining items
fix(actions): hack around actions/checkout#290
Add workaround for actions/checkout#290
Revert "Trigger builds when new tags are pushed"
hikari-no-yume commentedon Apr 2, 2024
I got bitten by this yesterday. The solution offered in #1506 looks like a good compromise to me. I hope that'll be merged eventually.
Force-fetch tags in CI to fix `git describe`
Force-fetch tags in CI to fix `git describe`
Fix problem on `git describe`
Fix problem on `git describe`
Add workaround for actions/checkout#290
Add workaround for actions/checkout#290
Add workaround for actions/checkout#290
Add workaround for actions/checkout#290
ericsciple commentedon Jan 9, 2026
The fix is merged but not yet released...
ericsciple commentedon Jan 9, 2026
Released with v6.0.2. I am going to allow some bake time before moving the v6 tag forward.
I will leave this issue open until the v6 tag is updated.
Totktonada commentedon Nov 4, 2026
Fixed by #2356 (released in v6.0.2)?