question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tags not fetched in GitHub actions when following documentation

See original GitHub issue

I have the following in my github actions which is copied from the documentation in the readme (with config added).

    - name: Fetch all history for all tags and branches
      run: git fetch --prune --unshallow

    - name: Install GitVersion
      uses: gittools/actions/gitversion/setup@v0.9.4
      with:
          versionSpec: '5.2.x'
    
    - name: Use GitVersion
      id: gitversion # step id used as reference for output values
      uses: gittools/actions/gitversion/execute@v0.9.4
      with:
        useConfigFile: true
        configFilePath: ./GitVersion.yml

Running the fetch step gives the following in the logs.

Run git fetch --prune --unshallow
  git fetch --prune --unshallow
  shell: /bin/bash -e {0}
  env:
    projectName: ModelBuilder

This isn’t downloading the tags as expected and therefore generating an incorrect version.

I have updated the step to explicitly include tags.

    - name: Fetch all history for all tags and branches
      run: git fetch --prune --unshallow --tags

The build now fetches the following tags and generates the correct version.

Run git fetch --prune --unshallow --tags
  git fetch --prune --unshallow --tags
  shell: /bin/bash -e {0}
  env:
    projectName: ModelBuilder
From https://github.com/roryprimrose/ModelBuilder
 * [new branch]      master         -> origin/master
 * [new tag]         4.0.0-beta0049 -> 4.0.0-beta0049
 * [new tag]         4.0.0-beta0050 -> 4.0.0-beta0050
 * [new tag]         4.0.0-beta0051 -> 4.0.0-beta0051
 * [new tag]         4.0.0-beta0052 -> 4.0.0-beta0052
 * [new tag]         4.0.0-beta0053 -> 4.0.0-beta0053
 * [new tag]         4.0.0-beta0054 -> 4.0.0-beta0054
 * [new tag]         4.0.0-beta0057 -> 4.0.0-beta0057
 * [new tag]         4.0.0-beta0059 -> 4.0.0-beta0059
 * [new tag]         6.0.0          -> 6.0.0
 * [new tag]         6.0.0-beta0001 -> 6.0.0-beta0001
 * [new tag]         6.0.0-beta0002 -> 6.0.0-beta0002
 * [new tag]         6.0.0-beta0003 -> 6.0.0-beta0003
 * [new tag]         6.0.0-beta0004 -> 6.0.0-beta0004
 * [new tag]         6.0.0-beta0005 -> 6.0.0-beta0005
 * [new tag]         6.0.0-beta0006 -> 6.0.0-beta0006
 * [new tag]         6.0.0-beta0007 -> 6.0.0-beta0007
 * [new tag]         6.0.0-beta0008 -> 6.0.0-beta0008
 * [new tag]         6.0.0-beta0009 -> 6.0.0-beta0009
 * [new tag]         6.0.0-beta0010 -> 6.0.0-beta0010
 * [new tag]         6.0.0-beta0011 -> 6.0.0-beta0011
[truncated]

The documentation on unshallow isn’t clear about what it does with tags but it does not seem to fetch them.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
roryprimrosecommented, Sep 29, 2020

Thanks for the update. Yep, the tags came down on a build. I’ll reopen if I find it isn’t working again.

1reaction
w5lcommented, Sep 28, 2020

That fixed the issue for me. Thanks.

note: am not the original reporter.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fetching tags doesn't work · Issue #206 · actions/checkout
I am running: - uses: actions/checkout@v2 - run: | git fetch --prune --unshallow - run: | echo $(git tag -l) I expect to...
Read more >
allow fetch tags too · Issue #701 · actions/checkout - GitHub
current it will add --no-tags but i hope can fetch tag too that is help when wanna build changelog base on tag in...
Read more >
v2 no longer downloads tags · Issue #100 · actions/checkout
As of v2, tags are no longer available in the cloned repository, ... Explictly fetch the whole Git history when building Docker image...
Read more >
How to fetch tag message in github actions · Discussion #27155
I want to capture the github tag message in Github Actions. If user pushes tag with some message e.g.. git tag -a 1.0.0...
Read more >
[question] some tags not "visible" after checkout #597 - GitHub
I need to do a "git fetch --tags" to have the full list of tags for ... I could not find anything in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found