Compare commits

...

6 Commits
v20.1 ... v21

Author SHA1 Message Date
Tonye Jack
0edfedf16d fix: large output generated by all_old_new_renamed_files output (#502) 2022-05-25 17:47:58 -04:00
Tonye Jack
42d4eb324d Upgraded from v20.1 -> v20.2 (#499)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2022-05-24 00:16:24 -04:00
Tonye Jack
205450238e Update entrypoint.sh 2022-05-24 00:14:06 -04:00
Tonye Jack
c3c25d12b0 fix: matching renamed files with glob patterns (#498)
* fix: matching rename files with glob patterns

* Rename test rename 1.txt to test rename-1.txt

* Update entrypoint.sh

* Update entrypoint.sh

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

* Update entrypoint.sh

* Rename test rename-1.txt to test rename 1.txt

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-05-24 00:12:32 -04:00
Tonye Jack
b77c43beb0 chore: Improve test coverage (#497) 2022-05-22 23:57:41 -04:00
Tonye Jack
8373ec9091 Upgraded from v20 -> v20.1 (#496)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2022-05-22 13:13:56 -04:00
7 changed files with 95 additions and 44 deletions

View File

@@ -27,3 +27,25 @@ jobs:
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files.outputs) }}'
- name: Run changed-files with glob filtering
id: changed-files-glob
uses: ./
with:
files: |
test/*.txt
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files-glob.outputs) }}'
- name: Run changed-files with glob filtering and all_old_new_renamed_files
id: changed-files-glob-all-old-new-renamed-files
uses: ./
with:
include_all_old_new_renamed_files: true
files: |
test/*.txt
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files-glob-all-old-new-renamed-files.outputs) }}'

View File

@@ -300,6 +300,7 @@ jobs:
with:
base_sha: d1c0ee4
sha: 4d04215
include_all_old_new_renamed_files: true
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files-all-old-new-renamed-files-1.outputs) }}'
@@ -318,6 +319,7 @@ jobs:
with:
base_sha: 4d04215
sha: fe238e6
include_all_old_new_renamed_files: true
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files-all-old-new-renamed-files-2.outputs) }}'

View File

@@ -1,8 +1,22 @@
# Changelog
## [Unreleased](https://github.com/tj-actions/changed-files/tree/HEAD)
## [v20.2](https://github.com/tj-actions/changed-files/tree/v20.2) (2022-05-24)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v20...HEAD)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v20.1...v20.2)
**Fixed bugs:**
- \[BUG\] old\_new\_renamed\_files is empty when providing a glob pattern. [\#467](https://github.com/tj-actions/changed-files/issues/467)
**Merged pull requests:**
- fix: matching renamed files with glob patterns [\#498](https://github.com/tj-actions/changed-files/pull/498) ([jackton1](https://github.com/jackton1))
- chore: Improve test coverage [\#497](https://github.com/tj-actions/changed-files/pull/497) ([jackton1](https://github.com/jackton1))
- Upgraded to v20.1 [\#496](https://github.com/tj-actions/changed-files/pull/496) ([jackton1](https://github.com/jackton1))
## [v20.1](https://github.com/tj-actions/changed-files/tree/v20.1) (2022-05-22)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v20...v20.1)
**Implemented enhancements:**
@@ -10,8 +24,15 @@
**Fixed bugs:**
- \[BUG\] Glob pattern doesn't work for markdown files [\#492](https://github.com/tj-actions/changed-files/issues/492)
- \[BUG\] Using the fork point to detect file changes. [\#355](https://github.com/tj-actions/changed-files/issues/355)
**Merged pull requests:**
- chore: test rename [\#495](https://github.com/tj-actions/changed-files/pull/495) ([jackton1](https://github.com/jackton1))
- chore: Update README.md [\#494](https://github.com/tj-actions/changed-files/pull/494) ([jackton1](https://github.com/jackton1))
- Upgraded to v20 [\#491](https://github.com/tj-actions/changed-files/pull/491) ([jackton1](https://github.com/jackton1))
## [v20](https://github.com/tj-actions/changed-files/tree/v20) (2022-05-15)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v19.3...v20)
@@ -34,10 +55,6 @@
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v19.1...v19.2)
**Implemented enhancements:**
- \[Feature\] Provide Original Filename in a Rename [\#467](https://github.com/tj-actions/changed-files/issues/467)
**Closed issues:**
- Dependency Dashboard [\#27](https://github.com/tj-actions/changed-files/issues/27)
@@ -655,7 +672,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:**
@@ -669,13 +686,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:**
@@ -1067,7 +1084,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:**
@@ -1083,13 +1100,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

@@ -67,7 +67,7 @@ jobs:
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v20
uses: tj-actions/changed-files@v20.2
- name: List all changed files
run: |
@@ -129,6 +129,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) |
| separator | `string` | `false` | `' '` | Split character for output strings |
| include\_all\_old\_new\_renamed\_files | `boolean` | `false` | `false` | Include `all_old_new_renamed_files` output. Note this can generate a large debug output See: [#501](https://github.com/tj-actions/changed-files/issues/501). |
| old\_new\_separator | `string` | `false` | `','` | Split character for old and new filename pairs |
| old\_new\_files\_separator | `string` | `false` | `' '` | Split character for multiple old and new filename pairs |
| files | `string` OR `string[]` | `false` | | Check for changes <br> using only these <br> list of file(s) <br> (Defaults to the <br> entire repo) |
@@ -140,9 +141,9 @@ Support this project with a :star:
| sha | `string` | `true` | `${{ github.sha }}` | Specify a different <br> 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 |
| path | `string` | `false` | | Relative path under <br> `GITHUB_WORKSPACE` <br> to the repository |
| since\_last\_remote\_commit | `string` | `false` | `false` | Use the last commit on the remote <br> branch as the `base_sha` <br> (Defaults to the last commit <br> on the target branch for Pull requests <br> or the previous commit <br> on the current branch <br> for push events). <br /> NOTE: This requires <br /> `fetch-depth: 0` <br /> with `actions/checkout@v2` |
| use\_fork\_point | `string` | `false` | `false` | Finds best common ancestor <br /> between two commits <br /> to use in a three-way merge <br /> as the `base_sha` <br /> See: [git merge-base](https://git-scm.com/docs/git-merge-base#Documentation/git-merge-base.txt---fork-point). <br> NOTE: This pulls the entire commit history of the base branch |
| quotepath | `string` | `false` | `true` | Output filenames completely verbatim by setting this to `false` |
| since\_last\_remote\_commit | `boolean` | `false` | `false` | Use the last commit on the remote <br> branch as the `base_sha` <br> (Defaults to the last commit <br> on the target branch for Pull requests <br> or the previous commit <br> on the current branch <br> for push events). <br /> NOTE: This requires <br /> `fetch-depth: 0` <br /> with `actions/checkout@v2` |
| use\_fork\_point | `boolean` | `false` | `false` | Finds best common ancestor <br /> between two commits <br /> to use in a three-way merge <br /> as the `base_sha` <br /> See: [git merge-base](https://git-scm.com/docs/git-merge-base#Documentation/git-merge-base.txt---fork-point). <br> NOTE: This pulls the entire commit history of the base branch |
| quotepath | `boolean` | `false` | `true` | Output filenames completely verbatim by setting this to `false` |
## Example
@@ -156,11 +157,11 @@ Support this project with a :star:
- name: Get changed files using defaults
id: changed-files
uses: tj-actions/changed-files@v20
uses: tj-actions/changed-files@v20.2
- name: Get changed files using a comma separator
id: changed-files-comma
uses: tj-actions/changed-files@v20
uses: tj-actions/changed-files@v20.2
with:
separator: ","
@@ -182,7 +183,7 @@ Support this project with a :star:
- name: Get specific changed files
id: changed-files-specific
uses: tj-actions/changed-files@v20
uses: tj-actions/changed-files@v20.2
with:
files: |
my-file.txt
@@ -223,14 +224,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@v20
uses: tj-actions/changed-files@v20.2
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@v20
uses: tj-actions/changed-files@v20.2
with:
files_from_source_file: |
test/changed-files-list.txt
@@ -239,13 +240,13 @@ Support this project with a :star:
- name: Use a different commit SHA
id: changed-files-custom-sha
uses: tj-actions/changed-files@v20
uses: tj-actions/changed-files@v20.2
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@v20
uses: tj-actions/changed-files@v20.2
with:
base_sha: "2096ed0"
@@ -257,7 +258,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@v20
uses: tj-actions/changed-files@v20.2
with:
path: dir1
@@ -269,19 +270,19 @@ 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@v20
uses: tj-actions/changed-files@v20.2
with:
since_last_remote_commit: "true"
- name: Run changed-files using the fork point of a pull request
id: changed-files-fork-point
uses: tj-actions/changed-files@v20
uses: tj-actions/changed-files@v20.2
with:
use_fork_point: "true"
- name: Run changed-files with quotepath disabled
id: changed-files-quotepath
uses: tj-actions/changed-files@v20
uses: tj-actions/changed-files@v20.2
with:
quotepath: "false"
@@ -335,7 +336,7 @@ With the switch from using grep's Extended regex to match files to the natively
- name: Get specific changed files
id: changed-files-specific
uses: tj-actions/changed-files@v20
uses: tj-actions/changed-files@v20.2
with:
files: |
*.sh

View File

@@ -11,6 +11,10 @@ inputs:
description: 'Split character for output strings'
required: false
default: " "
include_all_old_new_renamed_files:
description: 'Include all_old_new_renamed_files output. Note this can generate a large debug output See: #501.'
required: false
default: false
old_new_separator:
description: 'Split character for old and new filename pairs'
required: false
@@ -193,6 +197,7 @@ runs:
INPUT_TARGET_BRANCH: ${{ steps.changed-files-diff-sha.outputs.target_branch }}
INPUT_CURRENT_BRANCH: ${{ steps.changed-files-diff-sha.outputs.current_branch }}
INPUT_QUOTEPATH: ${{ inputs.quotepath }}
INPUT_INCLUDE_ALL_OLD_NEW_RENAMED_FILES: ${{ inputs.include_all_old_new_renamed_files }}
INPUT_OLD_NEW_SEPARATOR: ${{ inputs.old_new_separator }}
INPUT_OLD_NEW_FILES_SEPARATOR: ${{ inputs.old_new_files_separator }}

View File

@@ -46,12 +46,8 @@ function get_renames() {
)
fi
done < <(git submodule | awk '{print $2}')
if [ -n "$(git log --name-status --ignore-submodules=all "$base".."$sha")" ]; then
git log --name-status --ignore-submodules=all "$base".."$sha" | grep -E "^R" | awk -F '\t' -v d="$INPUT_OLD_NEW_SEPARATOR" '{print $2d$3}'
else
git diff --diff-filter=R --name-status --ignore-submodules=all "$base" "$sha" | grep -E "^R" | awk -F '\t' -v d="$INPUT_OLD_NEW_SEPARATOR" '{print $2d$3}'
fi
git log --name-status --ignore-submodules=all "$base".."$sha" | grep -E "^R" | awk -F '\t' -v d="$INPUT_OLD_NEW_SEPARATOR" '{print $2d$3}'
}
echo "::group::changed-files"
@@ -83,7 +79,9 @@ if [[ -z "$INPUT_FILES_PATTERN_FILE" ]]; then
ALL_CHANGED_AND_MODIFIED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" "*ACDMRTUX" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
ALL_CHANGED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" "ACMR" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
ALL_MODIFIED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" "ACMRD" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
ALL_OLD_NEW_RENAMED_FILES=$(get_renames "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" | awk -v d="$INPUT_OLD_NEW_FILES_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
if [[ $INPUT_INCLUDE_ALL_OLD_NEW_RENAMED_FILES == "true" ]]; then
ALL_OLD_NEW_RENAMED_FILES=$(get_renames "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" | awk -v d="$INPUT_OLD_NEW_FILES_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
fi
else
ADDED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" A | grep -x -E -f "$INPUT_FILES_PATTERN_FILE" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
COPIED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" C | grep -x -E -f "$INPUT_FILES_PATTERN_FILE" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
@@ -96,7 +94,9 @@ else
ALL_CHANGED_AND_MODIFIED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" "*ACDMRTUX" | grep -x -E -f "$INPUT_FILES_PATTERN_FILE" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
ALL_CHANGED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" "ACMR" | grep -x -E -f "$INPUT_FILES_PATTERN_FILE" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
ALL_MODIFIED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" "ACMRD" | grep -x -E -f "$INPUT_FILES_PATTERN_FILE" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
ALL_OLD_NEW_RENAMED_FILES=$(get_renames "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" | grep -x -E -f "$INPUT_FILES_PATTERN_FILE" | awk -v d="$INPUT_OLD_NEW_FILES_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
if [[ $INPUT_INCLUDE_ALL_OLD_NEW_RENAMED_FILES == "true" ]]; then
ALL_OLD_NEW_RENAMED_FILES=$(get_renames "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" | grep -w -E -f "$INPUT_FILES_PATTERN_FILE" | awk -v d="$INPUT_OLD_NEW_FILES_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
fi
ALL_OTHER_CHANGED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" "ACMR" | 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}')
@@ -212,7 +212,9 @@ echo "Unknown files: $UNKNOWN"
echo "All changed and modified files: $ALL_CHANGED_AND_MODIFIED"
echo "All changed files: $ALL_CHANGED"
echo "All modified files: $ALL_MODIFIED"
echo "All old & new renamed files: $ALL_OLD_NEW_RENAMED_FILES"
if [[ $INPUT_INCLUDE_ALL_OLD_NEW_RENAMED_FILES == "true" ]]; then
echo "All old & new renamed files: $ALL_OLD_NEW_RENAMED_FILES"
fi
echo "::set-output name=added_files::$ADDED"
echo "::set-output name=copied_files::$COPIED"
@@ -225,6 +227,8 @@ echo "::set-output name=unknown_files::$UNKNOWN"
echo "::set-output name=all_changed_and_modified_files::$ALL_CHANGED_AND_MODIFIED"
echo "::set-output name=all_changed_files::$ALL_CHANGED"
echo "::set-output name=all_modified_files::$ALL_MODIFIED"
echo "::set-output name=all_old_new_renamed_files::$ALL_OLD_NEW_RENAMED_FILES"
if [[ $INPUT_INCLUDE_ALL_OLD_NEW_RENAMED_FILES == "true" ]]; then
echo "::set-output name=all_old_new_renamed_files::$ALL_OLD_NEW_RENAMED_FILES"
fi
echo "::endgroup::"