Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c6f276ea5 | ||
|
|
cb4914b39a |
20
.github/workflows/test.yml
vendored
20
.github/workflows/test.yml
vendored
@@ -198,3 +198,23 @@ jobs:
|
||||
echo "${{ toJSON(steps.changed-files-custom-base-sha.outputs) }}"
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with specific files (only-changed)
|
||||
id: changed-files-specific-only-changed
|
||||
uses: ./
|
||||
with:
|
||||
files: |
|
||||
.github/workflows/test.yml
|
||||
- name: Verify only_changed files
|
||||
if: steps.changed-files-specific-only-changed.outputs.other_changed_files != ''
|
||||
run: |
|
||||
if [[ "${{ steps.changed-files-specific-only-changed.outputs.only_changed }}" != "false" ]]; then
|
||||
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-only-changed.outputs.only_changed }})"
|
||||
exit 1
|
||||
fi
|
||||
shell:
|
||||
bash
|
||||
- name: Show output
|
||||
run: |
|
||||
echo "${{ toJSON(steps.changed-files-specific-only-changed.outputs) }}"
|
||||
shell:
|
||||
bash
|
||||
|
||||
13
HISTORY.md
13
HISTORY.md
@@ -1,5 +1,18 @@
|
||||
# Changelog
|
||||
|
||||
## [v8.7](https://github.com/tj-actions/changed-files/tree/v8.7) (2021-07-17)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v8.6...v8.7)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- \[Feature\] Get Changed files since last successful Action run [\#131](https://github.com/tj-actions/changed-files/issues/131)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Added support for a custom base sha. [\#135](https://github.com/tj-actions/changed-files/pull/135) ([jackton1](https://github.com/jackton1))
|
||||
- Upgraded to v8.6 [\#134](https://github.com/tj-actions/changed-files/pull/134) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v8.6](https://github.com/tj-actions/changed-files/tree/v8.6) (2021-07-17)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v8.5...v8.6)
|
||||
|
||||
22
README.md
22
README.md
@@ -55,7 +55,7 @@ jobs:
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v8.6
|
||||
uses: tj-actions/changed-files@v8.7
|
||||
|
||||
- name: List all modified files
|
||||
run: |
|
||||
@@ -79,7 +79,9 @@ jobs:
|
||||
|
||||
| Output | type | example | description |
|
||||
|:--------------------:|:------------:|:----------------------------------:|:----------------------------------------:|
|
||||
| any_changed | `string` | `true` OR `false` | Returns `true` when any of the filenames provided using the `files` input has changed |
|
||||
| any_changed | `string` | `true` OR `false` | Returns `true` when any of the filenames provided using the `files` input has changed |
|
||||
| only_changed | `string` | `true` OR `false` | Returns `true` when only files provided using the `files` input have changed. |
|
||||
| other_changed_files | `string` | `'new.txt path/to/file.png ...'` | Select all modified files <br/> not listed in the files input <br /> i.e. *a combination of all added, <br /> copied and modified files (ACM).* |
|
||||
| all_modified_files | `string` | `'new.txt path/to/file.png ...'` | Select all modified files <br /> i.e. *a combination of all added, <br />copied and modified files (ACM).* |
|
||||
| all_changed_files | `string` | `'new.txt path/to/file.png ...'` | Select all paths (\*) <br /> i.e. *a combination of all options below.* |
|
||||
| added_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Added (A) |
|
||||
@@ -111,11 +113,11 @@ jobs:
|
||||
|
||||
- name: Get changed files using defaults
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v8.6
|
||||
uses: tj-actions/changed-files@v8.7
|
||||
|
||||
- name: Get changed files using a comma separator
|
||||
id: changed-files-comma
|
||||
uses: tj-actions/changed-files@v8.6
|
||||
uses: tj-actions/changed-files@v8.7
|
||||
with:
|
||||
separator: ","
|
||||
|
||||
@@ -137,7 +139,7 @@ jobs:
|
||||
|
||||
- name: Get specific changed files
|
||||
id: changed-files-specific
|
||||
uses: tj-actions/changed-files@v8.6
|
||||
uses: tj-actions/changed-files@v8.7
|
||||
with:
|
||||
files: |
|
||||
my-file.txt
|
||||
@@ -155,14 +157,14 @@ jobs:
|
||||
|
||||
- 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@v8.6
|
||||
uses: tj-actions/changed-files@v8.7
|
||||
with:
|
||||
files_from_source_file: |
|
||||
test/changed-files-list.txt
|
||||
|
||||
- name: Use a source file or list of file(s) to populate to files input and optionally specify more files.
|
||||
id: changed-files-specific-source-file-and-specify-files
|
||||
uses: tj-actions/changed-files@v8.6
|
||||
uses: tj-actions/changed-files@v8.7
|
||||
with:
|
||||
files_from_source_file: |
|
||||
test/changed-files-list.txt
|
||||
@@ -171,13 +173,13 @@ jobs:
|
||||
|
||||
- name: Use a different commit SHA
|
||||
id: changed-files-custom-sha
|
||||
uses: tj-actions/changed-files@v8.6
|
||||
uses: tj-actions/changed-files@v8.7
|
||||
with:
|
||||
sha: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- name: Use a different base SHA
|
||||
id: changed-files-custom-base-sha
|
||||
uses: tj-actions/changed-files@v8.6
|
||||
uses: tj-actions/changed-files@v8.7
|
||||
with:
|
||||
base_sha: "2096ed0"
|
||||
|
||||
@@ -194,7 +196,7 @@ jobs:
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v8.6
|
||||
uses: tj-actions/changed-files@v8.7
|
||||
|
||||
- name: Pre-commit
|
||||
uses: pre-commit/action@v2.0.0
|
||||
|
||||
@@ -60,6 +60,12 @@ outputs:
|
||||
any_changed:
|
||||
description: Return true only when any files provided using the files input have changed.
|
||||
value: ${{ steps.changed-files.outputs.any_changed }}
|
||||
only_changed:
|
||||
description: Return true only when only files provided using the files input have changed.
|
||||
value: ${{ steps.changed-files.outputs.only_changed }}
|
||||
other_changed_files:
|
||||
description: Return list of changed files not listed in the files input.
|
||||
value: ${{ steps.changed-files.outputs.other_changed_files }}
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
|
||||
@@ -139,14 +139,27 @@ echo "All modified files: $ALL_MODIFIED_FILES"
|
||||
if [[ -n "$UNIQUE_FILES" ]]; then
|
||||
# shellcheck disable=SC2001
|
||||
ALL_INPUT_FILES=$(echo "$UNIQUE_FILES" | tr "\n" " " | xargs)
|
||||
ALL_OTHER_CHANGED_FILES=$(git diff --diff-filter="ACM" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA")
|
||||
|
||||
OTHER_CHANGED_FILES=$(echo "${ALL_OTHER_CHANGED_FILES[@]}" "${ALL_MODIFIED_FILES[@]}" | tr ' ' '\n' | sort | uniq -u | tr "\n" " " | xargs)
|
||||
|
||||
echo "Input files: ${ALL_INPUT_FILES[*]}"
|
||||
echo "Matching modified files: ${ALL_MODIFIED_FILES[*]}"
|
||||
|
||||
if [[ -n "$ALL_MODIFIED_FILES" ]]; then
|
||||
echo "::set-output name=any_changed::true"
|
||||
else
|
||||
echo "::set-output name=any_changed::false"
|
||||
fi
|
||||
|
||||
if [[ -n "$OTHER_CHANGED_FILES" ]]; then
|
||||
echo "Non Matching modified files: ${OTHER_CHANGED_FILES[*]}"
|
||||
echo "::set-output name=only_changed::false"
|
||||
echo "::set-output name=other_changed_files::$OTHER_CHANGED_FILES"
|
||||
else
|
||||
echo "::set-output name=only_changed::true"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
echo "::set-output name=added_files::$ADDED"
|
||||
|
||||
Reference in New Issue
Block a user