Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
300e935beb | ||
|
|
d188a8e7a1 | ||
|
|
5653483733 | ||
|
|
bdd3bf886a | ||
|
|
a0301e7e4d | ||
|
|
23c8cafe35 | ||
|
|
8a7dfe02e7 | ||
|
|
c7eb6e4282 | ||
|
|
40dc6382c6 | ||
|
|
fd5dd8e5ad | ||
|
|
d6f3673f2e | ||
|
|
9864173ab1 | ||
|
|
2bcefe21d5 |
27
HISTORY.md
27
HISTORY.md
@@ -1,5 +1,27 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [v4.3](https://github.com/tj-actions/changed-files/tree/v4.3) (2021-05-01)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v4.2...v4.3)
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- fatal error when using @v4.2 [\#28](https://github.com/tj-actions/changed-files/issues/28)
|
||||||
|
|
||||||
|
**Closed issues:**
|
||||||
|
|
||||||
|
- Dependency Dashboard [\#27](https://github.com/tj-actions/changed-files/issues/27)
|
||||||
|
- Add support for watching a subset of files. [\#20](https://github.com/tj-actions/changed-files/issues/20)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Add support to filter only specific files [\#31](https://github.com/tj-actions/changed-files/pull/31) ([jackton1](https://github.com/jackton1))
|
||||||
|
- Bump tj-actions/sync-release-version from v8 to v8.5 [\#30](https://github.com/tj-actions/changed-files/pull/30) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||||
|
- Upgrade to GitHub-native Dependabot [\#29](https://github.com/tj-actions/changed-files/pull/29) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
||||||
|
- Update tj-actions/github-changelog-generator action to v1.6 [\#26](https://github.com/tj-actions/changed-files/pull/26) ([renovate[bot]](https://github.com/apps/renovate))
|
||||||
|
- Update README.md [\#25](https://github.com/tj-actions/changed-files/pull/25) ([jackton1](https://github.com/jackton1))
|
||||||
|
- Upgraded to v4.2 [\#24](https://github.com/tj-actions/changed-files/pull/24) ([jackton1](https://github.com/jackton1))
|
||||||
|
|
||||||
## [v4.2](https://github.com/tj-actions/changed-files/tree/v4.2) (2021-04-23)
|
## [v4.2](https://github.com/tj-actions/changed-files/tree/v4.2) (2021-04-23)
|
||||||
|
|
||||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v4.1...v4.2)
|
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v4.1...v4.2)
|
||||||
@@ -67,12 +89,15 @@
|
|||||||
- Configure Renovate [\#9](https://github.com/tj-actions/changed-files/pull/9) ([renovate[bot]](https://github.com/apps/renovate))
|
- Configure Renovate [\#9](https://github.com/tj-actions/changed-files/pull/9) ([renovate[bot]](https://github.com/apps/renovate))
|
||||||
- Update test.yml [\#8](https://github.com/tj-actions/changed-files/pull/8) ([jackton1](https://github.com/jackton1))
|
- Update test.yml [\#8](https://github.com/tj-actions/changed-files/pull/8) ([jackton1](https://github.com/jackton1))
|
||||||
- Upgraded to v2.1 [\#6](https://github.com/tj-actions/changed-files/pull/6) ([jackton1](https://github.com/jackton1))
|
- Upgraded to v2.1 [\#6](https://github.com/tj-actions/changed-files/pull/6) ([jackton1](https://github.com/jackton1))
|
||||||
- Upgraded to v2 [\#5](https://github.com/tj-actions/changed-files/pull/5) ([jackton1](https://github.com/jackton1))
|
|
||||||
|
|
||||||
## [v2.1](https://github.com/tj-actions/changed-files/tree/v2.1) (2021-03-18)
|
## [v2.1](https://github.com/tj-actions/changed-files/tree/v2.1) (2021-03-18)
|
||||||
|
|
||||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v2...v2.1)
|
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v2...v2.1)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Upgraded to v2 [\#5](https://github.com/tj-actions/changed-files/pull/5) ([jackton1](https://github.com/jackton1))
|
||||||
|
|
||||||
## [v2](https://github.com/tj-actions/changed-files/tree/v2) (2021-03-14)
|
## [v2](https://github.com/tj-actions/changed-files/tree/v2) (2021-03-14)
|
||||||
|
|
||||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v1...v2)
|
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v1...v2)
|
||||||
|
|||||||
52
README.md
52
README.md
@@ -6,6 +6,14 @@ changed-files
|
|||||||
Get all modified files relative to the default branch or preceding commit.
|
Get all modified files relative to the default branch or preceding commit.
|
||||||
|
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- List all files that have changed .
|
||||||
|
- List only a subset of files that can be used to detect changes.
|
||||||
|
- Report on a subset of files that have all change.
|
||||||
|
- Report on a subset of files that have at least one file change.
|
||||||
|
- Regex pattern matching on a subset of files.
|
||||||
|
|
||||||
|
|
||||||
## Outputs
|
## Outputs
|
||||||
|
|
||||||
Using the default separator.
|
Using the default separator.
|
||||||
@@ -25,7 +33,7 @@ Using the default separator.
|
|||||||
| Output | type | example | description |
|
| Output | type | example | description |
|
||||||
|:-------------------:|:------------:|:------------------------------:|:----------------------------------------:|
|
|:-------------------:|:------------:|:------------------------------:|:----------------------------------------:|
|
||||||
| all_modified_files | `string` | 'new.txt other.png ...' | Select all modified files <br /> *i.e a combination of all added, <br />copied and modified files (ACM).* |
|
| all_modified_files | `string` | 'new.txt other.png ...' | Select all modified files <br /> *i.e a combination of all added, <br />copied and modified files (ACM).* |
|
||||||
| has_changed | `string` | `true OR false` | Returns `true` only when the filenames provided using `files` input have all changed |
|
| all_changed | `string` | `true OR false` | Returns `true` only when the filenames provided using `files` input have all changed |
|
||||||
| all_changed_files | `string` | 'new.txt other.png ...' | Select all paths (*) <br /> *i.e a combination of all options below.* |
|
| all_changed_files | `string` | 'new.txt other.png ...' | Select all paths (*) <br /> *i.e a combination of all options below.* |
|
||||||
| added_files | `string` | 'new.txt other.png ...' | Select only files that are Added (A) |
|
| added_files | `string` | 'new.txt other.png ...' | Select only files that are Added (A) |
|
||||||
| copied_files | `string` | 'new.txt other.png ...' | Select only files that are Copied (C) |
|
| copied_files | `string` | 'new.txt other.png ...' | Select only files that are Copied (C) |
|
||||||
@@ -74,7 +82,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Get changed files
|
- name: Get changed files
|
||||||
id: changed-files
|
id: changed-files
|
||||||
uses: tj-actions/changed-files@v4.2
|
uses: tj-actions/changed-files@v4.3
|
||||||
|
|
||||||
- name: List all modified files
|
- name: List all modified files
|
||||||
run: |
|
run: |
|
||||||
@@ -92,11 +100,11 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Get changed files using defaults
|
- name: Get changed files using defaults
|
||||||
id: changed-files
|
id: changed-files
|
||||||
uses: tj-actions/changed-files@v4.2
|
uses: tj-actions/changed-files@v4.3
|
||||||
|
|
||||||
- name: Get changed files using a comma separator
|
- name: Get changed files using a comma separator
|
||||||
id: changed-files-comma
|
id: changed-files-comma
|
||||||
uses: tj-actions/changed-files@v4.2
|
uses: tj-actions/changed-files@v4.3
|
||||||
with:
|
with:
|
||||||
separator: ","
|
separator: ","
|
||||||
|
|
||||||
@@ -109,13 +117,30 @@ jobs:
|
|||||||
- name: Run step when a file changes
|
- name: Run step when a file changes
|
||||||
if: contains(steps.changed-files.outputs.modified_files, 'my-file.txt')
|
if: contains(steps.changed-files.outputs.modified_files, 'my-file.txt')
|
||||||
run: |
|
run: |
|
||||||
echo "Your file my-file.txt has been modified."
|
echo "Your file my-file.txt has been modified."
|
||||||
|
|
||||||
- name: Run step when a file has been deleted
|
- name: Run step when a file has been deleted
|
||||||
if: contains(steps.changed-files.outputs.deleted_files, 'test.txt')
|
if: contains(steps.changed-files.outputs.deleted_files, 'test.txt')
|
||||||
run: |
|
run: |
|
||||||
echo "Your test.txt has been deleted."
|
echo "Your test.txt has been deleted."
|
||||||
|
|
||||||
|
- name: Get specific changed files
|
||||||
|
id: changed-files-specific
|
||||||
|
uses: tj-actions/changed-files@v4.2
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
my-file.txt
|
||||||
|
test.txt
|
||||||
|
new.txt
|
||||||
|
test_directory
|
||||||
|
.(py|jpeg)$
|
||||||
|
.(sql)$
|
||||||
|
^(mynewfile|custom)
|
||||||
|
|
||||||
|
- name: Run step if all files listed above have changed
|
||||||
|
if: steps.changed-files-specific.outputs.all_changed
|
||||||
|
run: |
|
||||||
|
echo "Both my-file.txt and test.txt have changed."
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -130,7 +155,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Get changed files
|
- name: Get changed files
|
||||||
id: changed-files
|
id: changed-files
|
||||||
uses: tj-actions/changed-files@v4.2
|
uses: tj-actions/changed-files@v4.3
|
||||||
|
|
||||||
- name: Pre-commit
|
- name: Pre-commit
|
||||||
uses: pre-commit/action@v2.0.0
|
uses: pre-commit/action@v2.0.0
|
||||||
@@ -151,19 +176,6 @@ jobs:
|
|||||||
* Free software: [MIT license](LICENSE)
|
* Free software: [MIT license](LICENSE)
|
||||||
|
|
||||||
|
|
||||||
Features
|
|
||||||
--------
|
|
||||||
- Added Files
|
|
||||||
- Copied Files
|
|
||||||
- Deleted Files
|
|
||||||
- Modified Files
|
|
||||||
- Renamed Files
|
|
||||||
- Changed Files
|
|
||||||
- Unmerged Files
|
|
||||||
- Unknown Files
|
|
||||||
- All Changed Files
|
|
||||||
|
|
||||||
|
|
||||||
Credits
|
Credits
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|||||||
53
action.yml
53
action.yml
@@ -42,9 +42,12 @@ outputs:
|
|||||||
all_modified_files:
|
all_modified_files:
|
||||||
description: List of all copied modified and added files
|
description: List of all copied modified and added files
|
||||||
value: ${{ steps.changed_files.outputs.all_modified_files }}
|
value: ${{ steps.changed_files.outputs.all_modified_files }}
|
||||||
has_changed:
|
all_changed:
|
||||||
description: Return true only when all files provided using the files input have all changed.
|
description: Return true only when all files provided using the files input have all changed.
|
||||||
value: ${{ steps.changed_files.outputs.has_changed }}
|
value: ${{ steps.changed_files.outputs.all_changed }}
|
||||||
|
any_changed:
|
||||||
|
description: Return true only when any files provided using the files input have changed.
|
||||||
|
value: ${{ steps.changed_files.outputs.any_changed }}
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'composite'
|
using: 'composite'
|
||||||
@@ -77,18 +80,6 @@ runs:
|
|||||||
UNKNOWN=$(git diff --diff-filter=X --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
UNKNOWN=$(git diff --diff-filter=X --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
||||||
ALL_CHANGED=$(git diff --diff-filter='*ACDMRTUX' --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
ALL_CHANGED=$(git diff --diff-filter='*ACDMRTUX' --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
||||||
ALL_MODIFIED_FILES=$(git diff --diff-filter='ACM' --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
ALL_MODIFIED_FILES=$(git diff --diff-filter='ACM' --name-only "$HEAD_SHA" | tr "\n" "${{ inputs.separator }}" | sed -E 's/(${{ inputs.separator }})$//')
|
||||||
|
|
||||||
echo "::set-output name=added_files::$ADDED"
|
|
||||||
echo "::set-output name=copied_files::$COPIED"
|
|
||||||
echo "::set-output name=deleted_files::$DELETED"
|
|
||||||
echo "::set-output name=modified_files::$MODIFIED"
|
|
||||||
echo "::set-output name=renamed_files::$RENAMED"
|
|
||||||
echo "::set-output name=changed_files::$CHANGED"
|
|
||||||
echo "::set-output name=unmerged_files::$UNMERGED"
|
|
||||||
echo "::set-output name=unknown_files::$UNKNOWN"
|
|
||||||
echo "::set-output name=all_changed_files::$ALL_CHANGED"
|
|
||||||
echo "::set-output name=all_modified_files::$ALL_MODIFIED_FILES"
|
|
||||||
|
|
||||||
else
|
else
|
||||||
ADDED=()
|
ADDED=()
|
||||||
COPIED=()
|
COPIED=()
|
||||||
@@ -130,26 +121,32 @@ runs:
|
|||||||
OUTPUT_ALL_MODIFIED_FILES=$(echo $ALL_MODIFIED_FILES | sed "s/${{ inputs.separator }}/ /g")
|
OUTPUT_ALL_MODIFIED_FILES=$(echo $ALL_MODIFIED_FILES | sed "s/${{ inputs.separator }}/ /g")
|
||||||
ALL_INPUT_FILES=$(echo $INPUT_FILES | sed "s/\n/ /g")
|
ALL_INPUT_FILES=$(echo $INPUT_FILES | sed "s/\n/ /g")
|
||||||
|
|
||||||
IFS=$'\n' SORTED_INPUT_FILES=($(sort <<<"${ALL_INPUT_FILES[*]}"))
|
IFS=$' ' SORTED_INPUT_FILES=($(sort <<<"${ALL_INPUT_FILES[*]}"))
|
||||||
IFS=$'\n' SORTED_OUTPUT_ALL_MODIFIED_FILES=($(sort <<<"${OUTPUT_ALL_MODIFIED_FILES[*]}"))
|
IFS=$' ' SORTED_OUTPUT_ALL_MODIFIED_FILES=($(sort <<<"${OUTPUT_ALL_MODIFIED_FILES[*]}"))
|
||||||
|
|
||||||
if [[ "${SORTED_INPUT_FILES[*]}" == "${SORTED_OUTPUT_ALL_MODIFIED_FILES[*]}" ]]; then
|
if [[ "${SORTED_INPUT_FILES[*]}" == "${SORTED_OUTPUT_ALL_MODIFIED_FILES[*]}" ]]; then
|
||||||
echo "::set-output name=has_changed::true"
|
echo "::set-output name=all_changed::true"
|
||||||
else
|
else
|
||||||
echo "::set-output name=has_changed::false"
|
echo "::set-output name=all_changed::false"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "::set-output name=added_files::$ADDED"
|
if [[ ${#SORTED_OUTPUT_ALL_MODIFIED_FILES[@]} -gt 0 ]]; then
|
||||||
echo "::set-output name=copied_files::$COPIED"
|
echo "::set-output name=any_changed::true"
|
||||||
echo "::set-output name=deleted_files::$DELETED"
|
else
|
||||||
echo "::set-output name=modified_files::$MODIFIED"
|
echo "::set-output name=any_changed::false"
|
||||||
echo "::set-output name=renamed_files::$RENAMED"
|
fi
|
||||||
echo "::set-output name=changed_files::$CHANGED"
|
|
||||||
echo "::set-output name=unmerged_files::$UNMERGED"
|
|
||||||
echo "::set-output name=unknown_files::$UNKNOWN"
|
|
||||||
echo "::set-output name=all_changed_files::$ALL_CHANGED"
|
|
||||||
echo "::set-output name=all_modified_files::$ALL_MODIFIED_FILES"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "::set-output name=added_files::$ADDED"
|
||||||
|
echo "::set-output name=copied_files::$COPIED"
|
||||||
|
echo "::set-output name=deleted_files::$DELETED"
|
||||||
|
echo "::set-output name=modified_files::$MODIFIED"
|
||||||
|
echo "::set-output name=renamed_files::$RENAMED"
|
||||||
|
echo "::set-output name=changed_files::$CHANGED"
|
||||||
|
echo "::set-output name=unmerged_files::$UNMERGED"
|
||||||
|
echo "::set-output name=unknown_files::$UNKNOWN"
|
||||||
|
echo "::set-output name=all_changed_files::$ALL_CHANGED"
|
||||||
|
echo "::set-output name=all_modified_files::$ALL_MODIFIED_FILES"
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
branding:
|
branding:
|
||||||
|
|||||||
Reference in New Issue
Block a user