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

get-latest-tag action not reporting latest tags correctly #1119

Open
venkatBala opened this issue Aug 24, 2022 · 6 comments
Open

get-latest-tag action not reporting latest tags correctly #1119

venkatBala opened this issue Aug 24, 2022 · 6 comments
Labels
bug Something isn't working priority / medium One of the priorities in a month

Comments

@venkatBala
Copy link
Contributor

Environment

Github action: actions-ecosystem/action-get-latest-tag@v1

What is happening?

the actions-ecosystem/action-get-latest-tag@v1 action at times yields the latest tag incorrectly (see the upstream issue actions-ecosystem/action-get-latest-tag#13).

For covalent, this mean sometime the changelog.yml get the incorrect latest git tag that causes further issues downstream when pushing the changes to main.

How can we reproduce the issue?

Happens occasionally, when merging a PR into develop that subsequently causes a merge to master

What should happen?

push_to_master step must fail

Any suggestions?

Do not use the get-latest-tag@v1 action instead revert to using the git command git describe --abbrev=0

@venkatBala venkatBala added the bug Something isn't working label Aug 24, 2022
@scottwn
Copy link
Contributor

scottwn commented Aug 24, 2022

git describe will have the same problem as action-get-latest-tag, in fact all the action does is git describe
https://github.com/actions-ecosystem/action-get-latest-tag/blob/b7c32daec3395a9616f88548363a42652b22d435/entrypoint.sh#L16

The right way to do this is to use the /tags API
https://docs.github.com/en/rest/repos/repos#list-repository-tags

@venkatBala
Copy link
Contributor Author

venkatBala commented Aug 24, 2022

@scottwn would this work

latest_tag=$(curl -H "Accept: application/vnd.github+json" https://api.github.com/repos/AgnostiqHQ/covalent/tags?per_page=1 | jq -r '.[0].name')

@scottwn
Copy link
Contributor

scottwn commented Aug 24, 2022

instead of curl, use request-action, like this

- name: Get commits
id: commits
uses: octokit/[email protected]
with:
route: "GET
/repos\
/${{ github.repository }}\
/compare\
/${{ steps.get-latest-tag.outputs.tag }}...${{ github.sha }}"

@scottwn
Copy link
Contributor

scottwn commented Aug 24, 2022

We may be able to stick with git describe
Another possible solution is to check for inequality rather than equality, so only do the push to master if the version is greater than, rather than not equal to
you can use compare-version to check the inequality https://www.npmjs.com/package/dpkg-compare-versions

@wjcunningham7
Copy link
Member

Summary of how this bug arose:

  • tests#4425 (bump to 184.2) timed out and did not create a tag or a release
  • tests#4440 (bump to 185.0) ran properly and correctly identified 184.1 as the most recent tag. a tag and release was created
  • changelog#389 ran properly and did not bump 185.0 since the commit was a docs-only change
  • tests#4446 (triggered by changelog#389) improperly identified 184.0 as the most recent tag in master and attempted to create a release

@scottwn scottwn added the priority / medium One of the priorities in a month label Aug 31, 2022
@scottwn scottwn mentioned this issue Sep 7, 2022
3 tasks
@jimmylism
Copy link

This PR should handle things better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority / medium One of the priorities in a month
Projects
None yet
Development

No branches or pull requests

4 participants