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] PREVIOUS_SHA & CURRENT_SHA is the same when re-running a workflow, causing changed-files to be empty #547
Comments
Thanks for reporting this issue, don't forget to star this project to help us reach a wider audience. |
@YossiSaadi can you include screenshots from the checkout and the changed-files actions. Example: #548 (comment) Also, it would be helpful if you Included your current setup of the checkout action and changed-files action. Thanks. Example:on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest # windows-latest | macos-latest
name: Test changed-files
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v23.1 |
Thanks for the super fast reply @jackton1 ! 1st attempt2nd attemptworkflow file
Don't mind the amount of checks, it's a wip :) |
@YossiSaadi from the workflow file above I see that you're missing the I think the best solution for this would be to compare the commit hashes and raise an exception if they are the same which appears to be the case when the local copy only has at most 1 commit history. Proposed solutionChange - name: Checkout
uses: actions/checkout@v3 To - name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
|
@jackton1 it seems by the logs that checkout does its job properly and checkout to a ref as it should, same result as on first attempt. Can it still be the reason? |
@YossiSaadi This should be resolved in the latest release v23.2 |
Thank you so much, I really appreciate the effort and the quick reply 🙏🏻😎 |
Your welcome |
Is there an existing issue for this?
Does this issue exist in the latest version?
Describe the bug?
Action works great when running the workflow in the first attempt, but on the 2nd attempt and next, INPUT_PREVIOUS_SHA & INPUT_CURRENT_SHA are the same
This causes the changed-files to be empty.
So on 1st attempt, the checkout ref (of GH's Checkout action) is considered as the INPUT_CURRENT_SHA, and the real commit is INPUT_PREVIOUS_SHA.
on 2nd+ attempt, the checkout ref is considered as the INPUT_CURRENT_SHA, and INPUT_PREVIOUS_SHA is also this checkout ref.
This of course means that if we compare diff of same commit, any_modified would return false 😟
To Reproduce
What OS are you seeing the problem on?
ubuntu-latest or ubuntu-20.04
Expected behavior?
any_modified should still be true if on 1st attempt it was true (and of course false if it was false on 1st attempt)
Relevant log output
Anything else?
I think that it only happens for pull_request_review event
Code of Conduct
The text was updated successfully, but these errors were encountered: