Skip to content

fetch-tags is not working according to the docs with v4 #1781

Open
@64J0

Description

@64J0

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.

Activity

sarahsturgeon

sarahsturgeon commented on Jun 27, 2024

@sarahsturgeon

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.

added a commit that references this issue on Jul 29, 2024
nerudaj

nerudaj commented on Sep 22, 2024

@nerudaj

Still an issue.

guettli

guettli commented on Oct 2, 2024

@guettli

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

csteenbock commented on Dec 2, 2024

@csteenbock

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 the fetch function here. I tried creating a branch to fix it, but I guess I don't have permission.

totkeks

totkeks commented on Jan 4, 2025

@totkeks

I tried creating a branch to fix it, but I guess I don't have permission.

You need to create a fork of the repo first and then make a PR towards the original repo.

added a commit that references this issue on Jan 14, 2025
0776c3a
jakeatoms

jakeatoms commented on Jan 20, 2025

@jakeatoms

I'm experiencing something related, wherein I am using fetch-depth: 0 and am getting all tags. The docs state that fetch-tags defaults to false, but it doesn't appear to be working. I get the same behavior even when I explicitly pass fetch-tags: false.

10 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @guettli@totkeks@jakeatoms@sarahsturgeon@mikeharder

      Issue actions

        fetch-tags is not working according to the docs with v4 · Issue #1781 · actions/checkout