-
-
Notifications
You must be signed in to change notification settings - Fork 176
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] all_old_new_renamed_files Gets all files renamed files from history #1030
Comments
Thanks for reporting this issue, don't forget to star this project if you haven't already to help us reach a wider audience. |
May be similar to #972 but already using latest version. |
@twcchu Curious are you making the changes (rename) in a PR that hasn't been merged into the base branch? Example
|
I assume you are trying to get the renamed file for the last change i.e
Which would output
To achieve this you can ideally compare the last remote commit to the current commit which included the rename from example2.tfvars back to example.tfvars - name: Get Changed tfvars Files
id: files
uses: tj-actions/changed-files@v35.7.1
with:
files: deploys/*.tfvars
include_all_old_new_renamed_files: true
since_last_remote_commit: true # NOTE: Without this setting, the diff is always performed between the target branch and the PR branch which is why you see the entire history of previously used names. Let me know if you run into any other issue |
This branch was previously merged with main and is up to date with the main branch.
I am trying to get the renamed file compared to main so the |
I merged the previous PR into main and created a new PR renaming the file from
It shows that Relevant debug output:
|
@twcchu Given that there are missing information to debug this I’ll recommend creating a public repository which replicates the issue with a minimal setup. I’ll reopen this issue and take a look once it’s setup. Thanks |
I have created a repository to replicate the issue: twcchu/get-renamed-files#1 |
I changed the name of
The expected output should be:
|
@twcchu I believe the output is correct since the git diff is between the main (target) branch and the current commit which includes all renames that have happened even if it occurred to the same file. Is there a particular reason why you want to exclude the rename from the output ? |
@jackton1 The output is including name changes from previous commits already merged into main. See second test PR: (twcchu/get-renamed-files#2). The reason we need both the old and new names of just the files updated in the current PR is because we are updating the names of Terraform Workspaces and we need both the old and new names. Including the names of previous PRs causes errors because the TF Workspaces are already renamed and can not be found. |
@twcchu I was able to replicate this, I'll work on pushing out the fix |
@twcchu This should now be available in the latest release |
Great! Thank you! |
Is there an existing issue for this?
Does this issue exist in the latest version?
Describe the bug?
When getting
all_old_new_renamed_files
, a list of all previous renamed files is listed, even though the changes have been pushed to main.To Reproduce
Beginning File Structure:
example.tfvars
toexample2.tfvars
example2.tfvars
toexample.tfvars
and run ActionWhat OS are you seeing the problem on?
ubuntu-latest or ubuntu-20.04
Expected behavior?
Step 3:
Step 5:
Relevant log output
changed-files Retrieving changes between ### (main) → ### (PLAT)
Anything else?
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: