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

git describe --abbrev=0 shows wrong tag #272

Closed
hannesa2 opened this issue Jun 8, 2020 · 8 comments
Closed

git describe --abbrev=0 shows wrong tag #272

hannesa2 opened this issue Jun 8, 2020 · 8 comments

Comments

@hannesa2
Copy link

hannesa2 commented Jun 8, 2020

Something looks wrong with git describe --abbrev=0 I use this

  - name: Checkout
    uses: actions/checkout@v2.2.0
    with:
      fetch-depth: 0

and I even do a git fetch --all Please see here

to grab latest git tag. This is an example with wrong output

Local on my machine I see with git tag -n

1.0.6.13 Attempt to fix git tag
1.0.6.14 1.0.6.14
1.0.6.15 1.0.6.15
1.0.6.16 1.0.6.16
1.0.6.17 1.0.6.17

but on Github CI

1.0.6.13 Attempt to fix git tag
1.0.6.14 1.0.6.14
1.0.6.15 1.0.6.15
1.0.6.16 1.0.6.16
1.0.6.17 Revert "remove Travis"

Local on my machine I see with git log --oneline

881b9db (HEAD -> refs/heads/LogActivity, tag: refs/tags/1.0.6.17, refs/remotes/origin/LogActivity) Revert "remove Travis"
99dddbb (tag: refs/tags/1.0.6.15, tag: refs/tags/1.0.6.14) Attempt to fix release tag
27612c5 (tag: refs/tags/1.0.6.13) Attempt to fix release tag
c3bcdb8 (tag: refs/tags/1.0.6.12) Attempt to fix release tag
3c7ce1d (tag: refs/tags/1.0.6.11) LogActivity

on Github CI the output is this. At least the current commit is right 👍

881b9db Revert "remove Travis"
99dddbb Attempt to fix release tag
27612c5 Attempt to fix release tag
c3bcdb8 Attempt to fix release tag
3c7ce1d LogActivity

Local on my machine I see with git describe --abbrev=0

1.0.6.17

on Github CI the output is this

1.0.6.15

I verify the same command with Travis, and there it looks (expected) like my local machine.

Has someone an idea what's wrong here ?

@timfallmk
Copy link

It would seem v2 does not pull anything except the current tag. This is causing us problems as well.
Relevant code:

async fetch(refSpec: string[], fetchDepth?: number): Promise<void> {
const args = ['-c', 'protocol.version=2', 'fetch']
if (!refSpec.some(x => x === refHelper.tagsRefSpec)) {
args.push('--no-tags')
}

timfallmk pushed a commit to ksync/ksync that referenced this issue Jun 30, 2020
@timfallmk
Copy link

I failed at reading thoroughly. It seems this issue has already been addressed. I recommend using the suggestion in the readme.
https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches

@hannesa2
Copy link
Author

hannesa2 commented Jul 1, 2020

I failed at reading thoroughly. It seems this issue has already been addressed. I recommend using the suggestion in the readme.
https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches

Did you looked in my first post ? For me it looks like a bug

image

@hannesa2
Copy link
Author

hannesa2 commented Jul 1, 2020

    uses: actions/checkout@v2.3.1
    with:
      submodules: true
      fetch-depth: 0

Still shows wrong tag with git describe --abbrev=0

https://github.com/hannesa2/owncloud-android/pull/5/checks?check_run_id=825271697

It shows me 2.15.0.1 instead of 2.15.0.2. Local it shows me 2.15.0.2
image

image

@Stanzilla
Copy link

sounds related to #290

@jackjansen
Copy link

I have found a workaround: if you use git describe --tags then it will find the correct tag name.

I've done some experimentation but I have absolutely no idea why this workaround works. Interested parties can check cwi-dis/cwipc#21 for the details.

@hannesa2
Copy link
Author

Thank you. If I run into it again, I will reopen it.

dentarg added a commit to cloudamqp/amqproxy that referenced this issue May 8, 2023
"./build/release_notes" that does "git describe --abbrev=0" was not
seeing the correct tag when run in GitHub Actions so the release notes
had to be manually corrected on releases, hopefully this solves that

Found this tip at actions/checkout#272 (comment)

Seems related to actions/checkout#290
dentarg added a commit to cloudamqp/lavinmq that referenced this issue May 8, 2023
Seems like an issue with the checkout action: actions/checkout#290

Found this tip at actions/checkout#272 (comment)

[ci skip]
@louwers
Copy link

louwers commented Apr 30, 2024

git describe --tags --match=android-v*.*.* --abbrev=0 gives the wrong tag :(

Edit: For people coming here from Google: make sure to update to v4.

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

5 participants