Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetching tags doesn't work #206

Closed
thoward27 opened this issue Apr 1, 2020 · 15 comments
Closed

Fetching tags doesn't work #206

thoward27 opened this issue Apr 1, 2020 · 15 comments

Comments

@thoward27
Copy link

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.

@ericsciple
Copy link
Contributor

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

@ericsciple
Copy link
Contributor

Also curious whether performed from a fork pr

@silasdavis
Copy link

silasdavis commented Apr 5, 2020

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?

skirpichev added a commit to skirpichev/diofant that referenced this issue Apr 6, 2020
This using suggested in actions/checkout#206 way to fetch tags.

This reverts commit 6a30664.
skirpichev added a commit to skirpichev/diofant that referenced this issue Apr 6, 2020
This using suggested in actions/checkout#206 way to fetch tags.

This reverts commit 6a30664.
@thoward27
Copy link
Author

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.

@oesteban
Copy link

Same here

oesteban added a commit to templateflow/python-client that referenced this issue Apr 10, 2020
@ericsciple
Copy link
Contributor

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.

@thoward27
Copy link
Author

My repo is not a fork if that helps.

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

@ericsciple
Copy link
Contributor

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

@ericsciple
Copy link
Contributor

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

@ericsciple
Copy link
Contributor

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

@ericsciple
Copy link
Contributor

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.

@jasonkuhrt
Copy link

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

@pllim
Copy link

pllim commented May 20, 2020

I also tried the README and then found the answer at #206 (comment) . Would be nice to fix the README. Thanks for making GitHub Actions accessible for OSS!

Unlike others, I use fork.

@ericsciple
Copy link
Contributor

@pllim thanks, fixed here

@ericsciple
Copy link
Contributor

Closing. Reopen if any issues.

sodevel added a commit to wxFormBuilder/wxFormBuilder that referenced this issue Oct 1, 2021
sodevel added a commit to wxFormBuilder/wxFormBuilder that referenced this issue Oct 1, 2021
The checkout action does not fetch any tags resulting in `git describe`
failing. The recommended solution `git fetch --prune --unshallow --tags`
of actions/checkout#206 has the drawback
that a full clone gets created defeating the optimization attempts of
the action.

After a lot of try-and-error it was discovered that
`git fetch --prune --depth=1 --tags` transfers much less data at the
cost that `git describe` can only find a tag if it is directly on the
currently checked out ref. This is sufficient to describe release refs only.
vikineema added a commit to vikineema/deafrica-sandbox-notebooks that referenced this issue Mar 16, 2022
louis-bompart added a commit to coveo/cli that referenced this issue Oct 14, 2022
<!-- For Coveo Employees only. Fill this section.

CDX-764

-->

## Proposed changes

GitHub does some funky stuff for the checkout. This seems to fix it. 
Inspired by
actions/checkout#206 (comment)

Before:
https://github.com/coveo/cli/actions/runs/3252334483/jobs/5338428208
After:
https://github.com/coveo/cli/actions/runs/3252358715/jobs/5338480219
volkertb added a commit to volkertb/SBEMU that referenced this issue Jan 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants