Compare commits

...

36 Commits

Author SHA1 Message Date
Tonye Jack
1980f551b4 Updated separator 2022-02-16 22:40:37 -05:00
Tonye Jack
738523bd5f Updated README.md (#323)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2022-01-24 20:52:31 -05:00
allcontributors[bot]
910453353b docs: add massongit as a contributor for code (#322)
Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2022-01-24 20:51:13 -05:00
Masaya Suzuki
13328439bc Deduplicate from files parameter without sorting (#321)
Co-authored-by: Tonye Jack <jtonye@ymail.com>
2022-01-24 20:50:47 -05:00
allcontributors[bot]
7fe764fa81 docs: add wushujames as a contributor for doc (#320)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2022-01-21 11:20:50 -05:00
James Cheng
204ed812d0 String literals need to be inside single-quotes (#319)
* String literals need to be inside single-quotes

Per https://docs.github.com/en/actions/learn-github-actions/expressions#literals
string	You must use single quotes. Escape literal single-quotes with a single quote.

* Update README.md

Co-authored-by: Tonye Jack <jtonye@ymail.com>
2022-01-21 11:19:23 -05:00
Tonye Jack
7dfde9f9fe Remove redundant debug line (#318) 2022-01-20 01:53:39 -05:00
Tonye Jack
269e6c2a15 Update README.md 2022-01-19 18:51:22 -05:00
Tonye Jack
80cb5a3de4 Update README.md 2022-01-15 02:08:17 -05:00
Tonye Jack
61ee456a9d Updated README.md (#317)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2022-01-10 15:05:01 -05:00
Tonye Jack
b6dd719334 Update README.md 2022-01-10 14:42:33 -05:00
Tonye Jack
40292bd765 Update README.md 2022-01-09 14:30:17 -05:00
Tonye Jack
64580b3060 Upgraded to v13.1 (#316)
* Upgraded from v3.0.0 -> v13.1

* Update README.md

Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2022-01-09 14:02:00 -05:00
Tonye Jack
e5db4109e0 Upgraded from v3.0.0 -> v3.0.1 (#315)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2022-01-09 13:54:05 -05:00
Tonye Jack
98bf782e42 Update README.md 2022-01-09 12:11:39 -05:00
Tonye Jack
e77fe6304b Update README.md 2022-01-09 12:10:47 -05:00
Renovate Bot
d0d33c82a2 Update tj-actions/glob action to v3.3 2022-01-09 04:49:33 -05:00
Tonye Jack
4ea1cf7500 Updated README.md (#312)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2022-01-09 03:23:45 -05:00
Tonye Jack
835db067d1 Clean up unused code (#311)
* Clean up unused code

* Update entrypoint.sh

* Update action.yml

* Update entrypoint.sh

* Update action.yml
2022-01-09 03:18:29 -05:00
allcontributors[bot]
281391b987 doc: add Zamiell as a contributor for doc (#310)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

* Update .all-contributorsrc

* Update README.md

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Co-authored-by: Tonye Jack <jtonye@ymail.com>
2022-01-07 14:31:32 -05:00
James
e458dee210 spelling/grammar (#309) 2022-01-07 13:51:45 -05:00
Tonye Jack
c4d765fc77 Update README.md 2022-01-05 00:19:25 -05:00
Tonye Jack
283e1f384e Upgraded from v13 -> v3.0.0 (#308)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2022-01-04 22:56:23 -05:00
Tonye Jack
c204bb533c Upgraded from v12.2 -> v13 (#307)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2022-01-04 22:27:11 -05:00
Tonye Jack
3f66a14524 Upgraded tj-actions/glob to v3.2 (#306) 2022-01-04 22:23:46 -05:00
Tonye Jack
b7e12d640e Update action.yml 2022-01-04 22:10:38 -05:00
Tonye Jack
c1d40aa45b Update README.md 2022-01-04 22:08:06 -05:00
Tonye Jack
4e8540cc23 Add support for using github's glob pattern syntax (#304)
* Add support for using github's glob pattern syntax

Fixes: #264 #265

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update action.yml

* Update action.yml

* Update action.yml

* Update action.yml

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update sourcefiles.sh

* Update action.yml

* Update test.yml

* Update changed-files-list.txt

* Update changed-files-list.txt

* Update action.yml

* Update action.yml

* Update entrypoint.sh

* Update test.yml

* Update README.md

* Update test.yml

* Update entrypoint.sh

* Update test.yml

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-01-04 21:38:03 -05:00
Tonye Jack
9b119a28a5 Updated comments 2022-01-04 20:28:30 -05:00
Renovate Bot
ff749ea95a Update tj-actions/remark action to v2.3 2022-01-03 16:13:31 -05:00
Renovate Bot
775240461c Update tj-actions/remark action to v2 2022-01-02 21:59:56 -05:00
dependabot[bot]
642651fe29 Bump tj-actions/github-changelog-generator from 1.10 to 1.11
Bumps [tj-actions/github-changelog-generator](https://github.com/tj-actions/github-changelog-generator) from 1.10 to 1.11.
- [Release notes](https://github.com/tj-actions/github-changelog-generator/releases)
- [Changelog](https://github.com/tj-actions/github-changelog-generator/blob/main/HISTORY.md)
- [Commits](https://github.com/tj-actions/github-changelog-generator/compare/v1.10...v1.11)

---
updated-dependencies:
- dependency-name: tj-actions/github-changelog-generator
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-02 20:29:26 -05:00
Renovate Bot
c029ed4f59 Update tj-actions/github-changelog-generator action to v1.10 2021-12-31 20:29:31 -05:00
Tonye Jack
2f20ef2c6b Update README.md 2021-12-29 21:31:50 -05:00
Tonye Jack
686b672b03 Upgraded to v2.0.1 (#298)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-12-29 21:29:56 -05:00
Tonye Jack
59233a5db9 Upgraded to v12.2 (#297)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-12-29 21:25:25 -05:00
10 changed files with 238 additions and 100 deletions

View File

@@ -60,6 +60,33 @@
"contributions": [
"doc"
]
},
{
"login": "Zamiell",
"name": "James",
"avatar_url": "https://avatars.githubusercontent.com/u/5511220?v=4",
"profile": "https://github.com/Zamiell",
"contributions": [
"doc"
]
},
{
"login": "wushujames",
"name": "James Cheng",
"avatar_url": "https://avatars.githubusercontent.com/u/677529?v=4",
"profile": "https://github.com/wushujames",
"contributions": [
"doc"
]
},
{
"login": "massongit",
"name": "Masaya Suzuki",
"avatar_url": "https://avatars.githubusercontent.com/u/15100604?v=4",
"profile": "https://qiita.com/SUZUKI_Masaya",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7,

View File

@@ -19,7 +19,7 @@ jobs:
paths: |
README.md
- name: Generate CHANGELOG
uses: tj-actions/github-changelog-generator@v1.8
uses: tj-actions/github-changelog-generator@v1.11
with:
output: 'HISTORY.md'
- name: Create Pull Request

View File

@@ -222,11 +222,20 @@ jobs:
files: |
.github/workflows/test.yml
action.yml
test/changed-files-list.txt
!**/*.txt
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files-specific.outputs) }}'
shell:
bash
- name: Check if a excluded file is not included in any_changed
if: "contains(steps.changed-files-specific.outputs.all_changed_files, 'test/changed-files-list.txt')"
run: |
echo "Invalid output: Expected not to include (test/changed-files-list.txt) got (${{ steps.changed-files-specific.outputs.all_changed_files }})"
exit 1
shell:
bash
- name: Verify any_changed for specific files
if: "!contains(steps.changed-files-specific.outputs.all_changed_files, 'action.yml') && !contains(steps.changed-files-specific.outputs.all_changed_files, '.github/workflows/test.yml')"
run: |
@@ -236,6 +245,13 @@ jobs:
fi
shell:
bash
- name: Check if a excluded file is not included in any_modified
if: "contains(steps.changed-files-specific.outputs.all_modified_files, 'test/changed-files-list.txt')"
run: |
echo "Invalid output: Expected not to include (test/changed-files-list.txt) got (${{ steps.changed-files-specific.outputs.all_modified_files }})"
exit 1
shell:
bash
- name: Verify any_modified for specific files
if: "!contains(steps.changed-files-specific.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific.outputs.all_modified_files, '.github/workflows/test.yml')"
run: |
@@ -245,6 +261,13 @@ jobs:
fi
shell:
bash
- name: Check if a excluded file is not included in any_deleted
if: "contains(steps.changed-files-specific.outputs.deleted_files, 'test/changed-files-list.txt')"
run: |
echo "Invalid output: Expected not to include (test/changed-files-list.txt) got (${{ steps.changed-files-specific.outputs.deleted_files }})"
exit 1
shell:
bash
- name: Verify any_deleted for specific files
if: "!contains(steps.changed-files-specific.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific.outputs.deleted_files, '.github/workflows/test.yml')"
run: |
@@ -342,7 +365,7 @@ jobs:
uses: ./
with:
files: |
.github/workflows/test.yml
**/test.yml
action.yml
separator: "|"
- name: Show output
@@ -425,7 +448,14 @@ jobs:
test/changed-files-list.txt
test/changed-files-list.txt
files: |
.github/workflows/rebase.yml
**/workflows/rebase.yml
- name: Check if a excluded file is not included in any_changed
if: contains(steps.changed-files-specific-source-file.outputs.all_changed_files, 'test/changed-files-list.txt')
run: |
echo "Invalid output: Expected not to include (test/changed-files-list.txt) got (${{ steps.changed-files-specific-source-file.outputs.all_changed_files }})"
exit 1
shell:
bash
- name: Verify any_changed from source files
if: |
(
@@ -440,6 +470,13 @@ jobs:
fi
shell:
bash
- name: Check if a excluded file is not included in any_modified
if: contains(steps.changed-files-specific-source-file.outputs.all_modified_files, 'test/changed-files-list.txt')
run: |
echo "Invalid output: Expected not to include (test/changed-files-list.txt) got (${{ steps.changed-files-specific-source-file.outputs.all_modified_files }})"
exit 1
shell:
bash
- name: Verify any_modified from source files
if: |
(
@@ -454,6 +491,13 @@ jobs:
fi
shell:
bash
- name: Check if a excluded file is not included in any_deleted
if: contains(steps.changed-files-specific-source-file.outputs.deleted_files, 'test/changed-files-list.txt')
run: |
echo "Invalid output: Expected not to include (test/changed-files-list.txt) got (${{ steps.changed-files-specific-source-file.outputs.deleted_files }})"
exit 1
shell:
bash
- name: Verify any_deleted from source files
if: "!contains(steps.changed-files-specific-source-file.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific-source-file.outputs.deleted_files, '.github/workflows/test.yml')"
run: |
@@ -555,7 +599,7 @@ jobs:
uses: ./
with:
files: |
.github/workflows/test.yml
.github/**/test.yml
- name: Verify only_changed files
if: steps.changed-files-specific-only-changed.outputs.other_changed_files != ''
run: |

View File

@@ -14,7 +14,7 @@ jobs:
fetch-depth: 0
- name: Run test
uses: tj-actions/remark@v1.7
uses: tj-actions/remark@v2.3
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v8

View File

@@ -1,5 +1,75 @@
# Changelog
## [Unreleased](https://github.com/tj-actions/changed-files/tree/HEAD)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v13.1...HEAD)
**Merged pull requests:**
- Upgraded to v3.0.1 [\#315](https://github.com/tj-actions/changed-files/pull/315) ([jackton1](https://github.com/jackton1))
## [v13.1](https://github.com/tj-actions/changed-files/tree/v13.1) (2022-01-09)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v3.0.1...v13.1)
## [v3.0.1](https://github.com/tj-actions/changed-files/tree/v3.0.1) (2022-01-09)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v3.0.0...v3.0.1)
**Closed issues:**
- Dependency Dashboard [\#27](https://github.com/tj-actions/changed-files/issues/27)
**Merged pull requests:**
- Update tj-actions/glob action to v3.3 [\#313](https://github.com/tj-actions/changed-files/pull/313) ([renovate[bot]](https://github.com/apps/renovate))
- Updated README.md [\#312](https://github.com/tj-actions/changed-files/pull/312) ([jackton1](https://github.com/jackton1))
- Clean up unused code [\#311](https://github.com/tj-actions/changed-files/pull/311) ([jackton1](https://github.com/jackton1))
- doc: add Zamiell as a contributor for doc [\#310](https://github.com/tj-actions/changed-files/pull/310) ([allcontributors[bot]](https://github.com/apps/allcontributors))
- spelling/grammar [\#309](https://github.com/tj-actions/changed-files/pull/309) ([Zamiell](https://github.com/Zamiell))
- Upgraded to v3.0.0 [\#308](https://github.com/tj-actions/changed-files/pull/308) ([jackton1](https://github.com/jackton1))
## [v3.0.0](https://github.com/tj-actions/changed-files/tree/v3.0.0) (2022-01-05)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v13...v3.0.0)
**Merged pull requests:**
- Upgraded to v13 [\#307](https://github.com/tj-actions/changed-files/pull/307) ([jackton1](https://github.com/jackton1))
## [v13](https://github.com/tj-actions/changed-files/tree/v13) (2022-01-05)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v2.0.1...v13)
**Implemented enhancements:**
- \[Feature\] Make it easier to exclude files [\#265](https://github.com/tj-actions/changed-files/issues/265)
- \[Feature\] Support the same filter syntax as GitHub Workflows [\#264](https://github.com/tj-actions/changed-files/issues/264)
**Merged pull requests:**
- Upgraded tj-actions/glob to v3.2 [\#306](https://github.com/tj-actions/changed-files/pull/306) ([jackton1](https://github.com/jackton1))
- Update tj-actions/remark action to v2.3 [\#305](https://github.com/tj-actions/changed-files/pull/305) ([renovate[bot]](https://github.com/apps/renovate))
- Add support for using github's glob pattern syntax [\#304](https://github.com/tj-actions/changed-files/pull/304) ([jackton1](https://github.com/jackton1))
- Update tj-actions/remark action to v2 [\#302](https://github.com/tj-actions/changed-files/pull/302) ([renovate[bot]](https://github.com/apps/renovate))
- Bump tj-actions/github-changelog-generator from 1.10 to 1.11 [\#300](https://github.com/tj-actions/changed-files/pull/300) ([dependabot[bot]](https://github.com/apps/dependabot))
- Update tj-actions/github-changelog-generator action to v1.10 [\#299](https://github.com/tj-actions/changed-files/pull/299) ([renovate[bot]](https://github.com/apps/renovate))
- Upgraded to v2.0.1 [\#298](https://github.com/tj-actions/changed-files/pull/298) ([jackton1](https://github.com/jackton1))
- Upgraded to v12.2 [\#297](https://github.com/tj-actions/changed-files/pull/297) ([jackton1](https://github.com/jackton1))
## [v2.0.1](https://github.com/tj-actions/changed-files/tree/v2.0.1) (2021-12-30)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v12.2...v2.0.1)
## [v12.2](https://github.com/tj-actions/changed-files/tree/v12.2) (2021-12-30)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v12.1...v12.2)
**Merged pull requests:**
- Fixed unbound variable warnings [\#296](https://github.com/tj-actions/changed-files/pull/296) ([jackton1](https://github.com/jackton1))
- Upgraded to v12.1 [\#295](https://github.com/tj-actions/changed-files/pull/295) ([jackton1](https://github.com/jackton1))
## [v12.1](https://github.com/tj-actions/changed-files/tree/v12.1) (2021-12-30)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v2.0.0...v12.1)
@@ -9,10 +79,6 @@
- \[BUG\] The `other_modified_files` contains all modified files even those that match the file `filter`. [\#293](https://github.com/tj-actions/changed-files/issues/293)
- \[BUG\] The `only_modified` is evaluated to `true` even when `other_modified_files` is not empty. [\#292](https://github.com/tj-actions/changed-files/issues/292)
**Closed issues:**
- Dependency Dashboard [\#27](https://github.com/tj-actions/changed-files/issues/27)
**Merged pull requests:**
- Fixed regression bug with other\_modified and other\_changed outputs [\#294](https://github.com/tj-actions/changed-files/pull/294) ([jackton1](https://github.com/jackton1))
@@ -147,7 +213,7 @@
## [v1.2.1](https://github.com/tj-actions/changed-files/tree/v1.2.1) (2021-11-08)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v11.5...v1.2.1)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v1.2.0...v1.2.1)
**Implemented enhancements:**
@@ -161,13 +227,13 @@
- Update actions/checkout action to v2.4.0 [\#243](https://github.com/tj-actions/changed-files/pull/243) ([renovate[bot]](https://github.com/apps/renovate))
- Upgraded to v11.5 [\#241](https://github.com/tj-actions/changed-files/pull/241) ([jackton1](https://github.com/jackton1))
## [v11.5](https://github.com/tj-actions/changed-files/tree/v11.5) (2021-10-30)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v1.2.0...v11.5)
## [v1.2.0](https://github.com/tj-actions/changed-files/tree/v1.2.0) (2021-10-30)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v11.4...v1.2.0)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v11.5...v1.2.0)
## [v11.5](https://github.com/tj-actions/changed-files/tree/v11.5) (2021-10-30)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v11.4...v11.5)
**Merged pull requests:**
@@ -580,7 +646,7 @@
## [v7](https://github.com/tj-actions/changed-files/tree/v7) (2021-06-09)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v6...v7)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v6.3...v7)
**Closed issues:**
@@ -596,13 +662,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))
- Upgraded to v6.3 [\#85](https://github.com/tj-actions/changed-files/pull/85) ([jackton1](https://github.com/jackton1))
## [v6](https://github.com/tj-actions/changed-files/tree/v6) (2021-05-26)
[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)
[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)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v6.2...v6)
**Merged pull requests:**

View File

@@ -7,7 +7,7 @@
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-6-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-9-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
@@ -20,18 +20,18 @@ Retrieve all changed files relative to the default branch (`pull_request*` based
* Fast execution (0-2 seconds on average).
* Easy to debug.
* Boolean output indicating that certain files have been changed.
* Multiple repositories.
* Self hosted runners.
* GitHub Enterprise Server.
* Monorepos (Fetches only the last remote commit)
* Supports all platforms.
* Multiple repositories support.
* Runs on self hosted runners.
* GitHub Enterprise Server support.
* Monorepos (Fetches only the last remote commit).
* Supports all platforms (Linux, MacOS, Windows).
* List all files that have changed.
* Between the current pull request branch and the default branch.
* Between the last commit and the current pushed change.
* Between the last remote branch commit and the current HEAD.
* Restrict change detection to a subset of files.
* Report on files that have at least one change.
* [Regex pattern](https://www.gnu.org/software/grep/manual/grep.html#Regular-Expressions) matching on a subset of files.
* Using [Glob pattern](https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet) matching.
## Usage
@@ -39,7 +39,8 @@ Retrieve all changed files relative to the default branch (`pull_request*` based
>
> * **IMPORTANT:** For `push` events you need to include `fetch-depth: 0` **OR** `fetch-depth: 2` depending on your use case.
> * When using `persist-credentials: false` with `actions/checkout@v2` you'll need to specify a `token` using the `token` input.
> * For monorepos were pulling all the branch history might not be desired the `fetch-depth` can be omitted for `pull_request` events.
> * For monorepos where pulling all the branch history might not be desired, you can omit `fetch-depth` for `pull_request` events.
> * For files located in a sub-directory ensure that the pattern specified contains `**` (globstar) to match any preceding directories or explicitly pass the full path relative to the project root. See: [#314](https://github.com/tj-actions/changed-files/issues/314)
```yaml
name: CI
@@ -63,7 +64,7 @@ jobs:
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v12.1
uses: tj-actions/changed-files@v13.1
- name: List all changed files
run: |
@@ -140,11 +141,11 @@ Support this project with a :star:
- name: Get changed files using defaults
id: changed-files
uses: tj-actions/changed-files@v12.1
uses: tj-actions/changed-files@v13.1
- name: Get changed files using a comma separator
id: changed-files-comma
uses: tj-actions/changed-files@v12.1
uses: tj-actions/changed-files@v13.1
with:
separator: ","
@@ -155,48 +156,49 @@ Support this project with a :star:
done
- 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: |
echo "Your my-file.txt file has been modified."
- 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: |
echo "Your test.txt file has been deleted."
- name: Get specific changed files
id: changed-files-specific
uses: tj-actions/changed-files@v12.1
uses: tj-actions/changed-files@v13.1
with:
files: |
my-file.txt
test.txt
new.txt
test_directory
\.sh$
.(png|jpeg)$
.(sql|py)$
^(mynewfile|custom)
*.sh
*.png
!*.md
*.jpeg
**/migrate-*.sql
- name: Run step if any of the listed files above change
if: steps.changed-files-specific.outputs.any_changed == "true"
if: steps.changed-files-specific.outputs.any_changed == 'true'
run: |
echo "One or more files listed above has changed."
- 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: |
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"
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"
if: steps.changed-files.outputs.only_deleted == 'true'
run: |
for file in ${{ steps.changed-files.outputs.deleted_files }}; do
echo "$file was deleted"
@@ -204,14 +206,14 @@ Support this project with a :star:
- 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@v12.1
uses: tj-actions/changed-files@v13.1
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@v12.1
uses: tj-actions/changed-files@v13.1
with:
files_from_source_file: |
test/changed-files-list.txt
@@ -220,13 +222,13 @@ Support this project with a :star:
- name: Use a different commit SHA
id: changed-files-custom-sha
uses: tj-actions/changed-files@v12.1
uses: tj-actions/changed-files@v13.1
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@v12.1
uses: tj-actions/changed-files@v13.1
with:
base_sha: "2096ed0"
@@ -238,7 +240,7 @@ Support this project with a :star:
- name: Run changed-files with defaults on the dir1
id: changed-files-for-dir1
uses: tj-actions/changed-files@v12.1
uses: tj-actions/changed-files@v13.1
with:
path: dir1
@@ -250,32 +252,12 @@ Support this project with a :star:
- name: Run changed-files using the last commit on the remote branch
id: changed-files-since-last-remote-commit
uses: tj-actions/changed-files@v12.1
uses: tj-actions/changed-files@v13.1
with:
since_last_remote_commit: "true"
```
### Running [pre-commit](https://pre-commit.com/) on all modified files
```yaml
...
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v12.1
- name: Pre-commit
uses: pre-commit/action@v2.0.0
with:
extra_args: -v --hook-stage push --files ${{ steps.changed-files.outputs.all_changed_files }}
token: ${{ secrets.github_token }}
```
<img width="1147" alt="Screen Shot 2021-11-19 at 4 59 21 PM" src="https://user-images.githubusercontent.com/17484350/142696936-8b7ca955-7ef9-4d53-9bdf-3e0008e90c3f.png">
* Free software: [MIT license](LICENSE)
@@ -292,6 +274,8 @@ Support this project with a :star:
This package was created with [Cookiecutter](https://github.com/cookiecutter/cookiecutter).
* [tj-actions/glob](https://github.com/tj-actions/glob)
## Report Bugs
Report bugs at https://github.com/tj-actions/changed-files/issues.
@@ -320,6 +304,11 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<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>
<td align="center"><a href="https://github.com/talva-tr"><img src="https://avatars.githubusercontent.com/u/82046981?v=4?s=100" width="100px;" alt=""/><br /><sub><b>talva-tr</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=talva-tr" title="Code">💻</a></td>
<td align="center"><a href="https://bandism.net/"><img src="https://avatars.githubusercontent.com/u/22633385?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ikko Ashimine</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=eltociear" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/Zamiell"><img src="https://avatars.githubusercontent.com/u/5511220?v=4?s=100" width="100px;" alt=""/><br /><sub><b>James</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=Zamiell" title="Documentation">📖</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/wushujames"><img src="https://avatars.githubusercontent.com/u/677529?v=4?s=100" width="100px;" alt=""/><br /><sub><b>James Cheng</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=wushujames" title="Documentation">📖</a></td>
<td align="center"><a href="https://qiita.com/SUZUKI_Masaya"><img src="https://avatars.githubusercontent.com/u/15100604?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Masaya Suzuki</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=massongit" title="Code">💻</a></td>
</tr>
</table>

View File

@@ -99,13 +99,6 @@ outputs:
runs:
using: 'composite'
steps:
- run: |
bash $GITHUB_ACTION_PATH/sourcefiles.sh
id: source-input-files
shell: bash
env:
INPUT_FILES: ${{ inputs.files }}
INPUT_FILES_FROM_SOURCE_FILE: ${{ inputs.files_from_source_file }}
- run: |
# "Set base sha..."
if [[ -n "${{ inputs.base_sha }}" ]]; then
@@ -119,6 +112,22 @@ runs:
fi
id: base-sha
shell: bash
- run: |
bash $GITHUB_ACTION_PATH/sourcefiles.sh
id: source-input-files
shell: bash
env:
# INPUT_<VARIABLE_NAME> is not available in Composite run steps
# https://github.community/t/input-variable-name-is-not-available-in-composite-run-steps/127611
INPUT_FILES: ${{ inputs.files }}
INPUT_FILES_FROM_SOURCE_FILE: ${{ inputs.files_from_source_file }}
- name: Glob match
uses: tj-actions/glob@v3.3
id: glob
with:
files: ${{ steps.source-input-files.outputs.files }}
files-separator: " "
separator: "|"
- run: |
bash $GITHUB_ACTION_PATH/entrypoint.sh
id: changed-files
@@ -132,7 +141,7 @@ runs:
INPUT_SHA: ${{ inputs.sha }}
INPUT_BASE_SHA: ${{ steps.base-sha.outputs.base_sha }}
INPUT_TOKEN: ${{ inputs.token }}
INPUT_FILES: ${{ steps.source-input-files.outputs.files }}
INPUT_FILES: ${{ steps.glob.outputs.paths }}
INPUT_SEPARATOR: ${{ inputs.separator }}
INPUT_PATH: ${{ inputs.path }}

View File

@@ -106,25 +106,22 @@ if [[ -z "${INPUT_FILES[*]}" ]]; then
ALL_CHANGED=$(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
ALL_MODIFIED=$(git diff --diff-filter="ACMRD" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
else
echo "Input files: ${INPUT_FILES[*]}"
echo "Input files: $INPUT_FILES"
FILES=$(echo "${INPUT_FILES[*]}" | awk '{gsub(/ /,"\n"); print $0;}' | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
echo "Checking for file changes: \"${FILES}\"..."
ADDED=$(git diff --diff-filter=A --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
COPIED=$(git diff --diff-filter=C --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
DELETED=$(git diff --diff-filter=D --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
MODIFIED=$(git diff --diff-filter=M --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
RENAMED=$(git diff --diff-filter=R --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
TYPE_CHANGED=$(git diff --diff-filter=T --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
UNMERGED=$(git diff --diff-filter=U --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
UNKNOWN=$(git diff --diff-filter=X --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
ALL_CHANGED_AND_MODIFIED=$(git diff --diff-filter="*ACDMRTUX" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
ALL_CHANGED=$(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
ALL_MODIFIED=$(git diff --diff-filter="ACMRD" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
ADDED=$(git diff --diff-filter=A --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${INPUT_FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
COPIED=$(git diff --diff-filter=C --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${INPUT_FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
DELETED=$(git diff --diff-filter=D --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${INPUT_FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
MODIFIED=$(git diff --diff-filter=M --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${INPUT_FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
RENAMED=$(git diff --diff-filter=R --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${INPUT_FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
TYPE_CHANGED=$(git diff --diff-filter=T --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${INPUT_FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
UNMERGED=$(git diff --diff-filter=U --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${INPUT_FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
UNKNOWN=$(git diff --diff-filter=X --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${INPUT_FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
ALL_CHANGED_AND_MODIFIED=$(git diff --diff-filter="*ACDMRTUX" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${INPUT_FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
ALL_CHANGED=$(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${INPUT_FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
ALL_MODIFIED=$(git diff --diff-filter="ACMRD" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${INPUT_FILES})" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
ALL_OTHER_CHANGED=$(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
UNIQUE_ALL_CHANGED=$(echo "${ALL_CHANGED}" | awk '{gsub(/\|/,"\n"); print $0;}' | sort -u | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
UNIQUE_ALL_CHANGED=$(echo "${ALL_CHANGED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk '!a[$0]++' | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
if [[ -n "${UNIQUE_ALL_CHANGED}" ]]; then
echo "Matching changed files: ${UNIQUE_ALL_CHANGED}"
@@ -154,7 +151,7 @@ else
fi
ALL_OTHER_MODIFIED=$(git diff --diff-filter="ACMRD" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
UNIQUE_ALL_MODIFIED=$(echo "${ALL_MODIFIED}" | awk '{gsub(/\|/,"\n"); print $0;}' | sort -u | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
UNIQUE_ALL_MODIFIED=$(echo "${ALL_MODIFIED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk '!a[$0]++' | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
if [[ -n "${UNIQUE_ALL_MODIFIED}" ]]; then
echo "Matching modified files: ${UNIQUE_ALL_MODIFIED}"
@@ -184,7 +181,7 @@ else
fi
ALL_OTHER_DELETED=$(git diff --diff-filter=D --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
UNIQUE_ALL_DELETED=$(echo "${DELETED}" | awk '{gsub(/\|/,"\n"); print $0;}' | sort -u | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
UNIQUE_ALL_DELETED=$(echo "${DELETED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk '!a[$0]++' | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
if [[ -n "${UNIQUE_ALL_DELETED}" ]]; then
echo "Matching deleted files: ${UNIQUE_ALL_DELETED}"

View File

@@ -4,22 +4,26 @@ set -e
echo "::group::changed-files-from-source-file"
IFS=" " read -r -a FILES <<< "$(echo "${INPUT_FILES[@]}" | sort -u | tr "\n" " ")"
RAW_FILES=()
if [[ -n $INPUT_FILES_FROM_SOURCE_FILE ]]; then
for file in $INPUT_FILES_FROM_SOURCE_FILE
do
while read -r fileName; do
FILES+=("$fileName")
RAW_FILES+=("$fileName")
done <"$file"
done
fi
echo "Input Files: ${FILES[*]}"
IFS=" " read -r -a CLEAN_FILES <<< "$(echo "${RAW_FILES[*]}" | tr "\r\n" "\n" | tr " " "\n" | awk -v d=" " '{s=(NR==1?s:s d)$0}END{print s}')"
IFS=" " read -r -a ALL_UNIQUE_FILES <<< "$(echo "${FILES[@]}" | tr " " "\n" | sort -u | tr "\n" " ")"
IFS=" " read -r -a CLEAN_INPUT_FILES <<< "$(echo "${INPUT_FILES}" | tr "\r\n" "\n" | tr " " "\n" | awk -v d=" " '{s=(NR==1?s:s d)$0}END{print s}')"
echo "All Unique Input files: ${ALL_UNIQUE_FILES[*]}"
FILES=("${CLEAN_FILES[@]}" "${CLEAN_INPUT_FILES[@]}")
IFS=" " read -r -a ALL_UNIQUE_FILES <<< "$(echo "${FILES[@]}" | tr "\r\n" "\n" | tr " " "\n" | awk '!a[$0]++' | awk -v d=" " '{s=(NR==1?s:s d)$0}END{print s}')"
echo "Input files: ${ALL_UNIQUE_FILES[*]}"
echo "::set-output name=files::${ALL_UNIQUE_FILES[*]}"

View File

@@ -2,3 +2,5 @@
action.yml
action.yml
action.yml
test/changed-files-list.txt
!**/*.txt