Checkout: Fetching tags doesn't work

Created on 1 Apr 2020  路  15Comments  路  Source: actions/checkout

I have tried almost every configuration of this action I can think of.

I am running:

- uses: actions/checkout@v2
- run: |
    git fetch --prune --unshallow
- run: |
    echo $(git tag -l)

I expect to see the tags from my repository in the output.

I am currently seeing nothing.

Most helpful comment

what about git fetch --prune --unshallow --tags ?

All 15 comments

what about git fetch --prune --unshallow --tags ?

Also curious whether performed from a fork pr

The suggested command also fails for me with no kind of error message:

Set up job
2s
Run actions/checkout@v2
2s
Run git fetch --depth=1 origin '+refs/tags/*:refs/tags/*'
0s
##[error]Process completed with exit code 1.
Run git fetch --depth=1 origin '+refs/tags/*:refs/tags/*'
  git fetch --depth=1 origin '+refs/tags/*:refs/tags/*'
  shell: /bin/bash -e {0}
##[error]Process completed with exit code 1.

I tried quoting the refspec thinking it might be bash globbing issue

what about git fetch --prune --unshallow --tags ?

This works for me

Also curious whether performed from a fork pr

Not from a fork for me, this is from a branch force (could that be relevant?) push

What's with the lack of error message from git - is there some kind of additional layer here?

I still cannot get tags to work for me.

Tried with:

      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - run: |
          git fetch --prune --tags
      - name: Create Release
        run: |
          echo $(git tag -l)
          echo $(git log --tags

And:

      - uses: actions/checkout@v2
      - run: |
          git fetch --prune --unshallow --tags
      - name: Create Release
        run: |
          echo $(git tag -l)
          echo $(git log --tags

Neither do the trick for me.

Same here

Other than ruling out fork vs non-fork, I wonder whether there is a difference with the token?

Could try a PAT (see token input) or deploy key (see ssh-key input), instead of using the built-in token.

My repo is not a fork if that helps.

https://github.com/thoward27/semantic-release

This works for me:

on: push
jobs:
  build:
    runs-on: [ubuntu-latest]
    steps:
      - uses: actions/checkout@v2
        with:
          repository: thoward27/semantic-release
      - run: |
          git fetch --unshallow --tags
          echo $?
          git tag --list

Also confirmed with --prune works too (one of the other combinations listed). Note, testing against your repo too.

on: push
jobs:
  build:
    runs-on: [ubuntu-latest]
    steps:
      - uses: actions/checkout@v2
        with:
          repository: thoward27/semantic-release
      - run: |
          git fetch --prune --unshallow --tags
          echo exit code $?
          git tag --list

Here's the output from the run step:

From https://github.com/thoward27/semantic-release
 * [new branch]      feat/ci    -> origin/feat/ci
 * [new tag]         v0.4.0     -> v0.4.0
exit code 0
v0.4.0

If those same commands dont work for you, would be good to try with a PAT or deploy key. Will help narrow whether something weird about the built-in token for your account.

This worked for me (at first I tried the readme instructions):

-        with:
-          fetch-depth: 0
       - name: Get all git tags
-        run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
+        run: git fetch --prune --unshallow --tags

I also tried the README and then found the answer at https://github.com/actions/checkout/issues/206#issuecomment-607496604 . Would be nice to fix the README. Thanks for making GitHub Actions accessible for OSS!

Unlike others, I use fork.

@pllim thanks, fixed here

Closing. Reopen if any issues.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rectalogic picture rectalogic  路  5Comments

chorrell picture chorrell  路  4Comments

pdcmoreira picture pdcmoreira  路  3Comments

KOLANICH picture KOLANICH  路  4Comments

jcharnley picture jcharnley  路  4Comments