-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Hello, hope you're good. I'm running some experiments in order to build a custom action that demands the tags from the repo. I noticed that it was possible, in theory, just using the fetch-tags: true
, but it does not work. I can only get the tags if I use the fetch-depth: 0
.
Example workflow:
jobs:
custom-action:
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
path: tagaction
fetch-tags: true
- name: Try to get the tags
run: |
cd tagaction
git tag --sort -creatordate
The last command (git tag --sort -creatordate
) shows nothing in this case.
But, if I use the fetch-depth: 0
, it lists correctly the tags from the repository.
iTrooz, sarahsturgeon, TheOrioli, klutchell, larsgreason and 27 more
Metadata
Metadata
Assignees
Labels
No labels
Activity
sarahsturgeon commentedon Jun 27, 2024
I'm getting this too. I don't want to set fetch depth to 0.
It looks like
git fetch --tags
before running my commands works 👍e: Looks like this still breaks if I use
git describe --tags
but that might be unrelated.ci: Add fetch-depth: 0 as a workaround get tags on checkout
ci: Add fetch-depth: 0 as a workaround get tags on checkout
ci: Add fetch-depth: 0 as a workaround get tags on checkout
fetch-tags does not work correctly
github: revert back to running git fetch --tags manually
nerudaj commentedon Sep 22, 2024
Still an issue.
guettli commentedon Oct 2, 2024
The issue looks like this for us:
We are running 4.1.7 and use
fetch-depth: 0
,fetch-tags: true
.git tag -l
lists all tags, except the tags we pushed (and which triggered our GithubAction for releasing).We use
git describe
to detect the current git-tag. Since the pushed tag is not visible, our release process fails.csteenbock commentedon Dec 2, 2024
Also not working for me. I have
fetch-tags: true
, and it shows that in the action log, but the git command is not adding--tags
like it should:/opt/homebrew/bin/git -c protocol.version=2 fetch --prune --no-recurse-submodules --depth=1 origin +ab3c37e37b1bb41e6336a1f34d4f75f5706879af:refs/remotes/pull/193/merge
EDIT: You can see that they are not adding
--tags
in thefetch
function here. I tried creating a branch to fix it, but I guess I don't have permission.totkeks commentedon Jan 4, 2025
You need to create a fork of the repo first and then make a PR towards the original repo.
fetch tags when fetch-depth > 0. fix actions#1781
jakeatoms commentedon Jan 20, 2025
I'm experiencing something related, wherein I am using
fetch-depth: 0
and am getting all tags. The docs state thatfetch-tags
defaults tofalse
, but it doesn't appear to be working. I get the same behavior even when I explicitly passfetch-tags: false
.11 remaining items