-
-
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
[Feature]: Add support for returning directory names if all files within the directory has been deleted #1595
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. |
Hi @AliaksandrRyzhou, is there a reason you are changing the default repository location by setting? path: ${{ env.CHARTS_DIRECTORY }} |
I’ll also point out that you don’t need two different steps to detect deleted and changed files. - name: Get changed directories
id: changed-files
uses: tj-actions/changed-files@v39
with:
dir_names: true
dir_names_max_depth: 1
dir_names_exclude_current_dir: true
path: ${{ env.CHARTS_DIRECTORY }}
json: true
output_renamed_files_as_deleted_and_added: true
quotepath: false
# Not required
- name: Get deleted directories
id: deleted-directories
uses: tj-actions/changed-files@v39
with:
dir_names: true
dir_names_max_depth: 1
dir_names_exclude_current_dir: true
path: ${{ env.CHARTS_DIRECTORY }}
json: true
output_renamed_files_as_deleted_and_added: true
quotepath: false |
Hi @jackton1, yes. I have to monitor only this folder and receive the folder names from it. To be fair I tried to change |
I know that I can get it in one step but in this case, I can't make restrictions where I'd like to see changes with options |
The directory output is based on the files in the folder when you use the |
This would be a feature request as opposed to a bug since you mentioned that you only want to consider deletion of the entire folder as the requirement to return and of the directories themselves. And the second case of not considering a deletion of the folder when returning a list of the modified directories. |
Do you mean |
I mean the The All patterns that are provided via the |
First step
Second step
@AliaksandrRyzhou In the case of the second step you don't need to set the The first step in this case needs to be a new option to only return the directory name if all files within the folder have been deleted as opposed to if any file within the folder was deleted. |
Is there an existing issue for this?
Does this issue exist in the latest version?
Describe the bug?
Inputs
files
andfiles_ignore
don't work as expected. I want to create different matrixes, depending onall_modified_files
anddeleted_files
.To Reproduce
I use the following workflow (Inputs
files
andfiles_ignore
I will add bellow):With this folder structure, it's a content of charts folder :
What OS are you seeing the problem on?
ubuntu-latest or ubuntu-22.04
Expected behavior?
The idea is to get output
deleted_files
in JSON which contains folders[\"chart1\",\"chart2\",\"chart3\"]
only if these folders are deleted at all. It's very important to exclude any deletions and changes inside these folders because if it works wrong my workflow will delete a working chart.Also, in the second step, I want to get
all_modified_files
in JSON which contains folders inside of which any changes were. Added, copied, modified, renamed, and deleted files. In this step is very important to not receive a folder if it was deleted at all.Honestly, I tried about 100 options, with verification at codepen and more successful ones, which are not described bellow because I no longer remember them. The main thing is to get the result so that the deletion matrix contains only folders in the charts directory and only if these folders were deleted themselves. The update matrix received a list of charts in which something was changed but did not receive folders from the root charts directory.
1. This case shows nothing when I change one file within chart1, chart2, and chart3 folders. The same thing if I delete some folder, for example, chart3.
Logs
"matrix_upgrade={"charts_upgrade":[]}" >> "$GITHUB_OUTPUT"
"matrix_delete={"charts_delete":[]}" >> "$GITHUB_OUTPUT"
2. This case shows nothing when I change one file within chart1, chart2, and chart3 folders. The same thing if I delete some folder, for example, chart3.
Logs
"matrix_upgrade={"charts_upgrade":[]}" >> "$GITHUB_OUTPUT"
"matrix_delete={"charts_delete":[]}" >> "$GITHUB_OUTPUT"
3. This case shows nothing when I change one file within chart1, chart2, and chart3 folders. The same thing if I delete some folder, for example, chart3.
Logs
"matrix_upgrade={"charts_upgrade":[]}" >> "$GITHUB_OUTPUT"
"matrix_delete={"charts_delete":[]}" >> "$GITHUB_OUTPUT"
4. This case shows the correct matrix if we change the files within any folder but if we delete the folder it will show nothing for matrix_delete and will show the changes in matrix_upgrade.
Logs
Files was changed in chart1, chart2, and chart3 folders (correct!):
"matrix_upgrade={"charts_upgrade":["chart3","chart1","chart2"]}" >> "$GITHUB_OUTPUT"
"matrix_delete={"charts_delete":[]}" >> "$GITHUB_OUTPUT"
Folder chart3 was deleted (wrong!):
"matrix_upgrade={"charts_upgrade":["chart3"]}" >> "$GITHUB_OUTPUT"
"matrix_delete={"charts_delete":[]}" >> "$GITHUB_OUTPUT"
5. This case shows the correct matrix if we change the files within any folder and now, if we delete the folder it will show the deleted folder in matrix_delete and will show the changes in matrix_upgrade.
Logs
Files was changed in chart1, chart2, and chart3 folders (correct!):
"matrix_upgrade={"charts_upgrade":["chart3","chart1","chart2"]}" >> "$GITHUB_OUTPUT"
"matrix_delete={"charts_delete":[]}" >> "$GITHUB_OUTPUT"
Folder chart3 was deleted, now we can see the correct matrix for the deletion but also we still see the wrong result for matrix_upgrade (wrong!):
"matrix_upgrade={"charts_upgrade":["chart3"]}" >> "$GITHUB_OUTPUT"
"matrix_delete={"charts_delete":["chart3"]}" >> "$GITHUB_OUTPUT"
I deleted one file in folder chart1 (for matrix_delete result is wrong!):
"matrix_upgrade={"charts_upgrade":["chart1"]}" >> "$GITHUB_OUTPUT"
"matrix_delete={"charts_delete":["chart1"]}" >> "$GITHUB_OUTPUT"
Relevant log output
Log files:
case1.zip
case2.zip
case3.zip
case4-changed-files-in-all-folders.zip
case4-deleted-one folder.zip
case5-changed-files-in-all-folders.zip
case5-deleted-one folder.zip
case5-deleted-one-file-in-chart1-folder.zip
Has all relevant logs been included?
Anything else?
Code of Conduct
The text was updated successfully, but these errors were encountered: