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

Version strings generated in github actions workflows are incorrect #21

Closed
jackjansen opened this issue Jul 14, 2022 · 3 comments
Closed
Assignees

Comments

@jackjansen
Copy link
Contributor

The github actions checkout workflow makes git describe misbehave. Specifically, when I am at tag v7.3.5, with sha 4db202a then the git describe output is v7.3.4-1-g4db202a. That is also a correct description, but v7.3.5 is really the correct one.

This is probably due to actions/checkout#272 (which is also referenced by various other projects that are running into this issue).

Running git log doesn't show anything wrong. Tried with checkout v3 and v2. fetch-depth has been set to 0.

There is one funny thing in the actions/checkout output: there is a call of /usr/bin/git rev-parse refs/tags/v7.3.5 which produces the SHA 46bee472f441d8030bd6e485f077e53f1dc26440, which is not the same as 4db202ad3831b9a33aa86f347ddd84f5ba17d754. The latter is the SHA as it is in the origin repo (and in local checkouts).

Need to investigate more, possibly by locally repeating everything github checkout action does.

@jackjansen jackjansen self-assigned this Jul 14, 2022
@jackjansen
Copy link
Contributor Author

jackjansen commented Jul 14, 2022

Tried locally (on the machine where I actually did the tag).

git rev-parse behaves exacly as on the action runner, it gives 46bee472f441d8030bd6e485f077e53f1dc26440.

When I git checkout 46bee472f441d8030bd6e485f077e53f1dc26440 or git checkout v7.3.5 or git checkout 4db202ad3831b9a33aa86f347ddd84f5ba17d754 I end up at SHA 4db202ad3831b9a33aa86f347ddd84f5ba17d754 in all three cases, and git describe returns v7.3.5 in all cases. So that is different from how things are in the action runner.

@jackjansen
Copy link
Contributor Author

Hmm, from https://stackoverflow.com/questions/66913267/wrong-commit-hash-with-git-rev-parse-tag it seems that the SHA returned by git rev-parse is for the annotated tag object. And, indeed, git rev-parse refs/tags/v7.3.5^{} returns the SHA of the commit, 4db202ad3831b9a33aa86f347ddd84f5ba17d754.

So now the question is: if the github action does the checkout by commit SHA, why does git describe not see the annotated tag that is hanging off it?

@jackjansen
Copy link
Contributor Author

There is a workaround: if I use git describe --tags then it does find the tag. Using that for now, and will report in actions/checkout#272

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

1 participant