Compare commits

...

22 Commits

Author SHA1 Message Date
Tonye Jack
c2216f65fd Updated separator 2022-02-16 22:54:29 -05:00
Tonye Jack
cc2d4600d8 Update README.md 2022-02-07 22:53:49 -05:00
Tonye Jack
830658002d chore: expose internal files-separator input (#346) 2022-02-07 22:52:51 -05:00
Tonye Jack
b06e69da6c Update README.md 2022-02-03 14:15:41 -05:00
Tonye Jack
2d12c2d5c8 Update README.md 2022-02-02 16:09:18 -05:00
Tonye Jack
711d42d763 Upgraded to v14.3 (#343)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2022-02-01 22:38:54 -05:00
Tonye Jack
5acfa350b7 Upgraded to v4.0.3 (#342)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2022-02-01 22:32:50 -05:00
Tonye Jack
fa18b2cf05 fix: resolve bug with pattern matching on windows (#341) 2022-02-01 22:30:40 -05:00
Tonye Jack
fd7c70d42d Update README.md 2022-02-01 11:50:04 -05:00
Tonye Jack
be3bd2810f Upgraded to v14.2 (#339)
* Upgraded from v4.0.2 -> v14.2

* Update README.md

Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2022-02-01 03:43:41 -05:00
Tonye Jack
52cb7100f2 Upgraded from v14.1 -> v4.0.2 (#338)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2022-02-01 03:38:28 -05:00
Tonye Jack
5b338faafa bug: resolve issue with excluding files via glob pattern (#337)
* bug: resolve issue with excluding files via glob pattern

* Update action.yml

* Update action.yml
2022-02-01 03:34:33 -05:00
Tonye Jack
b73d4f8d3f Update sourcefiles.sh 2022-01-31 15:07:53 -05:00
dependabot[bot]
9d48b7acf4 Bump peter-evans/create-pull-request from 3.12.0 to 3.12.1
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 3.12.0 to 3.12.1.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](https://github.com/peter-evans/create-pull-request/compare/v3.12.0...v3.12.1)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-30 20:32:02 -05:00
Tonye Jack
2458fea93e Update README.md 2022-01-30 04:39:43 -05:00
Tonye Jack
539c9b2f0c Update README.md 2022-01-28 17:16:19 -05:00
Tonye Jack
1bf2f9775d Update README.md 2022-01-28 12:33:53 -05:00
Tonye Jack
6be19fd726 Upgraded from v4.0.1 -> v14.1 (#332)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2022-01-26 02:40:00 -05:00
Tonye Jack
445bbefc90 Upgraded from v14 -> v4.0.1 (#331)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2022-01-26 02:36:13 -05:00
Masaya Suzuki
e9f69ac719 bug: Fix command to narrow down target files (#330)
* Fix INPUT_FILES_PATTERN

* INPUT_FILES_PATTERN -> FILES_PATTERN
2022-01-26 02:32:28 -05:00
Tonye Jack
416c6348f8 Upgraded to v14 (#329)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2022-01-25 23:18:02 -05:00
Tonye Jack
75f52eeda4 Upgraded to v4.0.0 (#328)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2022-01-25 23:15:26 -05:00
8 changed files with 124 additions and 75 deletions

View File

@@ -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.12.0 uses: peter-evans/create-pull-request@v3.12.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 }}"

View File

@@ -615,7 +615,7 @@ jobs:
if: steps.changed-files-specific-only-changed.outputs.other_deleted_files != '' if: steps.changed-files-specific-only-changed.outputs.other_deleted_files != ''
run: | run: |
if [[ "${{ steps.changed-files-specific-only-changed.outputs.only_deleted }}" != "false" ]]; then if [[ "${{ steps.changed-files-specific-only-changed.outputs.only_deleted }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-only-changed.outputs.only_deleted }})" echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-only-changed.outputs.only_deleted }})."
exit 1 exit 1
fi fi
shell: shell:

View File

@@ -31,7 +31,7 @@ jobs:
- name: Create Pull Request - name: Create Pull Request
if: failure() if: failure()
uses: peter-evans/create-pull-request@v3 uses: peter-evans/create-pull-request@v3.12.1
with: with:
base: "main" base: "main"
title: "Updated README.md" title: "Updated README.md"

View File

@@ -1,5 +1,85 @@
# Changelog # Changelog
## [v14.3](https://github.com/tj-actions/changed-files/tree/v14.3) (2022-02-02)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v4.0.3...v14.3)
**Merged pull requests:**
- Upgraded to v4.0.3 [\#342](https://github.com/tj-actions/changed-files/pull/342) ([jackton1](https://github.com/jackton1))
## [v4.0.3](https://github.com/tj-actions/changed-files/tree/v4.0.3) (2022-02-02)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v14.2...v4.0.3)
**Fixed bugs:**
- \[BUG\] Action flips forward slash into backslash resulting in match failure. [\#340](https://github.com/tj-actions/changed-files/issues/340)
- \[BUG\] Getting Error: `uses:` keyword is not currently supported when using above 12.2 version [\#333](https://github.com/tj-actions/changed-files/issues/333)
- \[BUG\] Investigate possible bug using since\_last\_remote\_commit when force pushing changes. [\#303](https://github.com/tj-actions/changed-files/issues/303)
**Merged pull requests:**
- fix: resolve bug with pattern matching on windows [\#341](https://github.com/tj-actions/changed-files/pull/341) ([jackton1](https://github.com/jackton1))
- Upgraded to v14.2 [\#339](https://github.com/tj-actions/changed-files/pull/339) ([jackton1](https://github.com/jackton1))
## [v14.2](https://github.com/tj-actions/changed-files/tree/v14.2) (2022-02-01)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v4.0.2...v14.2)
**Fixed bugs:**
- \[BUG\] Negating filter doesn't work [\#335](https://github.com/tj-actions/changed-files/issues/335)
**Merged pull requests:**
- Upgraded to v4.0.2 [\#338](https://github.com/tj-actions/changed-files/pull/338) ([jackton1](https://github.com/jackton1))
## [v4.0.2](https://github.com/tj-actions/changed-files/tree/v4.0.2) (2022-02-01)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v14.1...v4.0.2)
**Merged pull requests:**
- bug: resolve issue with excluding files via glob pattern [\#337](https://github.com/tj-actions/changed-files/pull/337) ([jackton1](https://github.com/jackton1))
- Bump peter-evans/create-pull-request from 3.12.0 to 3.12.1 [\#334](https://github.com/tj-actions/changed-files/pull/334) ([dependabot[bot]](https://github.com/apps/dependabot))
- Upgraded to v14.1 [\#332](https://github.com/tj-actions/changed-files/pull/332) ([jackton1](https://github.com/jackton1))
## [v14.1](https://github.com/tj-actions/changed-files/tree/v14.1) (2022-01-26)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v4.0.1...v14.1)
**Merged pull requests:**
- Upgraded to v4.0.1 [\#331](https://github.com/tj-actions/changed-files/pull/331) ([jackton1](https://github.com/jackton1))
## [v4.0.1](https://github.com/tj-actions/changed-files/tree/v4.0.1) (2022-01-26)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v14...v4.0.1)
**Merged pull requests:**
- bug: Fix command to narrow down target files [\#330](https://github.com/tj-actions/changed-files/pull/330) ([massongit](https://github.com/massongit))
- Upgraded to v14 [\#329](https://github.com/tj-actions/changed-files/pull/329) ([jackton1](https://github.com/jackton1))
## [v14](https://github.com/tj-actions/changed-files/tree/v14) (2022-01-26)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v4.0.0...v14)
**Merged pull requests:**
- Upgraded to v4.0.0 [\#328](https://github.com/tj-actions/changed-files/pull/328) ([jackton1](https://github.com/jackton1))
## [v4.0.0](https://github.com/tj-actions/changed-files/tree/v4.0.0) (2022-01-26)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v13.2...v4.0.0)
**Merged pull requests:**
- Clean up variable name to reflect usage. [\#327](https://github.com/tj-actions/changed-files/pull/327) ([jackton1](https://github.com/jackton1))
- Narrow down target files by exact match of INPUT\_FILES [\#326](https://github.com/tj-actions/changed-files/pull/326) ([massongit](https://github.com/massongit))
- Upgraded to v13.2 [\#325](https://github.com/tj-actions/changed-files/pull/325) ([jackton1](https://github.com/jackton1))
## [v13.2](https://github.com/tj-actions/changed-files/tree/v13.2) (2022-01-25) ## [v13.2](https://github.com/tj-actions/changed-files/tree/v13.2) (2022-01-25)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v3.0.2...v13.2) [Full Changelog](https://github.com/tj-actions/changed-files/compare/v3.0.2...v13.2)
@@ -666,7 +746,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:**
@@ -682,13 +762,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:**

View File

@@ -1,5 +1,5 @@
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/4a625e9b62794b5b98e169c15c0e673c)](https://www.codacy.com/gh/tj-actions/changed-files/dashboard?utm_source=github.com\&utm_medium=referral\&utm_content=tj-actions/changed-files\&utm_campaign=Badge_Grade) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/4a625e9b62794b5b98e169c15c0e673c)](https://www.codacy.com/gh/tj-actions/changed-files/dashboard?utm_source=github.com\&utm_medium=referral\&utm_content=tj-actions/changed-files\&utm_campaign=Badge_Grade)
[![CI](https://github.com/tj-actions/changed-files/actions/workflows/test.yml/badge.svg)](https://github.com/tj-actions/changed-files/actions/workflows/test.yml) [![Update release version.](https://github.com/tj-actions/changed-files/actions/workflows/sync-release-version.yml/badge.svg)](https://github.com/tj-actions/changed-files/actions/workflows/sync-release-version.yml) [![Public workflows that use this action.](https://img.shields.io/endpoint?url=https%3A%2F%2Fapi-tj-actions1.vercel.app%2Fapi%2Fgithub-actions%2Fused-by%3Faction%3Dtj-actions%2Fchanged-files%26badge%3Dtrue)](https://github.com/search?o=desc\&q=tj-actions+changed-files+language%3AYAML\&s=\&type=Code) [![CI](https://github.com/tj-actions/changed-files/actions/workflows/test.yml/badge.svg)](https://github.com/tj-actions/changed-files/actions/workflows/test.yml) [![Update release version.](https://github.com/tj-actions/changed-files/actions/workflows/sync-release-version.yml/badge.svg)](https://github.com/tj-actions/changed-files/actions/workflows/sync-release-version.yml) [![Public workflows that use this action.](https://img.shields.io/endpoint?url=https%3A%2F%2Fused-by.vercel.app%2Fapi%2Fgithub-actions%2Fused-by%3Faction%3Dtj-actions%2Fchanged-files%26badge%3Dtrue)](https://github.com/search?o=desc\&q=tj-actions+changed-files+language%3AYAML\&s=\&type=Code)
[![Ubuntu](https://img.shields.io/badge/Ubuntu-E95420?logo=ubuntu\&logoColor=white)](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on) [![Ubuntu](https://img.shields.io/badge/Ubuntu-E95420?logo=ubuntu\&logoColor=white)](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on)
[![Mac OS](https://img.shields.io/badge/mac%20os-000000?logo=macos\&logoColor=F0F0F0)](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on) [![Mac OS](https://img.shields.io/badge/mac%20os-000000?logo=macos\&logoColor=F0F0F0)](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on)
@@ -21,8 +21,9 @@ 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 changed. * Boolean output indicating that certain files have been changed.
* Multiple repositories support. * Multiple repositories support.
* Runs on self hosted runners. * [GitHub-hosted runners](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners) support
* GitHub Enterprise Server support. * [GitHub Enterprise Server](https://docs.github.com/en/enterprise-server@3.3/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/getting-started-with-github-actions-for-github-enterprise-server) support.
* [self-hosted runners](https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners) support.
* Monorepos (Fetches only the last remote commit). * Monorepos (Fetches only the last remote commit).
* Supports all platforms (Linux, MacOS, Windows). * Supports all platforms (Linux, MacOS, Windows).
* List all files that have changed. * List all files that have changed.
@@ -64,7 +65,7 @@ jobs:
- name: Get changed files - name: Get changed files
id: changed-files id: changed-files
uses: tj-actions/changed-files@v13.2 uses: tj-actions/changed-files@v14.3
- name: List all changed files - name: List all changed files
run: | run: |
@@ -126,6 +127,7 @@ Support this project with a :star:
| token | `string` | `false` | `${{ github.token }}` | [GITHUB\_TOKEN](https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#using-the-github_token-in-a-workflow) <br /> or a repo scoped <br /> [Personal Access Token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token) | | token | `string` | `false` | `${{ github.token }}` | [GITHUB\_TOKEN](https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#using-the-github_token-in-a-workflow) <br /> or a repo scoped <br /> [Personal Access Token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token) |
| separator | `string` | `true` | `' '` | Output string separator | | separator | `string` | `true` | `' '` | Output string separator |
| files | `string` OR `string[]` | `false` | | Check for changes <br> using only these <br> list of file(s) <br> (Defaults to the <br> entire repo) | | files | `string` OR `string[]` | `false` | | Check for changes <br> using only these <br> list of file(s) <br> (Defaults to the <br> entire repo) |
| files-separator | string | false | `'\n'` | Separator used to split the<br>files input |
| 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 |
@@ -141,11 +143,11 @@ Support this project with a :star:
- name: Get changed files using defaults - name: Get changed files using defaults
id: changed-files id: changed-files
uses: tj-actions/changed-files@v13.2 uses: tj-actions/changed-files@v14.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@v13.2 uses: tj-actions/changed-files@v14.3
with: with:
separator: "," separator: ","
@@ -167,7 +169,7 @@ Support this project with a :star:
- name: Get specific changed files - name: Get specific changed files
id: changed-files-specific id: changed-files-specific
uses: tj-actions/changed-files@v13.2 uses: tj-actions/changed-files@v14.3
with: with:
files: | files: |
my-file.txt my-file.txt
@@ -206,14 +208,14 @@ Support this project with a :star:
- 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@v13.2 uses: tj-actions/changed-files@v14.3
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@v13.2 uses: tj-actions/changed-files@v14.3
with: with:
files_from_source_file: | files_from_source_file: |
test/changed-files-list.txt test/changed-files-list.txt
@@ -222,13 +224,13 @@ Support this project with a :star:
- 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@v13.2 uses: tj-actions/changed-files@v14.3
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@v13.2 uses: tj-actions/changed-files@v14.3
with: with:
base_sha: "2096ed0" base_sha: "2096ed0"
@@ -240,7 +242,7 @@ Support this project with a :star:
- name: Run changed-files with defaults on the dir1 - name: Run changed-files with defaults on the dir1
id: changed-files-for-dir1 id: changed-files-for-dir1
uses: tj-actions/changed-files@v13.2 uses: tj-actions/changed-files@v14.3
with: with:
path: dir1 path: dir1
@@ -252,7 +254,7 @@ Support this project with a :star:
- name: Run changed-files using the last commit on the remote branch - name: Run changed-files using the last commit on the remote branch
id: changed-files-since-last-remote-commit id: changed-files-since-last-remote-commit
uses: tj-actions/changed-files@v13.2 uses: tj-actions/changed-files@v14.3
with: with:
since_last_remote_commit: "true" since_last_remote_commit: "true"

View File

@@ -19,6 +19,10 @@ inputs:
description: 'Check for changes using only this list of files (Defaults to the entire repo)' description: 'Check for changes using only this list of files (Defaults to the entire repo)'
required: false required: false
default: "" default: ""
files-separator:
description: 'Separator used to split the files input'
default: "\n"
required: false
sha: sha:
description: 'Specify a current commit SHA used for comparing changes' description: 'Specify a current commit SHA used for comparing changes'
required: true required: true
@@ -112,21 +116,13 @@ runs:
fi fi
id: base-sha id: base-sha
shell: bash 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 - name: Glob match
uses: tj-actions/glob@v3.3 uses: tj-actions/glob@v6
id: glob id: glob
with: with:
files: ${{ steps.source-input-files.outputs.files }} files: ${{ inputs.files }}
files-separator: " " files-separator: ${{ inputs.files-separator }}
files-from-source-file: ${{ inputs.files_from_source_file }}
separator: "|" separator: "|"
- run: | - run: |
bash $GITHUB_ACTION_PATH/entrypoint.sh bash $GITHUB_ACTION_PATH/entrypoint.sh

View File

@@ -107,18 +107,19 @@ if [[ -z "$INPUT_FILES_PATTERN" ]]; then
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}') 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 else
echo "Input files pattern: $INPUT_FILES_PATTERN" echo "Input files pattern: $INPUT_FILES_PATTERN"
FILES_PATTERN="^($INPUT_FILES_PATTERN)$"
ADDED=$(git diff --diff-filter=A --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -x "$INPUT_FILES_PATTERN" | 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 "$FILES_PATTERN" | 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 -x "$INPUT_FILES_PATTERN" | 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_PATTERN" | 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 -x "$INPUT_FILES_PATTERN" | 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_PATTERN" | 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 -x "$INPUT_FILES_PATTERN" | 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_PATTERN" | 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 -x "$INPUT_FILES_PATTERN" | 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_PATTERN" | 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 -x "$INPUT_FILES_PATTERN" | 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_PATTERN" | 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 -x "$INPUT_FILES_PATTERN" | 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_PATTERN" | 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 -x "$INPUT_FILES_PATTERN" | 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_PATTERN" | 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 -x "$INPUT_FILES_PATTERN" | 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_PATTERN" | 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 -x "$INPUT_FILES_PATTERN" | 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_PATTERN" | 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 -x "$INPUT_FILES_PATTERN" | 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_PATTERN" | 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}') 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;}' | awk '!a[$0]++' | 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}')

View File

@@ -1,30 +0,0 @@
#!/usr/bin/env bash
set -e
echo "::group::changed-files-from-source-file"
RAW_FILES=()
if [[ -n $INPUT_FILES_FROM_SOURCE_FILE ]]; then
for file in $INPUT_FILES_FROM_SOURCE_FILE
do
while read -r fileName; do
RAW_FILES+=("$fileName")
done <"$file"
done
fi
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 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}')"
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[*]}"
echo "::endgroup::"