Added support for detecting deleted files. (#188)

This commit is contained in:
Tonye Jack
2021-09-05 08:22:47 -04:00
committed by GitHub
parent 81037a4f7b
commit 5e2a2f1923
4 changed files with 125 additions and 14 deletions

View File

@@ -83,6 +83,8 @@ jobs:
|:--------------------:|:------------:|:----------------------------------:|:----------------------------------------:|
| any_changed | `string` | `true` OR `false` | Returns `true` when any <br /> of the filenames provided using <br /> the `files` input has changed. <br /> i.e. *using a combination of all added, <br />copied, modified and renamed files (ACMR).* |
| only_changed | `string` | `true` OR `false` | Returns `true` when only <br /> files provided using <br /> the `files` input have changed. |
| any_deleted | `string` | `true` OR `false` | Returns `true` when any <br /> of the filenames provided using <br /> the `files` input has been deleted. |
| only_deleted | `string` | `true` OR `false` | Returns `true` when only <br /> files provided using <br /> the `files` input has been deleted. |
| other_changed_files | `string` | `'new.txt path/to/file.png ...'` | Select all other changed files <br/> not listed in the files input <br /> i.e. *a combination of all added, <br /> copied and modified files (ACMR).* |
| all_modified_files | `string` | `'new.txt path/to/file.png ...'` | Select all modified files <br /> i.e. *a combination of all added, <br />copied, modified and renamed files (ACMR).* |
| all_changed_and_modified_files | `string` | `'new.txt path/to/file.png ...'` | Select all changed <br /> and modified files <br /> i.e. *a combination of (ACMRDTUX).* |
@@ -164,6 +166,20 @@ jobs:
run: |
echo "Only files listed above have changed."
- name: Run step if any of the listed files above is deleted
if: steps.changed-files.outputs.any_deleted == "true"
run: |
for file in "${{ steps.changed-files.outputs.deleted_files }}"; do
echo "$file was deleted"
done
- name: Run step if all listed files above have been deleted
if: steps.changed-files.outputs.only_deleted == "true"
run: |
for file in "${{ steps.changed-files.outputs.deleted_files }}"; do
echo "$file was deleted"
done
- name: Use a source file or list of file(s) to populate to files input.
id: changed-files-specific-source-file
uses: tj-actions/changed-files@v1.1.0
@@ -203,7 +219,6 @@ jobs:
uses: tj-actions/changed-files@v1.1.0
with:
path: subfolder
```
### Running [pre-commit](https://pre-commit.com/) on all modified files