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

[BUG] Re-running a workflow triggered by a tag event causes the wrong previous tag to be selected #2106

Closed
4 tasks done
ptab opened this issue May 23, 2024 · 3 comments · Fixed by #2107
Closed
4 tasks done
Labels
bug Something isn't working

Comments

@ptab
Copy link

ptab commented May 23, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Does this issue exist in the latest version?

  • I'm using the latest release

Describe the bug?

I have a workflow running on every tag push event that checks out the repository and lists files changed since the previous tag. This works perfectly for every new tag created, but if I choose to Re-run all jobs after new tags have been created, this action gets confused and seems to select the tag before HEAD rather than the one before the tag the event relates to.

To Reproduce

I created a repository showcasing this behaviour:

All tags were created using:

git tag vN <sha> && git push --tags

without any modification to the workflow in between.

On the logs of the workflow run for v2 you can see the output:

▸ Run tj-actions/changed-files@v44
▾ changed-files
  Using local .git directory
  Running on a push event...
  Retrieving changes between 5fa889e211f60f32d67ebc736fa8c4d9349eee75 (v1) → a941b77e83c28cf99e0fdacbc4c9cff4c17f9034 (v2)
  All Done!

After new tags were created, I selected Re-run all jobs and I got the following different output:

▸ Run tj-actions/changed-files@v44
▾ changed-files
  Using local .git directory
  Running on a push event...
  Retrieving changes between 2c6e163d9e9b97c388152308ff4c2c98283c5110 (v3) → a941b77e83c28cf99e0fdacbc4c9cff4c17f9034 (v2)
  All Done!

(The previous tag is now one in the future)

Nothing else changed between runs, other than new tags being pushed.

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-22.04

Expected behavior?

Re-running a workflow should select the same previous tag.

Relevant log output

/usr/bin/git rev-parse --is-inside-work-tree
  true
  ##[debug]Has git directory: true
  ##[debug]Input file patterns: 
  ##[debug]
  ##[debug]File patterns: 
  ##[debug]Yaml file patterns: {}
  Using local .git directory
  /usr/bin/git --version
  git version 2.45.1
  /usr/bin/git config --global core.quotepath on
  /usr/bin/git config --global diff.relative true
  /usr/bin/git rev-parse --is-shallow-repository
  false
  /usr/bin/git submodule status
  Running on a push event...
  ##[debug]Getting current SHA...
  /usr/bin/git rev-parse HEAD
  a941b77e83c28cf99e0fdacbc4c9cff4c17f9034
  /usr/bin/git rev-parse --verify a941b77e83c28cf99e0fdacbc4c9cff4c17f9034^{commit}
  a941b77e83c28cf99e0fdacbc4c9cff4c17f9034
  ##[debug]Current SHA: a941b77e83c28cf99e0fdacbc4c9cff4c17f9034
  /usr/bin/git rev-parse --abbrev-ref HEAD
  HEAD
  ##[debug]Getting previous SHA...
  ##[debug]Getting previous SHA for tag...
  /usr/bin/git tag --sort=-creatordate
  v4
  v3
  v2
  v1
  /usr/bin/git rev-parse v3
  2c6e163d9e9b97c388152308ff4c2c98283c5110
  /usr/bin/git rev-parse --verify 2c6e163d9e9b97c388152308ff4c2c98283c5110^{commit}
  2c6e163d9e9b97c388152308ff4c2c98283c5110
  ##[debug]Previous SHA: 2c6e163d9e9b97c388152308ff4c2c98283c5110
  ##[debug]Target branch: v3
  ##[debug]Current branch: v2
  Retrieving changes between 2c6e163d9e9b97c388152308ff4c2c98283c5110 (v3) → a941b77e83c28cf99e0fdacbc4c9cff4c17f9034 (v2)

Has all relevant logs been included?

  • I've included all relevant logs

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@ptab ptab added the bug Something isn't working label May 23, 2024
@tj-actions-bot
Copy link
Contributor

Thanks for reporting this issue, don't forget to star this project if you haven't already to help us reach a wider audience.

@jackton1
Copy link
Member

jackton1 commented May 24, 2024

Hi @ptab this should be resolved in the latest release. You can re-run the same workflow or run an entirely new workflow.

@ptab
Copy link
Author

ptab commented May 24, 2024

I can confirm that this release solves the issue, thanks for the quick fix @jackton1!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants