Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62a9200adf | ||
|
|
1126e5084e | ||
|
|
e47f6a420a | ||
|
|
19eb759935 | ||
|
|
03274db805 | ||
|
|
1d51af8e6a | ||
|
|
00d592baeb | ||
|
|
79f5fc819f | ||
|
|
8a41500fbe | ||
|
|
fcd69a6202 | ||
|
|
005b4f86af | ||
|
|
4d091f8b2c | ||
|
|
c035ac4746 | ||
|
|
733250a98f | ||
|
|
d807308d1c | ||
|
|
083bed6459 |
@@ -32,6 +32,16 @@
|
|||||||
"code",
|
"code",
|
||||||
"doc"
|
"doc"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "IvanPizhenko",
|
||||||
|
"name": "Ivan Pizhenko",
|
||||||
|
"avatar_url": "https://avatars.githubusercontent.com/u/11859904?v=4",
|
||||||
|
"profile": "https://github.com/IvanPizhenko",
|
||||||
|
"contributions": [
|
||||||
|
"code",
|
||||||
|
"doc"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"contributorsPerLine": 7,
|
"contributorsPerLine": 7,
|
||||||
|
|||||||
2
.github/workflows/sync-release-version.yml
vendored
2
.github/workflows/sync-release-version.yml
vendored
@@ -23,7 +23,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
output: 'HISTORY.md'
|
output: 'HISTORY.md'
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
uses: peter-evans/create-pull-request@v3.10.0
|
uses: peter-evans/create-pull-request@v3.10.1
|
||||||
with:
|
with:
|
||||||
base: "main"
|
base: "main"
|
||||||
title: "Upgraded to ${{ steps.sync-release-version.outputs.new_version }}"
|
title: "Upgraded to ${{ steps.sync-release-version.outputs.new_version }}"
|
||||||
|
|||||||
59
.github/workflows/test.yml
vendored
59
.github/workflows/test.yml
vendored
@@ -20,6 +20,59 @@ jobs:
|
|||||||
- name: shellcheck
|
- name: shellcheck
|
||||||
uses: reviewdog/action-shellcheck@v1.7
|
uses: reviewdog/action-shellcheck@v1.7
|
||||||
|
|
||||||
|
test-multiple-repositories:
|
||||||
|
name: Test with multiple repositories
|
||||||
|
runs-on: ${{ matrix.platform }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
platform: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
steps:
|
||||||
|
- name: Checkout into dir1
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
path: dir1
|
||||||
|
- name: Run changed-files with defaults on the dir1
|
||||||
|
id: changed-files-dir1
|
||||||
|
uses: ./dir1
|
||||||
|
with:
|
||||||
|
path: dir1
|
||||||
|
- name: Show output
|
||||||
|
run: |
|
||||||
|
echo "${{ toJSON(steps.changed-files-dir1.outputs) }}"
|
||||||
|
shell:
|
||||||
|
bash
|
||||||
|
- name: List all modified files
|
||||||
|
run: |
|
||||||
|
for file in "${{ steps.changed-files-dir1.outputs.modified_files }}"; do
|
||||||
|
echo $file
|
||||||
|
done
|
||||||
|
shell:
|
||||||
|
bash
|
||||||
|
- name: Checkout into dir2
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
path: dir2
|
||||||
|
- name: Run changed-files with defaults on the dir2
|
||||||
|
id: changed-files-dir2
|
||||||
|
uses: ./dir2
|
||||||
|
with:
|
||||||
|
path: dir2
|
||||||
|
- name: Show output
|
||||||
|
run: |
|
||||||
|
echo "${{ toJSON(steps.changed-files-dir2.outputs) }}"
|
||||||
|
shell:
|
||||||
|
bash
|
||||||
|
- name: List all modified files
|
||||||
|
run: |
|
||||||
|
for file in "${{ steps.changed-files-dir2.outputs.modified_files }}"; do
|
||||||
|
echo $file
|
||||||
|
done
|
||||||
|
shell:
|
||||||
|
bash
|
||||||
|
|
||||||
test-no-head-sha:
|
test-no-head-sha:
|
||||||
name: Test changed-files missing head sha
|
name: Test changed-files missing head sha
|
||||||
runs-on: ${{ matrix.platform }}
|
runs-on: ${{ matrix.platform }}
|
||||||
@@ -31,12 +84,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout to branch
|
- name: Checkout to branch
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Run changed-files with defaults
|
- name: Run changed-files with defaults
|
||||||
id: changed-files
|
id: changed-files
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|
||||||
- name: Show output
|
- name: Show output
|
||||||
run: |
|
run: |
|
||||||
echo "${{ toJSON(steps.changed-files.outputs) }}"
|
echo "${{ toJSON(steps.changed-files.outputs) }}"
|
||||||
@@ -200,7 +253,7 @@ jobs:
|
|||||||
bash
|
bash
|
||||||
- name: Get branch name
|
- name: Get branch name
|
||||||
id: branch-name
|
id: branch-name
|
||||||
uses: tj-actions/branch-names@v4.8
|
uses: tj-actions/branch-names@v4.9
|
||||||
- uses: nrwl/last-successful-commit-action@v1
|
- uses: nrwl/last-successful-commit-action@v1
|
||||||
id: last_successful_commit
|
id: last_successful_commit
|
||||||
with:
|
with:
|
||||||
|
|||||||
2
.github/workflows/update-readme.yml
vendored
2
.github/workflows/update-readme.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Run test
|
- name: Run test
|
||||||
uses: tj-actions/remark@v1.5
|
uses: tj-actions/remark@v1.7
|
||||||
|
|
||||||
- name: Verify Changed files
|
- name: Verify Changed files
|
||||||
uses: tj-actions/verify-changed-files@v7
|
uses: tj-actions/verify-changed-files@v7
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,2 +1,4 @@
|
|||||||
.idea/
|
.idea/
|
||||||
.envrc
|
.envrc
|
||||||
|
tag.sh
|
||||||
|
untag.sh
|
||||||
|
|||||||
57
HISTORY.md
57
HISTORY.md
@@ -1,5 +1,46 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [v1.0.1](https://github.com/tj-actions/changed-files/tree/v1.0.1) (2021-08-28)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v1.0.0...v1.0.1)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- \[Feature\] Add support for checkout path [\#167](https://github.com/tj-actions/changed-files/issues/167)
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- \[BUG\] Deleted files not detected [\#165](https://github.com/tj-actions/changed-files/issues/165)
|
||||||
|
- \[BUG\] changed-files unable to initialize git repository on custom container image [\#164](https://github.com/tj-actions/changed-files/issues/164)
|
||||||
|
|
||||||
|
**Closed issues:**
|
||||||
|
|
||||||
|
- Dependency Dashboard [\#27](https://github.com/tj-actions/changed-files/issues/27)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Updated README.md [\#172](https://github.com/tj-actions/changed-files/pull/172) ([jackton1](https://github.com/jackton1))
|
||||||
|
- Updated README.md [\#171](https://github.com/tj-actions/changed-files/pull/171) ([jackton1](https://github.com/jackton1))
|
||||||
|
- docs: add IvanPizhenko as a contributor for code, doc [\#170](https://github.com/tj-actions/changed-files/pull/170) ([allcontributors[bot]](https://github.com/apps/allcontributors))
|
||||||
|
- Implement path parameter [\#168](https://github.com/tj-actions/changed-files/pull/168) ([IvanPizhenko](https://github.com/IvanPizhenko))
|
||||||
|
- Update peter-evans/create-pull-request action to v3.10.1 [\#163](https://github.com/tj-actions/changed-files/pull/163) ([renovate[bot]](https://github.com/apps/renovate))
|
||||||
|
- Update tj-actions/branch-names action to v4.9 [\#162](https://github.com/tj-actions/changed-files/pull/162) ([renovate[bot]](https://github.com/apps/renovate))
|
||||||
|
- Update tj-actions/remark action to v1.7 [\#161](https://github.com/tj-actions/changed-files/pull/161) ([renovate[bot]](https://github.com/apps/renovate))
|
||||||
|
- Upgraded to v1.0.0 [\#160](https://github.com/tj-actions/changed-files/pull/160) ([jackton1](https://github.com/jackton1))
|
||||||
|
|
||||||
|
## [v1.0.0](https://github.com/tj-actions/changed-files/tree/v1.0.0) (2021-08-18)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v9.3...v1.0.0)
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- Setting remote URL breaks other steps that are using it [\#158](https://github.com/tj-actions/changed-files/issues/158)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Fix persisting origin URL [\#159](https://github.com/tj-actions/changed-files/pull/159) ([jackton1](https://github.com/jackton1))
|
||||||
|
- Upgraded to v9.3 [\#157](https://github.com/tj-actions/changed-files/pull/157) ([jackton1](https://github.com/jackton1))
|
||||||
|
|
||||||
## [v9.3](https://github.com/tj-actions/changed-files/tree/v9.3) (2021-08-09)
|
## [v9.3](https://github.com/tj-actions/changed-files/tree/v9.3) (2021-08-09)
|
||||||
|
|
||||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v9.2...v9.3)
|
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v9.2...v9.3)
|
||||||
@@ -18,10 +59,6 @@
|
|||||||
|
|
||||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v9.1...v9.2)
|
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v9.1...v9.2)
|
||||||
|
|
||||||
**Closed issues:**
|
|
||||||
|
|
||||||
- Dependency Dashboard [\#27](https://github.com/tj-actions/changed-files/issues/27)
|
|
||||||
|
|
||||||
**Merged pull requests:**
|
**Merged pull requests:**
|
||||||
|
|
||||||
- Dedupe output file names. [\#153](https://github.com/tj-actions/changed-files/pull/153) ([jackton1](https://github.com/jackton1))
|
- Dedupe output file names. [\#153](https://github.com/tj-actions/changed-files/pull/153) ([jackton1](https://github.com/jackton1))
|
||||||
@@ -188,7 +225,7 @@
|
|||||||
|
|
||||||
## [v7](https://github.com/tj-actions/changed-files/tree/v7) (2021-06-09)
|
## [v7](https://github.com/tj-actions/changed-files/tree/v7) (2021-06-09)
|
||||||
|
|
||||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v6.3...v7)
|
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v6...v7)
|
||||||
|
|
||||||
**Closed issues:**
|
**Closed issues:**
|
||||||
|
|
||||||
@@ -204,13 +241,13 @@
|
|||||||
- Update tj-actions/sync-release-version action to v8.7 [\#86](https://github.com/tj-actions/changed-files/pull/86) ([renovate[bot]](https://github.com/apps/renovate))
|
- Update tj-actions/sync-release-version action to v8.7 [\#86](https://github.com/tj-actions/changed-files/pull/86) ([renovate[bot]](https://github.com/apps/renovate))
|
||||||
- Upgraded to v6.3 [\#85](https://github.com/tj-actions/changed-files/pull/85) ([jackton1](https://github.com/jackton1))
|
- Upgraded to v6.3 [\#85](https://github.com/tj-actions/changed-files/pull/85) ([jackton1](https://github.com/jackton1))
|
||||||
|
|
||||||
## [v6.3](https://github.com/tj-actions/changed-files/tree/v6.3) (2021-05-26)
|
|
||||||
|
|
||||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v6...v6.3)
|
|
||||||
|
|
||||||
## [v6](https://github.com/tj-actions/changed-files/tree/v6) (2021-05-26)
|
## [v6](https://github.com/tj-actions/changed-files/tree/v6) (2021-05-26)
|
||||||
|
|
||||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v6.2...v6)
|
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v6.3...v6)
|
||||||
|
|
||||||
|
## [v6.3](https://github.com/tj-actions/changed-files/tree/v6.3) (2021-05-26)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v6.2...v6.3)
|
||||||
|
|
||||||
**Merged pull requests:**
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
|||||||
55
README.md
55
README.md
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
||||||
|
|
||||||
[](#contributors-)
|
[](#contributors-)
|
||||||
|
|
||||||
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
||||||
|
|
||||||
@@ -14,6 +14,7 @@ Retrieve all changed files relative to the default branch (`pull_request*` based
|
|||||||
|
|
||||||
* Easy to debug.
|
* Easy to debug.
|
||||||
* Boolean output indicating that certain files have been modified.
|
* Boolean output indicating that certain files have been modified.
|
||||||
|
* Multiple repository support.
|
||||||
* List all files that have changed.
|
* List all files that have changed.
|
||||||
* Between the current pull request branch and the default branch.
|
* Between the current pull request branch and the default branch.
|
||||||
* Between the last commit and the current pushed change.
|
* Between the last commit and the current pushed change.
|
||||||
@@ -53,11 +54,11 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
|
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
|
||||||
|
|
||||||
- name: Get changed files
|
- name: Get changed files
|
||||||
id: changed-files
|
id: changed-files
|
||||||
uses: tj-actions/changed-files@v9.3
|
uses: tj-actions/changed-files@v1.0.1
|
||||||
|
|
||||||
- name: List all modified files
|
- name: List all modified files
|
||||||
run: |
|
run: |
|
||||||
for file in "${{ steps.changed-files.outputs.all_modified_files }}"; do
|
for file in "${{ steps.changed-files.outputs.all_modified_files }}"; do
|
||||||
@@ -80,7 +81,7 @@ jobs:
|
|||||||
|
|
||||||
| Output | type | example | description |
|
| Output | type | example | description |
|
||||||
|:--------------------:|:------------:|:----------------------------------:|:----------------------------------------:|
|
|:--------------------:|:------------:|:----------------------------------:|:----------------------------------------:|
|
||||||
| any_changed | `string` | `true` OR `false` | Returns `true` when any <br /> of the filenames provided using <br /> the `files` input has changed (ACMDR) |
|
| 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. |
|
| only_changed | `string` | `true` OR `false` | Returns `true` when only <br /> files provided using <br /> 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).* |
|
| 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, modified and renamed 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).* |
|
||||||
@@ -104,6 +105,7 @@ jobs:
|
|||||||
| base_sha | `string` | `false` | | Specify a different <br> base commit SHA <br> used for <br> comparing changes |
|
| base_sha | `string` | `false` | | Specify a different <br> base commit SHA <br> used for <br> comparing changes |
|
||||||
| sha | `string` | `true` | `${{ github.sha }}` | Specify a different <br> commit SHA <br> used for <br> comparing changes |
|
| sha | `string` | `true` | `${{ github.sha }}` | Specify a different <br> commit SHA <br> used for <br> comparing changes |
|
||||||
| files_from_source_file | `string` | `false` | | Source file <br> used to populate <br> the files input |
|
| files_from_source_file | `string` | `false` | | Source file <br> used to populate <br> the files input |
|
||||||
|
| path | `string` | `false` | | Relative path under <br> `GITHUB_WORKSPACE` <br> to the repository |
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
@@ -114,11 +116,11 @@ jobs:
|
|||||||
|
|
||||||
- name: Get changed files using defaults
|
- name: Get changed files using defaults
|
||||||
id: changed-files
|
id: changed-files
|
||||||
uses: tj-actions/changed-files@v9.3
|
uses: tj-actions/changed-files@v1.0.1
|
||||||
|
|
||||||
- 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@v9.3
|
uses: tj-actions/changed-files@v1.0.1
|
||||||
with:
|
with:
|
||||||
separator: ","
|
separator: ","
|
||||||
|
|
||||||
@@ -140,7 +142,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Get specific changed files
|
- name: Get specific changed files
|
||||||
id: changed-files-specific
|
id: changed-files-specific
|
||||||
uses: tj-actions/changed-files@v9.3
|
uses: tj-actions/changed-files@v1.0.1
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
my-file.txt
|
my-file.txt
|
||||||
@@ -148,7 +150,7 @@ jobs:
|
|||||||
new.txt
|
new.txt
|
||||||
test_directory
|
test_directory
|
||||||
*.sh
|
*.sh
|
||||||
.(png|jpeg)$
|
.(png|jpeg)$
|
||||||
.(sql)$
|
.(sql)$
|
||||||
^(mynewfile|custom)
|
^(mynewfile|custom)
|
||||||
|
|
||||||
@@ -156,22 +158,22 @@ jobs:
|
|||||||
if: steps.changed-files-specific.outputs.any_changed == 'true'
|
if: steps.changed-files-specific.outputs.any_changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
echo "One or more files listed above has changed."
|
echo "One or more files listed above has changed."
|
||||||
|
|
||||||
- name: Run step if only the files listed above change
|
- name: Run step if only the files listed above change
|
||||||
if: steps.changed-files-specific.outputs.only_changed == 'true'
|
if: steps.changed-files-specific.outputs.only_changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
echo "Only files listed above have changed."
|
echo "Only files listed above have changed."
|
||||||
|
|
||||||
- name: Use a source file or list of file(s) to populate to files input.
|
- name: Use a source file or list of file(s) to populate to files input.
|
||||||
id: changed-files-specific-source-file
|
id: changed-files-specific-source-file
|
||||||
uses: tj-actions/changed-files@v9.3
|
uses: tj-actions/changed-files@v1.0.1
|
||||||
with:
|
with:
|
||||||
files_from_source_file: |
|
files_from_source_file: |
|
||||||
test/changed-files-list.txt
|
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.
|
- 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
|
id: changed-files-specific-source-file-and-specify-files
|
||||||
uses: tj-actions/changed-files@v9.3
|
uses: tj-actions/changed-files@v1.0.1
|
||||||
with:
|
with:
|
||||||
files_from_source_file: |
|
files_from_source_file: |
|
||||||
test/changed-files-list.txt
|
test/changed-files-list.txt
|
||||||
@@ -180,16 +182,28 @@ jobs:
|
|||||||
|
|
||||||
- name: Use a different commit SHA
|
- name: Use a different commit SHA
|
||||||
id: changed-files-custom-sha
|
id: changed-files-custom-sha
|
||||||
uses: tj-actions/changed-files@v9.3
|
uses: tj-actions/changed-files@v1.0.1
|
||||||
with:
|
with:
|
||||||
sha: ${{ github.event.pull_request.head.sha }}
|
sha: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
- name: Use a different base SHA
|
- name: Use a different base SHA
|
||||||
id: changed-files-custom-base-sha
|
id: changed-files-custom-base-sha
|
||||||
uses: tj-actions/changed-files@v9.3
|
uses: tj-actions/changed-files@v1.0.1
|
||||||
with:
|
with:
|
||||||
base_sha: "2096ed0"
|
base_sha: "2096ed0"
|
||||||
|
|
||||||
|
- name: Checkout into dir1
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
path: subfolder
|
||||||
|
|
||||||
|
- name: Run changed-files with defaults on the dir1
|
||||||
|
id: changed-files-for-subfolder
|
||||||
|
uses: tj-actions/changed-files@v1.0.1
|
||||||
|
with:
|
||||||
|
path: subfolder
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Running [pre-commit](https://pre-commit.com/) on all modified files
|
### Running [pre-commit](https://pre-commit.com/) on all modified files
|
||||||
@@ -200,10 +214,10 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Get changed files
|
- name: Get changed files
|
||||||
id: changed-files
|
id: changed-files
|
||||||
uses: tj-actions/changed-files@v9.3
|
uses: tj-actions/changed-files@v1.0.1
|
||||||
|
|
||||||
- name: Pre-commit
|
- name: Pre-commit
|
||||||
uses: pre-commit/action@v2.0.0
|
uses: pre-commit/action@v2.0.0
|
||||||
@@ -253,6 +267,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|||||||
<td align="center"><a href="https://github.com/jsoref"><img src="https://avatars.githubusercontent.com/u/2119212?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Josh Soref</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=jsoref" title="Documentation">📖</a></td>
|
<td align="center"><a href="https://github.com/jsoref"><img src="https://avatars.githubusercontent.com/u/2119212?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Josh Soref</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=jsoref" title="Documentation">📖</a></td>
|
||||||
<td align="center"><a href="https://github.com/monoxgas"><img src="https://avatars.githubusercontent.com/u/1223016?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nick Landers</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=monoxgas" title="Code">💻</a></td>
|
<td align="center"><a href="https://github.com/monoxgas"><img src="https://avatars.githubusercontent.com/u/1223016?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nick Landers</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=monoxgas" title="Code">💻</a></td>
|
||||||
<td align="center"><a href="https://github.com/Kras4ooo"><img src="https://avatars.githubusercontent.com/u/1948054?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Krasimir Nikolov</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=Kras4ooo" title="Code">💻</a> <a href="https://github.com/tj-actions/changed-files/commits?author=Kras4ooo" title="Documentation">📖</a></td>
|
<td align="center"><a href="https://github.com/Kras4ooo"><img src="https://avatars.githubusercontent.com/u/1948054?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Krasimir Nikolov</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=Kras4ooo" title="Code">💻</a> <a href="https://github.com/tj-actions/changed-files/commits?author=Kras4ooo" title="Documentation">📖</a></td>
|
||||||
|
<td align="center"><a href="https://github.com/IvanPizhenko"><img src="https://avatars.githubusercontent.com/u/11859904?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ivan Pizhenko</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=IvanPizhenko" title="Code">💻</a> <a href="https://github.com/tj-actions/changed-files/commits?author=IvanPizhenko" title="Documentation">📖</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ inputs:
|
|||||||
base_sha:
|
base_sha:
|
||||||
description: 'Specify a base commit SHA on used for comparing changes'
|
description: 'Specify a base commit SHA on used for comparing changes'
|
||||||
required: false
|
required: false
|
||||||
|
path:
|
||||||
|
description: 'Specify a relative path under $GITHUB_WORKSPACE to locate the repository'
|
||||||
|
required: false
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
added_files:
|
added_files:
|
||||||
@@ -100,6 +103,7 @@ runs:
|
|||||||
INPUT_TOKEN: ${{ inputs.token }}
|
INPUT_TOKEN: ${{ inputs.token }}
|
||||||
INPUT_FILES: ${{ join(format('{0} {1}', inputs.files, steps.source-input-files.outputs.files), ' ') }}
|
INPUT_FILES: ${{ join(format('{0} {1}', inputs.files, steps.source-input-files.outputs.files), ' ') }}
|
||||||
INPUT_SEPARATOR: ${{ inputs.separator }}
|
INPUT_SEPARATOR: ${{ inputs.separator }}
|
||||||
|
INPUT_PATH: ${{ inputs.path }}
|
||||||
|
|
||||||
branding:
|
branding:
|
||||||
icon: file-text
|
icon: file-text
|
||||||
|
|||||||
@@ -4,6 +4,17 @@ set -e
|
|||||||
|
|
||||||
echo "::group::changed-files"
|
echo "::group::changed-files"
|
||||||
|
|
||||||
|
echo "Resolving repository path..."
|
||||||
|
|
||||||
|
if [[ -n $INPUT_PATH ]]; then
|
||||||
|
REPO_DIR="$GITHUB_WORKSPACE/$INPUT_PATH"
|
||||||
|
if [[ ! -d "$REPO_DIR" ]]; then
|
||||||
|
echo "::warning::Invalid repository path"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
cd "$REPO_DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
git remote add temp_changed_files "https://${INPUT_TOKEN}@github.com/${GITHUB_REPOSITORY}"
|
git remote add temp_changed_files "https://${INPUT_TOKEN}@github.com/${GITHUB_REPOSITORY}"
|
||||||
|
|
||||||
echo "Getting HEAD info..."
|
echo "Getting HEAD info..."
|
||||||
@@ -27,7 +38,7 @@ if [[ -z $GITHUB_BASE_REF ]]; then
|
|||||||
fi
|
fi
|
||||||
TARGET_BRANCH=${GITHUB_REF/refs\/heads\//}
|
TARGET_BRANCH=${GITHUB_REF/refs\/heads\//}
|
||||||
CURRENT_BRANCH=$TARGET_BRANCH
|
CURRENT_BRANCH=$TARGET_BRANCH
|
||||||
|
|
||||||
if [[ $exit_status -ne 0 ]]; then
|
if [[ $exit_status -ne 0 ]]; then
|
||||||
echo "::warning::Unable to determine the previous commit sha"
|
echo "::warning::Unable to determine the previous commit sha"
|
||||||
echo "::warning::You seem to be missing 'fetch-depth: 0' or 'fetch-depth: 2'. See https://github.com/tj-actions/changed-files#usage"
|
echo "::warning::You seem to be missing 'fetch-depth: 0' or 'fetch-depth: 2'. See https://github.com/tj-actions/changed-files#usage"
|
||||||
@@ -42,7 +53,7 @@ else
|
|||||||
else
|
else
|
||||||
PREVIOUS_SHA=$INPUT_BASE_SHA
|
PREVIOUS_SHA=$INPUT_BASE_SHA
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $exit_status -ne 0 ]]; then
|
if [[ $exit_status -ne 0 ]]; then
|
||||||
echo "::warning::Unable to determine the base ref sha for ${TARGET_BRANCH}"
|
echo "::warning::Unable to determine the base ref sha for ${TARGET_BRANCH}"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -51,7 +62,7 @@ fi
|
|||||||
|
|
||||||
echo "Retrieving changes between $PREVIOUS_SHA ($TARGET_BRANCH) → $CURRENT_SHA ($CURRENT_BRANCH)"
|
echo "Retrieving changes between $PREVIOUS_SHA ($TARGET_BRANCH) → $CURRENT_SHA ($CURRENT_BRANCH)"
|
||||||
|
|
||||||
UNIQUE_FILES=$(echo "$INPUT_FILES" | tr ' ' '\n' | sort -u | xargs)
|
UNIQUE_FILES=$(echo "$INPUT_FILES" | tr " " "\n" | sort -u | xargs -0)
|
||||||
|
|
||||||
if [[ -z "$UNIQUE_FILES" ]]; then
|
if [[ -z "$UNIQUE_FILES" ]]; then
|
||||||
echo "Getting diff..."
|
echo "Getting diff..."
|
||||||
@@ -82,47 +93,47 @@ else
|
|||||||
echo "Checking for file changes: \"${path}\"..."
|
echo "Checking for file changes: \"${path}\"..."
|
||||||
IFS=" "
|
IFS=" "
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
ADDED_ARRAY+=($(git diff --diff-filter=A --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs || true))
|
ADDED_ARRAY+=($(git diff --diff-filter=A --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs -0 || true))
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
COPIED_ARRAY+=($(git diff --diff-filter=C --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs || true))
|
COPIED_ARRAY+=($(git diff --diff-filter=C --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs -0 || true))
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
DELETED_ARRAY+=($(git diff --diff-filter=D --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs || true))
|
DELETED_ARRAY+=($(git diff --diff-filter=D --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs -0 || true))
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
MODIFIED_ARRAY+=($(git diff --diff-filter=M --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs || true))
|
MODIFIED_ARRAY+=($(git diff --diff-filter=M --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs -0 || true))
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
RENAMED_ARRAY+=($(git diff --diff-filter=R --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs || true))
|
RENAMED_ARRAY+=($(git diff --diff-filter=R --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs -0 || true))
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
TYPE_CHANGED_ARRAY+=($(git diff --diff-filter=T --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs || true))
|
TYPE_CHANGED_ARRAY+=($(git diff --diff-filter=T --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs -0 || true))
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
UNMERGED_ARRAY+=($(git diff --diff-filter=U --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs || true))
|
UNMERGED_ARRAY+=($(git diff --diff-filter=U --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs -0 || true))
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
UNKNOWN_ARRAY+=($(git diff --diff-filter=X --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs || true))
|
UNKNOWN_ARRAY+=($(git diff --diff-filter=X --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs -0 || true))
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
ALL_CHANGED_ARRAY+=($(git diff --diff-filter="*ACDMRTUX" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs || true))
|
ALL_CHANGED_ARRAY+=($(git diff --diff-filter="*ACDMRTUX" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs -0 || true))
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
ALL_MODIFIED_FILES_ARRAY+=($(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs || true))
|
ALL_MODIFIED_FILES_ARRAY+=($(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs -0 || true))
|
||||||
done
|
done
|
||||||
|
|
||||||
# shellcheck disable=SC2001
|
# shellcheck disable=SC2001
|
||||||
ADDED=$(echo "${ADDED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr ' ' '\n' | sort -u | xargs)
|
ADDED=$(echo "${ADDED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr " " "\n" | sort -u | xargs -0)
|
||||||
# shellcheck disable=SC2001
|
# shellcheck disable=SC2001
|
||||||
COPIED=$(echo "${COPIED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr ' ' '\n' | sort -u | xargs)
|
COPIED=$(echo "${COPIED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr " " "\n" | sort -u | xargs -0)
|
||||||
# shellcheck disable=SC2001
|
# shellcheck disable=SC2001
|
||||||
DELETED=$(echo "${DELETED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr ' ' '\n' | sort -u | xargs)
|
DELETED=$(echo "${DELETED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr " " "\n" | sort -u | xargs -0)
|
||||||
# shellcheck disable=SC2001
|
# shellcheck disable=SC2001
|
||||||
MODIFIED=$(echo "${MODIFIED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr ' ' '\n' | sort -u | xargs)
|
MODIFIED=$(echo "${MODIFIED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr " " "\n" | sort -u | xargs -0)
|
||||||
# shellcheck disable=SC2001
|
# shellcheck disable=SC2001
|
||||||
RENAMED=$(echo "${RENAMED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr ' ' '\n' | sort -u | xargs)
|
RENAMED=$(echo "${RENAMED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr " " "\n" | sort -u | xargs -0)
|
||||||
# shellcheck disable=SC2001
|
# shellcheck disable=SC2001
|
||||||
TYPE_CHANGED=$(echo "${TYPE_CHANGED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr ' ' '\n' | sort -u | xargs)
|
TYPE_CHANGED=$(echo "${TYPE_CHANGED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr " " "\n" | sort -u | xargs -0)
|
||||||
# shellcheck disable=SC2001
|
# shellcheck disable=SC2001
|
||||||
UNMERGED=$(echo "${UNMERGED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr ' ' '\n' | sort -u | xargs)
|
UNMERGED=$(echo "${UNMERGED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr " " "\n" | sort -u | xargs -0)
|
||||||
# shellcheck disable=SC2001
|
# shellcheck disable=SC2001
|
||||||
UNKNOWN=$(echo "${UNKNOWN_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr ' ' '\n' | sort -u | xargs)
|
UNKNOWN=$(echo "${UNKNOWN_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr " " "\n" | sort -u | xargs -0)
|
||||||
# shellcheck disable=SC2001
|
# shellcheck disable=SC2001
|
||||||
ALL_CHANGED=$(echo "${ALL_CHANGED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr ' ' '\n' | sort -u | xargs)
|
ALL_CHANGED=$(echo "${ALL_CHANGED_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr " " "\n" | sort -u | xargs -0)
|
||||||
# shellcheck disable=SC2001
|
# shellcheck disable=SC2001
|
||||||
ALL_MODIFIED_FILES=$(echo "${ALL_MODIFIED_FILES_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr ' ' '\n' | sort -u | xargs)
|
ALL_MODIFIED_FILES=$(echo "${ALL_MODIFIED_FILES_ARRAY[*]}" | sed 's/ */'"$INPUT_SEPARATOR"'/g' | tr " " "\n" | sort -u | xargs -0)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Added files: $ADDED"
|
echo "Added files: $ADDED"
|
||||||
@@ -138,10 +149,10 @@ echo "All modified files: $ALL_MODIFIED_FILES"
|
|||||||
|
|
||||||
if [[ -n "$UNIQUE_FILES" ]]; then
|
if [[ -n "$UNIQUE_FILES" ]]; then
|
||||||
# shellcheck disable=SC2001
|
# shellcheck disable=SC2001
|
||||||
ALL_INPUT_FILES=$(echo "$UNIQUE_FILES" | tr "\n" " " | xargs)
|
ALL_INPUT_FILES=$(echo "$UNIQUE_FILES" | tr "\n" " " | xargs -0)
|
||||||
ALL_OTHER_CHANGED_FILES=$(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA")
|
ALL_OTHER_CHANGED_FILES=$(git diff --diff-filter="ACMR" --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)
|
OTHER_CHANGED_FILES=$(echo "${ALL_OTHER_CHANGED_FILES[@]}" "${ALL_MODIFIED_FILES[@]}" | tr " " "\n" | sort | uniq -u | tr "\n" " " | xargs -0)
|
||||||
|
|
||||||
echo "Input files: ${ALL_INPUT_FILES[*]}"
|
echo "Input files: ${ALL_INPUT_FILES[*]}"
|
||||||
echo "Matching modified files: ${ALL_MODIFIED_FILES[*]}"
|
echo "Matching modified files: ${ALL_MODIFIED_FILES[*]}"
|
||||||
|
|||||||
1
test/test new.txt
Normal file
1
test/test new.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
Reference in New Issue
Block a user