Compare commits

...

51 Commits

Author SHA1 Message Date
Tonye Jack
9c1a181e67 Update README.md 2021-12-17 15:01:08 -05:00
Tonye Jack
b160683938 Update README.md 2021-12-17 15:00:14 -05:00
Tonye Jack
78b8e06a07 Update entrypoint.sh 2021-12-14 16:55:39 -05:00
Tonye Jack
8ddde738a5 Upgraded from v1.1.4 -> v12 (#287)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-12-14 02:24:18 -05:00
Tonye Jack
019a09d36e Upgraded from v11.9 -> v1.1.4 (#286)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-12-14 02:06:26 -05:00
Tonye Jack
c78c155cf0 [PR 2]: Added support for listing all modified files. (#285)
* Added support for listing all modified files.

* Updated the test.
2021-12-14 02:01:31 -05:00
Tonye Jack
20765a994f Renamed all_modified_files to all_changed_files (#283) 2021-12-14 00:21:49 -05:00
Renovate Bot
8a6f638464 Update peter-evans/create-pull-request action to v3.12.0 2021-12-13 22:00:03 -05:00
Tonye Jack
c4ea3ea9f8 Update README.md 2021-12-05 09:02:35 -05:00
Tonye Jack
243fa32395 Update README.md 2021-12-05 09:01:53 -05:00
Tonye Jack
3c15e7e4d4 Update entrypoint.sh 2021-12-05 08:46:29 -05:00
Tonye Jack
3bd96ae803 Upgraded from v1.3.1 -> v11.9 (#280)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-12-04 16:45:22 -05:00
Tonye Jack
3b638a9708 Upgraded from v11.8 -> v1.3.1 (#279)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-12-04 16:39:14 -05:00
Tonye Jack
188487d180 Fixed regression bug with base_sha for pull_request (#278)
* Fixed regression bug with base_sha for pull_request

Fixes: #276

* Update action.yml

* Update entrypoint.sh

* Update entrypoint.sh

* Update entrypoint.sh

* Update entrypoint.sh
2021-12-04 16:34:44 -05:00
Tonye Jack
922308f3c8 Update entrypoint.sh (#277) 2021-12-04 16:14:27 -05:00
Tonye Jack
f2bbfc138b Upgraded from v1.3.0 -> v11.8 (#275)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-12-04 08:01:23 -05:00
Tonye Jack
b42f932be5 Upgraded from v11.7 -> v1.3.0 (#274)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-12-04 07:58:46 -05:00
Tonye Jack
30988915fa Update entrypoint.sh 2021-12-04 07:50:37 -05:00
Tonye Jack
f4ece4ed57 Resolve error adding remote (#269)
Fixes: #268
2021-12-04 07:49:00 -05:00
Tonye Jack
b1b88f09a2 Resolve error setting the base sha (#272)
* Resolve error setting the base sha

* Update action.yml

* Update action.yml
2021-12-04 07:31:37 -05:00
Tonye Jack
66714ebcad Fixed error with test (#270)
* Fixed error with test

* Update action.yml
2021-12-04 07:00:44 -05:00
Tonye Jack
3ef3d14e6d Improve error handling (#263)
* Improve error handling

Fixes: #255

* Update entrypoint.sh

* Update entrypoint.sh

* Update error checking

* Update test.yml

* Update test.yml

* Update test.yml

* Update entrypoint.sh

* Update action.yml

* Update entrypoint.sh

* Update entrypoint.sh

* Update entrypoint.sh

* Update test.yml

* Update entrypoint.sh

* Update test.yml

* Update test.yml

* Update test.yml

* Update entrypoint.sh

* Update entrypoint.sh

* Update entrypoint.sh

* Update test.yml
2021-12-04 06:11:27 -05:00
Tonye Jack
0a8c804187 Update base sha step to use output grouping (#266)
* Update base sha step to use output grouping

* Update action.yml

* Update action.yml

* Update action.yml
2021-11-30 12:12:51 -05:00
Tonye Jack
fb46697b26 Update README.md (#262) 2021-11-29 16:02:29 -05:00
Tonye Jack
243b81766a Updated README.md (#260)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-11-24 15:25:57 -05:00
Tonye Jack
e71d15e5da Update README.md 2021-11-24 14:54:01 -05:00
Tonye Jack
a3d0fc798e Update README.md 2021-11-24 14:51:55 -05:00
Tonye Jack
cb2ab79827 Update README.md 2021-11-24 14:04:39 -05:00
Tonye Jack
5515da09bf Update README.md 2021-11-19 23:59:21 -05:00
Tonye Jack
1622678cd7 Update README.md 2021-11-19 17:15:35 -05:00
Tonye Jack
400b2ce7f5 Updated README.md (#258)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-11-19 17:07:26 -05:00
Tonye Jack
9046b77400 Update README.md 2021-11-19 17:00:55 -05:00
Tonye Jack
98695e35af Update README.md 2021-11-19 16:56:40 -05:00
Tonye Jack
248a1050a8 Upgraded from v1.2.2 -> v11.7 (#257)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-11-19 16:53:00 -05:00
Tonye Jack
8dfe0ee3f4 Upgraded from v11.6 -> v1.2.2 (#256)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-11-19 16:36:07 -05:00
Tonye Jack
467d26c8b7 Updated git fetch to pull the last remote commit (#254)
* Update entrypoint.sh

* Update entrypoint.sh

* Update entrypoint.sh

* Update entrypoint.sh

* Update entrypoint.sh

* Update entrypoint.sh
2021-11-19 16:27:56 -05:00
Tonye Jack
bb40edd264 Update README.md 2021-11-18 19:09:51 -05:00
Tonye Jack
c6de787438 Updated .github/workflows/auto-merge.yml 2021-11-16 16:27:36 -05:00
Renovate Bot
45f1e8fb92 Update reviewdog/action-shellcheck action to v1.12 2021-11-16 11:01:29 -05:00
Renovate Bot
ff85b03c27 Update reviewdog/action-shellcheck action to v1.11 2021-11-13 05:10:59 -05:00
Tonye Jack
bc42b5f993 Upgraded from v1.2.1 -> v11.6 (#249)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-11-08 09:35:03 -05:00
Tonye Jack
aae164d51b Upgraded from v1.2.0 -> v1.2.1 (#248)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-11-08 08:35:22 -05:00
Tonye Jack
d9eb683b30 Updated formatting of all modified debug message (#247)
* Updated formatting of all modified debug message

* Update entrypoint.sh

* Update changed-files-list.txt

* Update changed-files-list.txt
2021-11-08 08:17:51 -05:00
Renovate Bot
3f78450f6c Update reviewdog/action-shellcheck action to v1.10 2021-11-07 10:37:02 -05:00
Tonye Jack
b84b6ca11b Update README.md 2021-11-04 01:55:44 -04:00
Renovate Bot
fa48a435b3 Update peter-evans/create-pull-request action to v3.11.0 2021-11-03 23:05:00 -04:00
Renovate Bot
2a91a6204f Update actions/checkout action to v2.4.0 2021-11-02 15:47:19 -04:00
Tonye Jack
a6d5b37cba Removed unused check 2021-11-02 07:43:24 -04:00
Tonye Jack
3ebf0a6369 Update README.md 2021-10-30 20:13:18 -04:00
Tonye Jack
ddc5ed8372 Update README.md 2021-10-30 16:23:17 -04:00
Tonye Jack
8bf07a8b5d Upgraded from v11.4 -> v11.5 (#241)
Co-authored-by: jackton1 <jackton1@users.noreply.github.com>
2021-10-30 16:19:47 -04:00
10 changed files with 472 additions and 102 deletions

View File

@@ -2,7 +2,6 @@ name: automerge
on:
check_suite:
types:
- rerequested
- completed
jobs:
@@ -19,7 +18,7 @@ jobs:
- name: automerge
uses: pascalgn/automerge-action@v0.14.3
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN || github.token }}
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
MERGE_METHOD: "rebase"
UPDATE_METHOD: "rebase"
MERGE_RETRIES: "6"

View File

@@ -8,7 +8,7 @@ jobs:
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.5
- uses: actions/checkout@v2.4.0
with:
token: ${{ secrets.PAT_TOKEN }}
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo

View File

@@ -8,7 +8,7 @@ jobs:
update-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.5
- uses: actions/checkout@v2.4.0
with:
fetch-depth: 0
- name: Sync release version.
@@ -23,7 +23,7 @@ jobs:
with:
output: 'HISTORY.md'
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3.10.1
uses: peter-evans/create-pull-request@v3.12.0
with:
base: "main"
title: "Upgraded to ${{ steps.sync-release-version.outputs.new_version }}"

View File

@@ -18,7 +18,7 @@ jobs:
- name: Checkout to branch
uses: actions/checkout@v2
- name: shellcheck
uses: reviewdog/action-shellcheck@v1.9
uses: reviewdog/action-shellcheck@v1.12
test-multiple-repositories:
name: Test with multiple repositories
@@ -73,8 +73,8 @@ jobs:
shell:
bash
test-no-head-sha:
name: Test changed-files missing head sha
test-non-existent-base-sha:
name: Test changed-files non existent base sha
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
@@ -85,10 +85,12 @@ jobs:
- name: Checkout to branch
uses: actions/checkout@v2
- name: Run changed-files with defaults
- name: Run changed-files with non existent base sha
id: changed-files
continue-on-error: true
uses: ./
continue-on-error: true
with:
base_sha: "4554456"
- name: Show output
run: |
@@ -96,6 +98,59 @@ jobs:
shell:
bash
- name: Run changed-files-specific with non existent base sha
id: changed-files-specific
uses: ./
continue-on-error: true
with:
files: action.yml
base_sha: "4554456"
- name: Show output
run: |
echo "${{ toJSON(steps.changed-files-specific.outputs) }}"
shell:
bash
test-non-existent-sha:
name: Test changed-files non existent sha
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest, macos-11, ubuntu-18.04, windows-2022, windows-2016]
steps:
- name: Checkout to branch
uses: actions/checkout@v2
- name: Run changed-files with non existent sha
id: changed-files
uses: ./
continue-on-error: true
with:
base_sha: "4554456"
- name: Show output
run: |
echo "${{ toJSON(steps.changed-files.outputs) }}"
shell:
bash
- name: Run changed-files-specific with non existent sha
id: changed-files-specific
uses: ./
continue-on-error: true
with:
files: action.yml
base_sha: "4554456"
- name: Show output
run: |
echo "${{ toJSON(steps.changed-files-specific.outputs) }}"
shell:
bash
test:
name: Test changed-files
runs-on: ${{ matrix.platform }}
@@ -173,7 +228,7 @@ jobs:
shell:
bash
- name: Verify any_changed 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')"
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: |
if [[ "${{ steps.changed-files-specific.outputs.any_changed }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific.outputs.any_changed }})"
@@ -181,6 +236,15 @@ jobs:
fi
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: |
if [[ "${{ steps.changed-files-specific.outputs.any_modified }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific.outputs.any_modified }})"
exit 1
fi
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: |
@@ -197,10 +261,22 @@ jobs:
files: |
entrypoint.sh
*.sh
- name: Verify all_changed_and_modified_files files has no duplicates
if: contains(steps.changed-files-specific-duplicate-output.outputs.all_modified_files, 'entrypoint.sh')
- name: Verify all_changed_files files has no duplicates
if: contains(steps.changed-files-specific-duplicate-output.outputs.all_changed_files, 'entrypoint.sh')
run: |
ALL_CHANGED_AND_MODIFIED_FILES=(${{ steps.changed-files-specific-duplicate-output.outputs.all_modified_files }})
ALL_CHANGED_FILES=(${{ steps.changed-files-specific-duplicate-output.outputs.all_changed_files }})
UNIQUE_ALL_CHANGED_FILES=$(echo "$ALL_CHANGED_FILES" | tr ' ' '\n' | sort -u | xargs)
if [[ "$ALL_CHANGED_FILES[@]" != "$UNIQUE_ALL_CHANGED_FILES[@]" ]]; then
echo "Duplicate output: Expected "$UNIQUE_ALL_CHANGED_FILES" got $ALL_CHANGED_FILES"
exit 1
fi
shell:
bash
- name: Verify all_changed_and_modified_files files has no duplicates
if: contains(steps.changed-files-specific-duplicate-output.outputs.all_changed_and_modified_files, 'entrypoint.sh')
run: |
ALL_CHANGED_AND_MODIFIED_FILES=(${{ steps.changed-files-specific-duplicate-output.outputs.all_changed_and_modified_files }})
UNIQUE_ALL_CHANGED_AND_MODIFIED_FILES=$(echo "$ALL_CHANGED_AND_MODIFIED_FILES" | tr ' ' '\n' | sort -u | xargs)
if [[ "$ALL_CHANGED_AND_MODIFIED_FILES[@]" != "$UNIQUE_ALL_CHANGED_AND_MODIFIED_FILES[@]" ]]; then
@@ -209,6 +285,18 @@ jobs:
fi
shell:
bash
- name: Verify all_modified_files files has no duplicates
if: contains(steps.changed-files-specific-duplicate-output.outputs.all_modified_files, 'entrypoint.sh')
run: |
ALL_MODIFIED_FILES=(${{ steps.changed-files-specific-duplicate-output.outputs.all_modified_files }})
UNIQUE_ALL_MODIFIED_FILES=$(echo "$ALL_MODIFIED_FILES" | tr ' ' '\n' | sort -u | xargs)
if [[ "$ALL_MODIFIED_FILES[@]" != "$UNIQUE_ALL_MODIFIED_FILES[@]" ]]; then
echo "Duplicate output: Expected "$UNIQUE_ALL_MODIFIED_FILES" got $ALL_MODIFIED_FILES"
exit 1
fi
shell:
bash
- name: Run changed-files with specific files comma separator
id: changed-files-specific-comma
uses: ./
@@ -223,7 +311,7 @@ jobs:
shell:
bash
- name: Verify any_changed files comma separator
if: "!contains(steps.changed-files-specific-comma.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific-comma.outputs.all_modified_files, '.github/workflows/test.yml')"
if: "!contains(steps.changed-files-specific-comma.outputs.all_changed_files, 'action.yml') && !contains(steps.changed-files-specific-comma.outputs.all_changed_files, '.github/workflows/test.yml')"
run: |
if [[ "${{ steps.changed-files-specific-comma.outputs.any_changed }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-comma.outputs.any_changed }})"
@@ -231,6 +319,15 @@ jobs:
fi
shell:
bash
- name: Verify any_modified files comma separator
if: "!contains(steps.changed-files-specific-comma.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific-comma.outputs.all_modified_files, '.github/workflows/test.yml')"
run: |
if [[ "${{ steps.changed-files-specific-comma.outputs.any_modified }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-comma.outputs.any_modified }})"
exit 1
fi
shell:
bash
- name: Verify any_deleted files comma separator
if: "!contains(steps.changed-files-specific-comma.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific-comma.outputs.deleted_files, '.github/workflows/test.yml')"
run: |
@@ -254,7 +351,7 @@ jobs:
shell:
bash
- name: Verify any_changed files comma separator
if: "!contains(steps.changed-files-specific-pipe.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific-pipe.outputs.all_modified_files, '.github/workflows/test.yml')"
if: "!contains(steps.changed-files-specific-pipe.outputs.all_changed_files, 'action.yml') && !contains(steps.changed-files-specific-pipe.outputs.all_changed_files, '.github/workflows/test.yml')"
run: |
if [[ "${{ steps.changed-files-specific-pipe.outputs.any_changed }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-pipe.outputs.any_changed }})"
@@ -262,6 +359,15 @@ jobs:
fi
shell:
bash
- name: Verify any_modified files comma separator
if: "!contains(steps.changed-files-specific-pipe.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific-pipe.outputs.all_modified_files, '.github/workflows/test.yml')"
run: |
if [[ "${{ steps.changed-files-specific-pipe.outputs.any_modified }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-pipe.outputs.any_modified }})"
exit 1
fi
shell:
bash
- name: Verify any_deleted files comma separator
if: "!contains(steps.changed-files-specific-pipe.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific-pipe.outputs.deleted_files, '.github/workflows/test.yml')"
run: |
@@ -285,7 +391,7 @@ jobs:
shell:
bash
- name: Verify any_changed files comma separator
if: "!contains(steps.changed-files-specific-forward-slash.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific-forward-slash.outputs.all_modified_files, '.github/workflows/test.yml')"
if: "!contains(steps.changed-files-specific-forward-slash.outputs.all_changed_files, 'action.yml') && !contains(steps.changed-files-specific-forward-slash.outputs.all_changed_files, '.github/workflows/test.yml')"
run: |
if [[ "${{ steps.changed-files-specific.outputs.any_changed }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-forward-slash.outputs.any_changed }})"
@@ -293,6 +399,15 @@ jobs:
fi
shell:
bash
- name: Verify any_modified files comma separator
if: "!contains(steps.changed-files-specific-forward-slash.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific-forward-slash.outputs.all_modified_files, '.github/workflows/test.yml')"
run: |
if [[ "${{ steps.changed-files-specific.outputs.any_modified }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-forward-slash.outputs.any_modified }})"
exit 1
fi
shell:
bash
- name: Verify any_deleted files comma separator
if: "!contains(steps.changed-files-specific-forward-slash.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific-forward-slash.outputs.deleted_files, '.github/workflows/test.yml')"
run: |
@@ -312,6 +427,20 @@ jobs:
files: |
.github/workflows/rebase.yml
- name: Verify any_changed from source files
if: |
(
!contains(steps.changed-files-specific-source-file.outputs.all_changed_files, 'action.yml') &&
!contains(steps.changed-files-specific-source-file.outputs.all_changed_files, '.github/workflows/test.yml') &&
!contains(steps.changed-files-specific-source-file.outputs.all_changed_files, '.github/workflows/rebase.yml')
)
run: |
if [[ "${{ steps.changed-files-specific-source-file.outputs.any_changed }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-source-file.outputs.any_changed }})"
exit 1
fi
shell:
bash
- name: Verify any_modified from source files
if: |
(
!contains(steps.changed-files-specific-source-file.outputs.all_modified_files, 'action.yml') &&
@@ -319,8 +448,8 @@ jobs:
!contains(steps.changed-files-specific-source-file.outputs.all_modified_files, '.github/workflows/rebase.yml')
)
run: |
if [[ "${{ steps.changed-files-specific-source-file.outputs.any_changed }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-source-file.outputs.any_changed }})"
if [[ "${{ steps.changed-files-specific-source-file.outputs.any_modified }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-source-file.outputs.any_modified }})"
exit 1
fi
shell:
@@ -352,7 +481,7 @@ jobs:
shell:
bash
- name: Verify any_changed files comma separator
if: "!contains(steps.changed-files-specific-comma-source-file.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific-comma-source-file.outputs.all_modified_files, '.github/workflows/test.yml')"
if: "!contains(steps.changed-files-specific-comma-source-file.outputs.all_changed_files, 'action.yml') && !contains(steps.changed-files-specific-comma-source-file.outputs.all_changed_files, '.github/workflows/test.yml')"
run: |
if [[ "${{ steps.changed-files-specific-comma-source-file.outputs.any_changed }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-comma-source-file.outputs.any_changed }})"
@@ -360,6 +489,15 @@ jobs:
fi
shell:
bash
- name: Verify any_modified files comma separator
if: "!contains(steps.changed-files-specific-comma-source-file.outputs.all_modified_files, 'action.yml') && !contains(steps.changed-files-specific-comma-source-file.outputs.all_modified_files, '.github/workflows/test.yml')"
run: |
if [[ "${{ steps.changed-files-specific-comma-source-file.outputs.any_modified }}" != "false" ]]; then
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-comma-source-file.outputs.any_modified }})"
exit 1
fi
shell:
bash
- name: Verify any_deleted files with comma separator
if: "!contains(steps.changed-files-specific-comma-source-file.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific-comma-source-file.outputs.deleted_files, '.github/workflows/test.yml')"
run: |
@@ -379,15 +517,6 @@ jobs:
echo '${{ toJSON(steps.changed-files-custom-sha.outputs) }}'
shell:
bash
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v5
- uses: nrwl/last-successful-commit-action@v1
id: last_successful_commit
with:
branch: ${{ steps.branch-name.outputs.base_ref_branch }}
workflow_id: 'test.yml'
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Run changed-files with since_last_remote_commit set to true
id: changed-files-since-last-remote-commit
uses: ./
@@ -398,12 +527,25 @@ jobs:
echo '${{ toJSON(steps.changed-files-since-last-remote-commit.outputs) }}'
shell:
bash
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v5
if: github.event_name == 'pull_request'
- uses: nrwl/last-successful-commit-action@v1
id: last_successful_commit
if: github.event_name == 'pull_request'
with:
branch: ${{ steps.branch-name.outputs.base_ref_branch }}
workflow_id: 'test.yml'
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Run changed-files with a custom base sha
if: github.event_name == 'pull_request'
id: changed-files-custom-base-sha
uses: ./
with:
base_sha: ${{ steps.last_successful_commit.outputs.commit_hash }}
- name: Show output
if: github.event_name == 'pull_request'
run: |
echo '${{ toJSON(steps.changed-files-custom-base-sha.outputs) }}'
shell:

View File

@@ -9,7 +9,7 @@ jobs:
sync-assets:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.5
- uses: actions/checkout@v2.4.0
with:
fetch-depth: 0

View File

@@ -1,5 +1,153 @@
# Changelog
## [v12](https://github.com/tj-actions/changed-files/tree/v12) (2021-12-14)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v1.1.4...v12)
**Merged pull requests:**
- Upgraded to v1.1.4 [\#286](https://github.com/tj-actions/changed-files/pull/286) ([jackton1](https://github.com/jackton1))
## [v1.1.4](https://github.com/tj-actions/changed-files/tree/v1.1.4) (2021-12-14)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v11.9...v1.1.4)
**Implemented enhancements:**
- \[Feature\] Add "any\_modified", "other\_modified\_files" and "all\_modified" outputs containing created, edit, renamed, or deleted files [\#282](https://github.com/tj-actions/changed-files/issues/282)
**Fixed bugs:**
- \[BUG\] Failed to get change files on pull\_request merge event [\#281](https://github.com/tj-actions/changed-files/issues/281)
**Closed issues:**
- Dependency Dashboard [\#27](https://github.com/tj-actions/changed-files/issues/27)
**Merged pull requests:**
- \[PR 2\]: Added support for listing all\_modified\_files. [\#285](https://github.com/tj-actions/changed-files/pull/285) ([jackton1](https://github.com/jackton1))
- Update peter-evans/create-pull-request action to v3.12.0 [\#284](https://github.com/tj-actions/changed-files/pull/284) ([renovate[bot]](https://github.com/apps/renovate))
- \[PR 1\]: Renamed all\_modified\_files to all\_changed\_files [\#283](https://github.com/tj-actions/changed-files/pull/283) ([jackton1](https://github.com/jackton1))
- Upgraded to v11.9 [\#280](https://github.com/tj-actions/changed-files/pull/280) ([jackton1](https://github.com/jackton1))
## [v11.9](https://github.com/tj-actions/changed-files/tree/v11.9) (2021-12-04)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v1.3.1...v11.9)
**Implemented enhancements:**
- Can't get `since_last_remote_commit` to work properly on pull\_request event [\#276](https://github.com/tj-actions/changed-files/issues/276)
**Merged pull requests:**
- Upgraded to v1.3.1 [\#279](https://github.com/tj-actions/changed-files/pull/279) ([jackton1](https://github.com/jackton1))
## [v1.3.1](https://github.com/tj-actions/changed-files/tree/v1.3.1) (2021-12-04)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v11.8...v1.3.1)
**Merged pull requests:**
- Fixed regression bug with base\_sha for pull\_request [\#278](https://github.com/tj-actions/changed-files/pull/278) ([jackton1](https://github.com/jackton1))
- Prevent outputting remote not found error message. [\#277](https://github.com/tj-actions/changed-files/pull/277) ([jackton1](https://github.com/jackton1))
- Upgraded to v11.8 [\#275](https://github.com/tj-actions/changed-files/pull/275) ([jackton1](https://github.com/jackton1))
## [v11.8](https://github.com/tj-actions/changed-files/tree/v11.8) (2021-12-04)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v1.3.0...v11.8)
**Merged pull requests:**
- Upgraded to v1.3.0 [\#274](https://github.com/tj-actions/changed-files/pull/274) ([jackton1](https://github.com/jackton1))
## [v1.3.0](https://github.com/tj-actions/changed-files/tree/v1.3.0) (2021-12-04)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v11.7...v1.3.0)
**Implemented enhancements:**
- \[Feature\] Improve error handling of non local commit reference [\#255](https://github.com/tj-actions/changed-files/issues/255)
**Fixed bugs:**
- \[BUG\] When running in a workflow generated by a dependabot BUMP PR, the action fails [\#268](https://github.com/tj-actions/changed-files/issues/268)
**Closed issues:**
- Fix code scanning alert - Warn when duplicate definitions are found. [\#267](https://github.com/tj-actions/changed-files/issues/267)
**Merged pull requests:**
- Resolve error setting the base sha [\#272](https://github.com/tj-actions/changed-files/pull/272) ([jackton1](https://github.com/jackton1))
- Fixed error with test [\#270](https://github.com/tj-actions/changed-files/pull/270) ([jackton1](https://github.com/jackton1))
- Resolve error adding remote [\#269](https://github.com/tj-actions/changed-files/pull/269) ([jackton1](https://github.com/jackton1))
- Update base sha step [\#266](https://github.com/tj-actions/changed-files/pull/266) ([jackton1](https://github.com/jackton1))
- Improve error handling [\#263](https://github.com/tj-actions/changed-files/pull/263) ([jackton1](https://github.com/jackton1))
- Update README.md [\#262](https://github.com/tj-actions/changed-files/pull/262) ([jackton1](https://github.com/jackton1))
- Updated README.md [\#260](https://github.com/tj-actions/changed-files/pull/260) ([jackton1](https://github.com/jackton1))
- Updated README.md [\#258](https://github.com/tj-actions/changed-files/pull/258) ([jackton1](https://github.com/jackton1))
- Upgraded to v11.7 [\#257](https://github.com/tj-actions/changed-files/pull/257) ([jackton1](https://github.com/jackton1))
## [v11.7](https://github.com/tj-actions/changed-files/tree/v11.7) (2021-11-19)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v1.2.2...v11.7)
**Merged pull requests:**
- Upgraded to v1.2.2 [\#256](https://github.com/tj-actions/changed-files/pull/256) ([jackton1](https://github.com/jackton1))
## [v1.2.2](https://github.com/tj-actions/changed-files/tree/v1.2.2) (2021-11-19)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v11.6...v1.2.2)
**Fixed bugs:**
- \[BUG\] pull request with `since_last_remote_commit = true` returns fatal: bad object [\#253](https://github.com/tj-actions/changed-files/issues/253)
**Merged pull requests:**
- Updated git fetch to pull the last remote commit [\#254](https://github.com/tj-actions/changed-files/pull/254) ([jackton1](https://github.com/jackton1))
- Update reviewdog/action-shellcheck action to v1.12 [\#252](https://github.com/tj-actions/changed-files/pull/252) ([renovate[bot]](https://github.com/apps/renovate))
- Update reviewdog/action-shellcheck action to v1.11 [\#250](https://github.com/tj-actions/changed-files/pull/250) ([renovate[bot]](https://github.com/apps/renovate))
- Upgraded to v11.6 [\#249](https://github.com/tj-actions/changed-files/pull/249) ([jackton1](https://github.com/jackton1))
## [v11.6](https://github.com/tj-actions/changed-files/tree/v11.6) (2021-11-08)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v1.2.1...v11.6)
**Merged pull requests:**
- Upgraded to v1.2.1 [\#248](https://github.com/tj-actions/changed-files/pull/248) ([jackton1](https://github.com/jackton1))
## [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/v1.2.0...v1.2.1)
**Implemented enhancements:**
- \[Feature\] Improve documentation [\#244](https://github.com/tj-actions/changed-files/issues/244)
**Merged pull requests:**
- Updated formatting of all modified debug message [\#247](https://github.com/tj-actions/changed-files/pull/247) ([jackton1](https://github.com/jackton1))
- Update reviewdog/action-shellcheck action to v1.10 [\#246](https://github.com/tj-actions/changed-files/pull/246) ([renovate[bot]](https://github.com/apps/renovate))
- Update peter-evans/create-pull-request action to v3.11.0 [\#245](https://github.com/tj-actions/changed-files/pull/245) ([renovate[bot]](https://github.com/apps/renovate))
- 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))
## [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.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:**
- Upgraded to v11.4 [\#239](https://github.com/tj-actions/changed-files/pull/239) ([jackton1](https://github.com/jackton1))
## [v11.4](https://github.com/tj-actions/changed-files/tree/v11.4) (2021-10-30)
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v11.3...v11.4)
@@ -67,10 +215,6 @@
- \[BUG\] Spaces in file names are not handled correctly [\#216](https://github.com/tj-actions/changed-files/issues/216)
- \[BUG\] Usage of quotes around array items [\#208](https://github.com/tj-actions/changed-files/issues/208)
**Closed issues:**
- Dependency Dashboard [\#27](https://github.com/tj-actions/changed-files/issues/27)
**Merged pull requests:**
- Updated README.md [\#221](https://github.com/tj-actions/changed-files/pull/221) ([jackton1](https://github.com/jackton1))

View File

@@ -1,4 +1,5 @@
[![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) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/a3822d6c37f644bc99a5faa0bfb9c2c1)](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) [![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)
[![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)
[![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)
@@ -12,30 +13,43 @@
## changed-files
Retrieve all changed files relative to the default branch (`pull_request*` based events) or a previous commit (`push` based event) returning the **absolute path** to all changed files from the project root.
Retrieve all changed files relative to the default branch (`pull_request*` based events) or the last remote commit (`push` based event) returning the **absolute path** to all changed files from the project root.
## Features
* Fast execution (0-2 seconds on average).
* Easy to debug.
* Boolean output indicating that certain files have been modified.
* 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.
* 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.
> NOTE: :warning:
> * All users referencing the legacy `v1.x.x` version, are required to switch to `v*` or `v*.*` versioning semantic.
> * A breaking change was introduced in `v1.x.x` legacy version, which is no longer supported and future updates would only be made to `v*` or `v*.*`.
| Legacy version | Recommended version |
|---------------------|-----------------------|
| `v1.x.x` | `v12` |
## Usage
> NOTE: :warning:
>
> * **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.
```yaml
name: CI
@@ -59,15 +73,25 @@ jobs:
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v11.4
uses: tj-actions/changed-files@v12
- name: List all modified files
- name: List all changed files
run: |
for file in ${{ steps.changed-files.outputs.all_modified_files }}; do
echo "$file was modified"
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file was changed"
done
```
If you feel generous and want to show some extra appreciation:
Support this project with a :star:
[![Buy me a coffee][buymeacoffee-shield]][buymeacoffee]
[buymeacoffee]: https://www.buymeacoffee.com/jackton1
[buymeacoffee-shield]: https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png
## Outputs
| Acronym | Meaning |
@@ -84,12 +108,16 @@ jobs:
| 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. <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. (ACMR) |
| only\_changed | `string` | `true` OR `false` | Returns `true` when only <br /> files provided using <br /> the `files` input has changed. (ACMR) |
| other\_changed\_files | `string` | `'new.txt path/to/file.png ...'` | Select all other changed files <br/> not listed in the files input <br /> i.e. *a combination of all added, <br /> copied and modified files (ACMR)* |
| any\_modified | `string` | `true` OR `false` | Returns `true` when any <br /> of the filenames provided using <br /> the `files` input has been modified. <br /> i.e. *using a combination of all added, <br />copied, modified, renamed, and deleted files (ACMRD)* |
| only\_modified | `string` | `true` OR `false` | Returns `true` when only <br /> files provided using <br /> the `files` input has been modified. (ACMRD) |
| other\_modified\_files | `string` | `'new.txt path/to/file.png ...'` | Select all other modified files <br/> not listed in the files input <br /> i.e. *a combination of all added, <br /> copied, modified, and deleted files (ACMRD)* |
| any\_deleted | `string` | `true` OR `false` | Returns `true` when any <br /> of the filenames provided using <br /> the `files` input has been deleted. (D) |
| only\_deleted | `string` | `true` OR `false` | Returns `true` when only <br /> files provided using <br /> the `files` input has been deleted. (D) |
| other\_deleted\_files | `string` | `'new.txt path/to/file.png ...'` | Select all other deleted files <br/> not listed in the files input <br /> i.e. *a combination of all deleted files (D)* |
| 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\_changed\_files | `string` | `'new.txt path/to/file.png ...'` | Select all changed 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 changed files <br /> i.e. *a combination of all added, <br />copied, modified, renamed and deleted files (ACMRD)* |
| all\_changed\_and\_modified\_files | `string` | `'new.txt path/to/file.png ...'` | Select all changed <br /> and modified files <br /> i.e. *a combination of (ACMRDTUX)* |
| added\_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Added (A) |
| copied\_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Copied (C) |
@@ -111,7 +139,7 @@ jobs:
| 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 |
| 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` for push event.<br> (Defaults to the previous commit). |
| since\_last\_remote\_commit | `string` | `false` | `false` | Use the last commit on the remote <br> branch as the `base_sha` <br> (Defaults to the previous commit). <br /> NOTE: This requires <br /> `fetch-depth: 0` <br /> with `actions/checkout@v2` |
## Example
@@ -122,11 +150,11 @@ jobs:
- name: Get changed files using defaults
id: changed-files
uses: tj-actions/changed-files@v11.4
uses: tj-actions/changed-files@v12
- name: Get changed files using a comma separator
id: changed-files-comma
uses: tj-actions/changed-files@v11.4
uses: tj-actions/changed-files@v12
with:
separator: ","
@@ -148,7 +176,7 @@ jobs:
- name: Get specific changed files
id: changed-files-specific
uses: tj-actions/changed-files@v11.4
uses: tj-actions/changed-files@v12
with:
files: |
my-file.txt
@@ -186,14 +214,14 @@ jobs:
- name: Use a source file or list of file(s) to populate to files input.
id: changed-files-specific-source-file
uses: tj-actions/changed-files@v11.4
uses: tj-actions/changed-files@v12
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@v11.4
uses: tj-actions/changed-files@v12
with:
files_from_source_file: |
test/changed-files-list.txt
@@ -202,13 +230,13 @@ jobs:
- name: Use a different commit SHA
id: changed-files-custom-sha
uses: tj-actions/changed-files@v11.4
uses: tj-actions/changed-files@v12
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@v11.4
uses: tj-actions/changed-files@v12
with:
base_sha: "2096ed0"
@@ -220,7 +248,7 @@ jobs:
- name: Run changed-files with defaults on the dir1
id: changed-files-for-dir1
uses: tj-actions/changed-files@v11.4
uses: tj-actions/changed-files@v12
with:
path: dir1
@@ -230,9 +258,9 @@ jobs:
echo "$file was added"
done
- name: Run changed-files with since_last_remote_commit set to true
- name: Run changed-files using the last commit on the remote branch
id: changed-files-since-last-remote-commit
uses: tj-actions/changed-files@v11.4
uses: tj-actions/changed-files@v12
with:
since_last_remote_commit: 'true'
@@ -249,27 +277,19 @@ jobs:
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v11.4
uses: tj-actions/changed-files@v12
- name: Pre-commit
uses: pre-commit/action@v2.0.0
with:
extra_args: -v --hook-stage push --files ${{ steps.changed-files.outputs.all_modified_files }}
extra_args: -v --hook-stage push --files ${{ steps.changed-files.outputs.all_changed_files }}
token: ${{ secrets.github_token }}
```
![Screen Shot 2021-07-06 at 2 50 23 PM](https://user-images.githubusercontent.com/17484350/124651978-96ed5280-de69-11eb-86d5-396a4c1a980f.png)
![Screen Shot 2021-07-17 at 10 52 48 AM](https://user-images.githubusercontent.com/17484350/126040772-30b65afb-a6b5-4150-b312-ac2017ba7b98.png)
<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)
If you feel generous and want to show some extra appreciation:
Support me with a :star:
[![Buy me a coffee][buymeacoffee-shield]][buymeacoffee]
## Known Limitation
> NOTE: :warning:

View File

@@ -62,9 +62,9 @@ outputs:
all_changed_and_modified_files:
description: List of all changed files.
value: ${{ steps.changed-files.outputs.all_changed_and_modified_files }}
all_modified_files:
description: List of all copied modified and added files.
value: ${{ steps.changed-files.outputs.all_modified_files }}
all_changed_files:
description: List of all copied, modified, and added files.
value: ${{ steps.changed-files.outputs.all_changed_files }}
any_changed:
description: Return true only when any files provided using the files input have changed.
value: ${{ steps.changed-files.outputs.any_changed }}
@@ -74,6 +74,18 @@ outputs:
other_changed_files:
description: Return list of changed files not listed in the files input.
value: ${{ steps.changed-files.outputs.other_changed_files }}
all_modified_files:
description: List of all copied, modified, added and deleted files.
value: ${{ steps.changed-files.outputs.all_modified_files }}
any_modified:
description: Return true only when any files provided using the files input have been modified.
value: ${{ steps.changed-files.outputs.any_modified }}
only_modified:
description: Return true when all files provided using the files input have been modified.
value: ${{ steps.changed-files.outputs.only_modified }}
other_modified_files:
description: Return list of modified files not listed in the files input.
value: ${{ steps.changed-files.outputs.other_modified_files }}
any_deleted:
description: Return true only when any files provided using the files input have been deleted.
value: ${{ steps.changed-files.outputs.any_deleted }}
@@ -95,10 +107,15 @@ runs:
INPUT_FILES: ${{ inputs.files }}
INPUT_FILES_FROM_SOURCE_FILE: ${{ inputs.files_from_source_file }}
- run: |
# "Set base sha..."
if [[ -n "${{ inputs.base_sha }}" ]]; then
echo "::set-output name=base_sha::${{ inputs.base_sha }}"
elif [[ "${{ inputs.since_last_remote_commit }}" == "true" && -z "${{ inputs.base_sha }}" ]]; then
echo "::set-output name=base_sha::${{ github.event.before }}"
elif [[ "${{ inputs.since_last_remote_commit }}" == "true" ]]; then
if [[ "${{ github.event.before }}" != "0000000000000000000000000000000000000000" ]]; then
echo "::set-output name=base_sha::${{ github.event.before }}"
else
echo "::set-output name=base_sha::${{ github.sha }}"
fi
fi
id: base-sha
shell: bash

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -e
set -eu
echo "::group::changed-files"
@@ -24,6 +24,7 @@ git ls-remote --exit-code temp_changed_files 1>/dev/null 2>&1 && exit_status=$?
if [[ $exit_status -ne 0 ]]; then
echo "No 'temp_changed_files' remote found"
echo "Creating 'temp_changed_files' remote..."
git remote remove temp_changed_files 2>/dev/null || true
git remote add temp_changed_files "https://${INPUT_TOKEN}@${SERVER_URL}/${GITHUB_REPOSITORY}"
else
echo "Found 'temp_changed_files' remote"
@@ -37,8 +38,11 @@ else
CURRENT_SHA=$INPUT_SHA && exit_status=$? || exit_status=$?
fi
git rev-parse --quiet --verify "$CURRENT_SHA^{commit}" 1>/dev/null 2>&1 && exit_status=$? || exit_status=$?
if [[ $exit_status -ne 0 ]]; then
echo "::warning::Unable to determine the current head sha"
echo "::warning::Unable to locate the current sha: $CURRENT_SHA"
echo "::warning::You seem to be missing 'fetch-depth: 0' or 'fetch-depth: 2'. See https://github.com/tj-actions/changed-files#usage"
git remote remove temp_changed_files
exit 1
fi
@@ -51,10 +55,13 @@ if [[ -z $GITHUB_BASE_REF ]]; then
PREVIOUS_SHA=$(git rev-parse HEAD^1 2>&1) && exit_status=$? || exit_status=$?
else
PREVIOUS_SHA=$INPUT_BASE_SHA && exit_status=$? || exit_status=$?
TARGET_BRANCH=$(git name-rev --name-only "$PREVIOUS_SHA" 2>&1) && exit_status=$? || exit_status=$?
fi
git rev-parse --quiet --verify "$PREVIOUS_SHA^{commit}" 1>/dev/null 2>&1 && exit_status=$? || exit_status=$?
if [[ $exit_status -ne 0 ]]; then
echo "::warning::Unable to determine the previous commit sha"
echo "::warning::Unable to locate the previous sha: $PREVIOUS_SHA"
echo "::warning::You seem to be missing 'fetch-depth: 0' or 'fetch-depth: 2'. See https://github.com/tj-actions/changed-files#usage"
git remote remove temp_changed_files
exit 1
@@ -62,15 +69,21 @@ if [[ -z $GITHUB_BASE_REF ]]; then
else
TARGET_BRANCH=$GITHUB_BASE_REF
CURRENT_BRANCH=$GITHUB_HEAD_REF
git fetch temp_changed_files --no-tags -u "${TARGET_BRANCH}":"${TARGET_BRANCH}"
if [[ -z $INPUT_BASE_SHA ]]; then
git fetch --no-tags -u --progress --depth=1 temp_changed_files "${TARGET_BRANCH}":"${TARGET_BRANCH}" && exit_status=$? || exit_status=$?
PREVIOUS_SHA=$(git rev-parse "${TARGET_BRANCH}" 2>&1) && exit_status=$? || exit_status=$?
else
git fetch --no-tags -u --progress --depth=1 temp_changed_files "$INPUT_BASE_SHA" && exit_status=$? || exit_status=$?
PREVIOUS_SHA=$INPUT_BASE_SHA
TARGET_BRANCH=$(git name-rev --name-only "$PREVIOUS_SHA" 2>&1) && exit_status=$? || exit_status=$?
fi
git rev-parse --quiet --verify "$PREVIOUS_SHA^{commit}" 1>/dev/null 2>&1 && exit_status=$? || exit_status=$?
if [[ $exit_status -ne 0 ]]; then
echo "::warning::Unable to determine the base ref sha for ${TARGET_BRANCH}"
echo "::warning::Unable to locate the previous sha: $PREVIOUS_SHA"
echo "::warning::You seem to be missing 'fetch-depth: 0' or 'fetch-depth: 2'. See https://github.com/tj-actions/changed-files#usage"
git remote remove temp_changed_files
exit 1
fi
@@ -78,8 +91,9 @@ fi
echo "Retrieving changes between $PREVIOUS_SHA ($TARGET_BRANCH) → $CURRENT_SHA ($CURRENT_BRANCH)"
echo "Getting diff..."
if [[ -z "${INPUT_FILES[*]}" ]]; then
echo "Getting diff..."
ADDED=$(git diff --diff-filter=A --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
COPIED=$(git diff --diff-filter=C --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
DELETED=$(git diff --diff-filter=D --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
@@ -89,9 +103,9 @@ if [[ -z "${INPUT_FILES[*]}" ]]; then
UNMERGED=$(git diff --diff-filter=U --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
UNKNOWN=$(git diff --diff-filter=X --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | awk -v d="$INPUT_SEPARATOR" '{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" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
ALL_MODIFIED=$(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_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[*]}"
FILES=$(echo "${INPUT_FILES[*]}" | awk '{gsub(/ /,"\n"); print $0;}' | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
@@ -106,11 +120,51 @@ else
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_MODIFIED=$(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_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}')
ALL_OTHER_MODIFIED=$(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;}' | sort -u | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
UNIQUE_ALL_CHANGED=$(echo "${UNIQUE_ALL_CHANGED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
if [[ -n "${UNIQUE_ALL_CHANGED}" ]]; then
echo "Matching changed files: ${UNIQUE_ALL_CHANGED}"
echo "::set-output name=any_changed::true"
else
echo "::set-output name=any_changed::false"
fi
if [[ -n $ALL_OTHER_CHANGED ]]; then
if [[ -n "$UNIQUE_ALL_CHANGED" ]]; then
OTHER_CHANGED=$(echo "${ALL_OTHER_CHANGED}|${UNIQUE_ALL_CHANGED}" | awk '{gsub(/\|/,"\n"); print $0;}' | sort | uniq -u | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
else
OTHER_CHANGED=$ALL_OTHER_CHANGED
fi
fi
OTHER_CHANGED=$(echo "${OTHER_CHANGED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
if [[ -n "${OTHER_CHANGED}" ]]; then
echo "Non Matching changed files: ${OTHER_CHANGED}"
echo "::set-output name=only_changed::false"
echo "::set-output name=other_changed_files::$OTHER_CHANGED"
elif [[ -n "${UNIQUE_ALL_CHANGED}" ]]; then
echo "::set-output name=only_changed::true"
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 "${UNIQUE_ALL_MODIFIED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
if [[ -n "${UNIQUE_ALL_MODIFIED}" ]]; then
echo "Matching modified files: ${UNIQUE_ALL_MODIFIED}"
echo "::set-output name=any_modified::true"
else
echo "::set-output name=any_modified::false"
fi
if [[ -n $ALL_OTHER_MODIFIED ]]; then
if [[ -n "$UNIQUE_ALL_MODIFIED" ]]; then
OTHER_MODIFIED=$(echo "${ALL_OTHER_MODIFIED}|${UNIQUE_ALL_MODIFIED}" | awk '{gsub(/\|/,"\n"); print $0;}' | sort | uniq -u | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
@@ -119,27 +173,26 @@ else
fi
fi
echo "Matching modified files: ${UNIQUE_ALL_MODIFIED}"
if [[ -n "${UNIQUE_ALL_MODIFIED}" ]]; then
echo "::set-output name=any_changed::true"
else
echo "::set-output name=any_changed::false"
fi
OTHER_MODIFIED=$(echo "${OTHER_MODIFIED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
if [[ -n "${OTHER_MODIFIED}" ]]; then
echo "Non Matching modified files: ${OTHER_MODIFIED}"
echo "::set-output name=only_changed::false"
echo "::set-output name=other_changed_files::$OTHER_MODIFIED"
echo "::set-output name=only_modified::false"
echo "::set-output name=other_modified_files::$OTHER_MODIFIED"
elif [[ -n "${UNIQUE_ALL_MODIFIED}" ]]; then
echo "::set-output name=only_changed::true"
echo "::set-output name=only_modified::true"
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}')
if [[ -n "${UNIQUE_ALL_DELETED}" ]]; then
echo "Matching deleted files: ${UNIQUE_ALL_DELETED}"
echo "::set-output name=any_deleted::true"
else
echo "::set-output name=any_deleted::false"
fi
if [[ -n $ALL_OTHER_DELETED ]]; then
if [[ -n "$UNIQUE_ALL_DELETED" ]]; then
OTHER_DELETED=$(echo "${ALL_OTHER_DELETED}|${UNIQUE_ALL_DELETED}" | awk '{gsub(/\|/,"\n"); print $0;}' | sort | uniq -u | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
@@ -148,14 +201,6 @@ else
fi
fi
echo "Matching deleted files: ${UNIQUE_ALL_DELETED}"
if [[ -n "${UNIQUE_ALL_DELETED}" ]]; then
echo "::set-output name=any_deleted::true"
else
echo "::set-output name=any_deleted::false"
fi
OTHER_DELETED=$(echo "${OTHER_DELETED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
if [[ -n "${OTHER_DELETED}" ]]; then
@@ -175,6 +220,7 @@ else
UNMERGED=$(echo "${UNMERGED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
UNKNOWN=$(echo "${UNKNOWN}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
ALL_CHANGED_AND_MODIFIED=$(echo "${ALL_CHANGED_AND_MODIFIED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
ALL_CHANGED=$(echo "${ALL_CHANGED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
ALL_MODIFIED=$(echo "${ALL_MODIFIED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
fi
@@ -186,7 +232,8 @@ echo "Renamed files: $RENAMED"
echo "Type Changed files: $TYPE_CHANGED"
echo "Unmerged files: $UNMERGED"
echo "Unknown files: $UNKNOWN"
echo "All changed files: $ALL_CHANGED_AND_MODIFIED"
echo "All changed and modified files: $ALL_CHANGED_AND_MODIFIED"
echo "All changed files: $ALL_CHANGED"
echo "All modified files: $ALL_MODIFIED"
git remote remove temp_changed_files
@@ -200,6 +247,7 @@ echo "::set-output name=type_changed_files::$TYPE_CHANGED"
echo "::set-output name=unmerged_files::$UNMERGED"
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 "::endgroup::"

View File

@@ -1,4 +1,4 @@
.github/workflows/test.yml
action.yml
action.yml
test/changed-files-list.txt
action.yml