Compare commits
50 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5414fd30b | ||
|
|
85bd8694a9 | ||
|
|
4dce8843f8 | ||
|
|
7f2aa19bdc | ||
|
|
4ffc815953 | ||
|
|
210cc839c2 | ||
|
|
2c684aedfa | ||
|
|
2703edcc41 | ||
|
|
1a3ea1d324 | ||
|
|
db3ea27a0c | ||
|
|
fc6ac10d4c | ||
|
|
08f351ba16 | ||
|
|
aae4005247 | ||
|
|
eb97e78971 | ||
|
|
35d9bb6ce9 | ||
|
|
ce8c198347 | ||
|
|
1982157b6c | ||
|
|
dddfbd694c | ||
|
|
41ed98fdd5 | ||
|
|
966bc5f420 | ||
|
|
ddcadfd11d | ||
|
|
299748b520 | ||
|
|
57d9664f8e | ||
|
|
653adcf614 | ||
|
|
019dd18a51 | ||
|
|
235067705e | ||
|
|
f487fc6c7b | ||
|
|
0953088baa | ||
|
|
ddc065bac8 | ||
|
|
82b26d6c01 | ||
|
|
c54e638a31 | ||
|
|
e7bcef0f0b | ||
|
|
6f8a32e362 | ||
|
|
0562b9f865 | ||
|
|
be519638b0 | ||
|
|
596fc641d0 | ||
|
|
c0c2634976 | ||
|
|
5ac4c9fe42 | ||
|
|
93ae7c6b6a | ||
|
|
ca8881ae34 | ||
|
|
487675b843 | ||
|
|
988322a381 | ||
|
|
30649ae7e0 | ||
|
|
52c733bd7b | ||
|
|
e6a750f507 | ||
|
|
b1a4c25c63 | ||
|
|
15be594e99 | ||
|
|
5af8560e3b | ||
|
|
ef3b39a58e | ||
|
|
a7850c2ddb |
119
.github/workflows/test.yml
vendored
119
.github/workflows/test.yml
vendored
@@ -24,7 +24,7 @@ jobs:
|
||||
- name: Checkout to branch
|
||||
uses: actions/checkout@v3
|
||||
- name: shellcheck
|
||||
uses: reviewdog/action-shellcheck@v1.16
|
||||
uses: reviewdog/action-shellcheck@v1.17
|
||||
|
||||
test-multiple-repositories:
|
||||
name: Test with multiple repositories
|
||||
@@ -210,6 +210,7 @@ jobs:
|
||||
matrix:
|
||||
platform: [ubuntu-latest]
|
||||
fetch-depth: [1, 2]
|
||||
input-fetch_depth: [1, 50]
|
||||
|
||||
steps:
|
||||
- name: Checkout to branch
|
||||
@@ -220,6 +221,8 @@ jobs:
|
||||
- name: Run changed-files
|
||||
id: changed-files
|
||||
uses: ./
|
||||
with:
|
||||
fetch_depth: ${{ matrix.input-fetch_depth }}
|
||||
|
||||
- name: Show output
|
||||
run: |
|
||||
@@ -446,6 +449,28 @@ jobs:
|
||||
exit 1
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with dir_names and dir_names_exclude_root
|
||||
id: changed-files-dir-names-exclude-root
|
||||
uses: ./
|
||||
with:
|
||||
base_sha: dddfbd69
|
||||
sha: ce8c1983
|
||||
fetch_depth: 60000
|
||||
dir_names: "true"
|
||||
dir_names_exclude_root: "true"
|
||||
dir_names_max_depth: "1"
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-dir-names-exclude-root.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
- name: Check dir_names output
|
||||
if: steps.changed-files-dir-names-exclude-root.outputs.all_changed_files != '.github'
|
||||
run: |
|
||||
echo "Invalid output: Expected (.github) got (${{ steps.changed-files-dir-names-exclude-root.outputs.all_changed_files }})"
|
||||
exit 1
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with dir_names
|
||||
id: changed-files-dir-names
|
||||
uses: ./
|
||||
@@ -858,8 +883,11 @@ jobs:
|
||||
(
|
||||
!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/greetings.yml') &&
|
||||
!contains(steps.changed-files-specific-source-file.outputs.all_changed_files, 'test/test.txt')
|
||||
!contains(steps.changed-files-specific-source-file.outputs.all_changed_files, 'test/test.txt') &&
|
||||
!contains(steps.changed-files-specific-source-file.outputs.all_changed_files, 'test/test2/test.txt') &&
|
||||
!contains(steps.changed-files-specific-source-file.outputs.all_changed_files, 'test/test2/test3/test4/test.txt') &&
|
||||
!contains(steps.changed-files-specific-source-file.outputs.all_changed_files, '[test new].txt') &&
|
||||
!contains(steps.changed-files-specific-source-file.outputs.all_changed_files, '.github/workflows/greetings.yml')
|
||||
)
|
||||
run: |
|
||||
if [[ "${{ steps.changed-files-specific-source-file.outputs.any_changed }}" != "false" ]]; then
|
||||
@@ -880,8 +908,11 @@ jobs:
|
||||
(
|
||||
!contains(steps.changed-files-specific-source-file.outputs.all_modified_files, 'action.yml') &&
|
||||
!contains(steps.changed-files-specific-source-file.outputs.all_modified_files, '.github/workflows/test.yml') &&
|
||||
!contains(steps.changed-files-specific-source-file.outputs.all_modified_files, '.github/workflows/greetings.yml') &&
|
||||
!contains(steps.changed-files-specific-source-file.outputs.all_modified_files, 'test/test.txt')
|
||||
!contains(steps.changed-files-specific-source-file.outputs.all_modified_files, 'test/test.txt') &&
|
||||
!contains(steps.changed-files-specific-source-file.outputs.all_modified_files, 'test/test2/test.txt') &&
|
||||
!contains(steps.changed-files-specific-source-file.outputs.all_modified_files, 'test/test2/test3/test4/test.txt') &&
|
||||
!contains(steps.changed-files-specific-source-file.outputs.all_modified_files, '[test new].txt') &&
|
||||
!contains(steps.changed-files-specific-source-file.outputs.all_modified_files, '.github/workflows/greetings.yml')
|
||||
)
|
||||
run: |
|
||||
if [[ "${{ steps.changed-files-specific-source-file.outputs.any_modified }}" != "false" ]]; then
|
||||
@@ -898,7 +929,16 @@ jobs:
|
||||
shell:
|
||||
bash
|
||||
- name: Verify any_deleted from source files
|
||||
if: "!contains(steps.changed-files-specific-source-file.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific-source-file.outputs.deleted_files, '.github/workflows/test.yml') && !contains(steps.changed-files-specific-source-file.outputs.deleted_files, 'test/test.txt')"
|
||||
if: |
|
||||
(
|
||||
!contains(steps.changed-files-specific-source-file.outputs.deleted_files, 'action.yml') &&
|
||||
!contains(steps.changed-files-specific-source-file.outputs.deleted_files, '.github/workflows/test.yml') &&
|
||||
!contains(steps.changed-files-specific-source-file.outputs.deleted_files, 'test/test.txt') &&
|
||||
!contains(steps.changed-files-specific-source-file.outputs.deleted_files, 'test/test2/test.txt') &&
|
||||
!contains(steps.changed-files-specific-source-file.outputs.deleted_files, 'test/test2/test3/test4/test.txt') &&
|
||||
!contains(steps.changed-files-specific-source-file.outputs.deleted_files, '[test new].txt') &&
|
||||
!contains(steps.changed-files-specific-source-file.outputs.deleted_files, '.github/workflows/greetings.yml')
|
||||
)
|
||||
run: |
|
||||
if [[ "${{ steps.changed-files-specific-source-file.outputs.any_deleted }}" != "false" ]]; then
|
||||
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-source-file.outputs.any_deleted }})"
|
||||
@@ -924,7 +964,15 @@ jobs:
|
||||
shell:
|
||||
bash
|
||||
- name: Verify any_changed files comma separator
|
||||
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') && !contains(steps.changed-files-specific-comma.outputs.all_changed_files, 'test/test.txt')"
|
||||
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') &&
|
||||
!contains(steps.changed-files-specific-comma-source-file.outputs.all_changed_files, 'test/test.txt') &&
|
||||
!contains(steps.changed-files-specific-comma-source-file.outputs.all_changed_files, 'test/test2/test.txt') &&
|
||||
!contains(steps.changed-files-specific-comma-source-file.outputs.all_changed_files, 'test/test2/test3/test4/test.txt') &&
|
||||
!contains(steps.changed-files-specific-comma-source-file.outputs.all_changed_files, '[test new].txt')
|
||||
)
|
||||
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 }})"
|
||||
@@ -933,7 +981,15 @@ jobs:
|
||||
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') && !contains(steps.changed-files-specific-comma.outputs.all_modified_files, 'test/test.txt')"
|
||||
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') &&
|
||||
!contains(steps.changed-files-specific-comma-source-file.outputs.all_modified_files, 'test/test.txt') &&
|
||||
!contains(steps.changed-files-specific-comma-source-file.outputs.all_modified_files, 'test/test2/test.txt') &&
|
||||
!contains(steps.changed-files-specific-comma-source-file.outputs.all_modified_files, 'test/test2/test3/test4/test.txt') &&
|
||||
!contains(steps.changed-files-specific-comma-source-file.outputs.all_modified_files, '[test new].txt')
|
||||
)
|
||||
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 }})"
|
||||
@@ -942,7 +998,15 @@ jobs:
|
||||
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') && !contains(steps.changed-files-specific-comma.outputs.deleted_files, 'test/test.txt')"
|
||||
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') &&
|
||||
!contains(steps.changed-files-specific-comma-source-file.outputs.deleted_files, 'test/test.txt') &&
|
||||
!contains(steps.changed-files-specific-comma-source-file.outputs.deleted_files, 'test/test2/test.txt') &&
|
||||
!contains(steps.changed-files-specific-comma-source-file.outputs.deleted_files, 'test/test2/test3/test4/test.txt') &&
|
||||
!contains(steps.changed-files-specific-comma-source-file.outputs.deleted_files, '[test new].txt')
|
||||
)
|
||||
run: |
|
||||
if [[ "${{ steps.changed-files-specific-comma-source-file.outputs.any_deleted }}" != "false" ]]; then
|
||||
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-comma-source-file.outputs.any_deleted }})"
|
||||
@@ -950,18 +1014,6 @@ jobs:
|
||||
fi
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with custom sha
|
||||
id: changed-files-custom-sha
|
||||
if: github.event_name == 'pull_request' && github.event.action != 'closed'
|
||||
uses: ./
|
||||
with:
|
||||
sha: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Show output
|
||||
if: github.event.action != 'closed'
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-custom-sha.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
- name: Get branch name
|
||||
id: branch-name
|
||||
uses: tj-actions/branch-names@v6
|
||||
@@ -984,6 +1036,31 @@ jobs:
|
||||
echo '${{ toJSON(steps.changed-files-custom-base-sha.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with custom sha
|
||||
id: changed-files-custom-sha
|
||||
if: github.event_name == 'pull_request' && github.event.action != 'closed'
|
||||
uses: ./
|
||||
with:
|
||||
sha: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Show output
|
||||
if: github.event.action != 'closed'
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-custom-sha.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with the pull request base sha and head sha
|
||||
id: changed-files-pull-request-base-sha-head-sha
|
||||
if: github.event_name == 'pull_request' && github.event.action != 'closed'
|
||||
uses: ./
|
||||
with:
|
||||
base_sha: ${{ github.event.pull_request.base.sha }}
|
||||
sha: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Show output
|
||||
if: github.event.action != 'closed'
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-pull-request-base-sha-head-sha.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with specific files (only-changed)
|
||||
id: changed-files-specific-only-changed
|
||||
uses: ./
|
||||
|
||||
8
.github/workflows/update-readme.yml
vendored
8
.github/workflows/update-readme.yml
vendored
@@ -9,14 +9,14 @@ jobs:
|
||||
sync-assets:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3.3.0
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Run auto-doc
|
||||
uses: tj-actions/auto-doc@v1.7.3
|
||||
uses: tj-actions/auto-doc@v1
|
||||
|
||||
- name: Run test
|
||||
- name: Run remark
|
||||
uses: tj-actions/remark@v3
|
||||
|
||||
- name: Verify Changed files
|
||||
@@ -34,7 +34,7 @@ jobs:
|
||||
|
||||
- name: Create Pull Request
|
||||
if: failure()
|
||||
uses: peter-evans/create-pull-request@v4.2.3
|
||||
uses: peter-evans/create-pull-request@v4
|
||||
with:
|
||||
base: "main"
|
||||
labels: "merge when passing"
|
||||
|
||||
200
HISTORY.md
200
HISTORY.md
@@ -1,24 +1,151 @@
|
||||
# Changelog
|
||||
|
||||
## [Unreleased](https://github.com/tj-actions/changed-files/tree/HEAD)
|
||||
## [v35.5.2](https://github.com/tj-actions/changed-files/tree/v35.5.2) (2023-02-09)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v35.3.2...HEAD)
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v35...v35.5.2)
|
||||
|
||||
## [v35](https://github.com/tj-actions/changed-files/tree/v35) (2023-02-09)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v35.5.1...v35)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- \[BUG\] Unsynced target branch changes listed by action in pull requests [\#972](https://github.com/tj-actions/changed-files/issues/972)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- chore: update use of tilde to use caret instead [\#975](https://github.com/tj-actions/changed-files/pull/975) ([jackton1](https://github.com/jackton1))
|
||||
- Upgraded to v35.5.1 [\#974](https://github.com/tj-actions/changed-files/pull/974) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v35.5.1](https://github.com/tj-actions/changed-files/tree/v35.5.1) (2023-02-07)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v35.5.0...v35.5.1)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- \[BUG\] Action started failing [\#970](https://github.com/tj-actions/changed-files/issues/970)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- fix: including non branch changes in diff output [\#973](https://github.com/tj-actions/changed-files/pull/973) ([jackton1](https://github.com/jackton1))
|
||||
- chore: update readme [\#971](https://github.com/tj-actions/changed-files/pull/971) ([jackton1](https://github.com/jackton1))
|
||||
- Upgraded to v35.5.0 [\#969](https://github.com/tj-actions/changed-files/pull/969) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v35.5.0](https://github.com/tj-actions/changed-files/tree/v35.5.0) (2023-02-01)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v35.4.4...v35.5.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- \[Feature\] Exclude the top-level/root directory when dir\_names="true" [\#965](https://github.com/tj-actions/changed-files/issues/965)
|
||||
- \[Feature\] Exclude Files [\#963](https://github.com/tj-actions/changed-files/issues/963)
|
||||
- \[Feature\] Rename `files` -\> `paths` \[\#tara-label-enhancement\] \[\#tara-label-good first issue\] [\#125](https://github.com/tj-actions/changed-files/issues/125)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- \[BUG\] PR between branch and main - unsynced changes appearing in changed files. [\#966](https://github.com/tj-actions/changed-files/issues/966)
|
||||
- ::error::Failed to get current commit for submodule [\#962](https://github.com/tj-actions/changed-files/issues/962)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Dependency Dashboard [\#27](https://github.com/tj-actions/changed-files/issues/27)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Updated README.md [\#968](https://github.com/tj-actions/changed-files/pull/968) ([jackton1](https://github.com/jackton1))
|
||||
- feat: add support for excluding the top level directory [\#967](https://github.com/tj-actions/changed-files/pull/967) ([jackton1](https://github.com/jackton1))
|
||||
- chore: update docs [\#964](https://github.com/tj-actions/changed-files/pull/964) ([jackton1](https://github.com/jackton1))
|
||||
- chore\(deps\): update reviewdog/action-shellcheck action to v1.17 [\#961](https://github.com/tj-actions/changed-files/pull/961) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Upgraded to v35.4.4 [\#960](https://github.com/tj-actions/changed-files/pull/960) ([jackton1](https://github.com/jackton1))
|
||||
- chore: code clean up [\#959](https://github.com/tj-actions/changed-files/pull/959) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v35.4.4](https://github.com/tj-actions/changed-files/tree/v35.4.4) (2023-01-19)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v35.4.3...v35.4.4)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- \[BUG\] Action is evaluating branch instead of sha [\#957](https://github.com/tj-actions/changed-files/issues/957)
|
||||
- \[BUG\] Unable to run on windows self-hosted runner [\#956](https://github.com/tj-actions/changed-files/issues/956)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Comparing differences between tags/releases [\#949](https://github.com/tj-actions/changed-files/issues/949)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- fix: revert change to pull pr branch via the branch name [\#958](https://github.com/tj-actions/changed-files/pull/958) ([jackton1](https://github.com/jackton1))
|
||||
- feat: add guide for retrieving changed files for tags [\#955](https://github.com/tj-actions/changed-files/pull/955) ([jackton1](https://github.com/jackton1))
|
||||
- Upgraded to v35.4.3 [\#954](https://github.com/tj-actions/changed-files/pull/954) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v35.4.3](https://github.com/tj-actions/changed-files/tree/v35.4.3) (2023-01-19)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v35.4.2...v35.4.3)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- \[BUG\] Files not found when not last commit on new branch [\#952](https://github.com/tj-actions/changed-files/issues/952)
|
||||
- \[BUG\] `changed-files` error during run [\#875](https://github.com/tj-actions/changed-files/issues/875)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- fix: handling since last remote commits for the first pr branch commit [\#953](https://github.com/tj-actions/changed-files/pull/953) ([jackton1](https://github.com/jackton1))
|
||||
- Upgraded to v35.4.2 [\#951](https://github.com/tj-actions/changed-files/pull/951) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v35.4.2](https://github.com/tj-actions/changed-files/tree/v35.4.2) (2023-01-18)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v35.4.1...v35.4.2)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- \[BUG\] Unable find a diff between ... [\#944](https://github.com/tj-actions/changed-files/issues/944)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- fix: handle case of invalid file patterns [\#950](https://github.com/tj-actions/changed-files/pull/950) ([jackton1](https://github.com/jackton1))
|
||||
- Updated README.md [\#948](https://github.com/tj-actions/changed-files/pull/948) ([jackton1](https://github.com/jackton1))
|
||||
- Upgraded to v35.4.1 [\#946](https://github.com/tj-actions/changed-files/pull/946) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v35.4.1](https://github.com/tj-actions/changed-files/tree/v35.4.1) (2023-01-11)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v35.4.0...v35.4.1)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- \[Feature\] Specify base branch, not just base-sha [\#941](https://github.com/tj-actions/changed-files/issues/941)
|
||||
- \[Feature\] Get contents of deleted file [\#938](https://github.com/tj-actions/changed-files/issues/938)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- fix: bug retrieving diff with custom a base sha [\#945](https://github.com/tj-actions/changed-files/pull/945) ([jackton1](https://github.com/jackton1))
|
||||
- Updated README.md [\#943](https://github.com/tj-actions/changed-files/pull/943) ([jackton1](https://github.com/jackton1))
|
||||
- chore: make since\_last\_remote\_commit optional [\#942](https://github.com/tj-actions/changed-files/pull/942) ([jackton1](https://github.com/jackton1))
|
||||
- Upgraded to v35.4.0 [\#937](https://github.com/tj-actions/changed-files/pull/937) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v35.4.0](https://github.com/tj-actions/changed-files/tree/v35.4.0) (2023-01-05)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v35.3.2...v35.4.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- \[Feature\] Skip fetching remote refs for non shallow clones [\#924](https://github.com/tj-actions/changed-files/issues/924)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- \[BUG\] v35.3.0 Fails to add \[\] around files when with:json: true [\#926](https://github.com/tj-actions/changed-files/issues/926)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Upgraded to v35.3.2 [\#936](https://github.com/tj-actions/changed-files/pull/936) ([jackton1](https://github.com/jackton1))
|
||||
- Updated README.md [\#935](https://github.com/tj-actions/changed-files/pull/935) ([jackton1](https://github.com/jackton1))
|
||||
- feat: skip fetching remote refs for non shallow clones [\#934](https://github.com/tj-actions/changed-files/pull/934) ([jackton1](https://github.com/jackton1))
|
||||
- fix: error overriding the base sha [\#933](https://github.com/tj-actions/changed-files/pull/933) ([jackton1](https://github.com/jackton1))
|
||||
- docs: add cfernhout as a contributor for doc [\#932](https://github.com/tj-actions/changed-files/pull/932) ([allcontributors[bot]](https://github.com/apps/allcontributors))
|
||||
- Make example consistent and out of the box usable [\#931](https://github.com/tj-actions/changed-files/pull/931) ([cfernhout](https://github.com/cfernhout))
|
||||
|
||||
## [v35.3.2](https://github.com/tj-actions/changed-files/tree/v35.3.2) (2023-01-05)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v35...v35.3.2)
|
||||
|
||||
## [v35](https://github.com/tj-actions/changed-files/tree/v35) (2023-01-05)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v35.3.1...v35)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Dependency Dashboard [\#27](https://github.com/tj-actions/changed-files/issues/27)
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v35.3.1...v35.3.2)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
@@ -143,12 +270,11 @@
|
||||
|
||||
## [v35.0.0](https://github.com/tj-actions/changed-files/tree/v35.0.0) (2022-12-19)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v34...v35.0.0)
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v34.6.2...v35.0.0)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- \[BUG\] Process completed with exit code 1 [\#884](https://github.com/tj-actions/changed-files/issues/884)
|
||||
- \[BUG\] `changed-files` error during run [\#875](https://github.com/tj-actions/changed-files/issues/875)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
@@ -161,13 +287,13 @@
|
||||
- fix: fail when the merge base is not found [\#879](https://github.com/tj-actions/changed-files/pull/879) ([jackton1](https://github.com/jackton1))
|
||||
- Upgraded to v34.6.2 [\#878](https://github.com/tj-actions/changed-files/pull/878) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v34](https://github.com/tj-actions/changed-files/tree/v34) (2022-12-16)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v34.6.2...v34)
|
||||
|
||||
## [v34.6.2](https://github.com/tj-actions/changed-files/tree/v34.6.2) (2022-12-16)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v34.6.1...v34.6.2)
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v34...v34.6.2)
|
||||
|
||||
## [v34](https://github.com/tj-actions/changed-files/tree/v34) (2022-12-16)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v34.6.1...v34)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
@@ -389,7 +515,7 @@
|
||||
|
||||
## [v34.3.3](https://github.com/tj-actions/changed-files/tree/v34.3.3) (2022-11-08)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v34.3.1...v34.3.3)
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v34.3.2...v34.3.3)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
@@ -404,13 +530,13 @@
|
||||
- chore: update readme [\#784](https://github.com/tj-actions/changed-files/pull/784) ([jackton1](https://github.com/jackton1))
|
||||
- Upgraded to v34.3.2 [\#781](https://github.com/tj-actions/changed-files/pull/781) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v34.3.1](https://github.com/tj-actions/changed-files/tree/v34.3.1) (2022-11-07)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v34.3.2...v34.3.1)
|
||||
|
||||
## [v34.3.2](https://github.com/tj-actions/changed-files/tree/v34.3.2) (2022-11-07)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v34.3.0...v34.3.2)
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v34.3.1...v34.3.2)
|
||||
|
||||
## [v34.3.1](https://github.com/tj-actions/changed-files/tree/v34.3.1) (2022-11-07)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v34.3.0...v34.3.1)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
@@ -692,7 +818,7 @@
|
||||
|
||||
- Updated README.md [\#674](https://github.com/tj-actions/changed-files/pull/674) ([jackton1](https://github.com/jackton1))
|
||||
- add kostiantyn-korniienko-aurea as a contributor for doc [\#673](https://github.com/tj-actions/changed-files/pull/673) ([allcontributors[bot]](https://github.com/apps/allcontributors))
|
||||
- TYPO fix [\#671](https://github.com/tj-actions/changed-files/pull/671) ([kostiantyn-korniienko-aurea](https://github.com/kostiantyn-korniienko-aurea))
|
||||
- TYPO fix [\#671](https://github.com/tj-actions/changed-files/pull/671) ([kostiantyn-korniienko](https://github.com/kostiantyn-korniienko))
|
||||
- chore\(deps\): update tj-actions/glob action to v14 [\#670](https://github.com/tj-actions/changed-files/pull/670) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- chore\(deps\): update actions/checkout action to v3.1.0 [\#669](https://github.com/tj-actions/changed-files/pull/669) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Upgraded to v31.0.3 [\#667](https://github.com/tj-actions/changed-files/pull/667) ([jackton1](https://github.com/jackton1))
|
||||
@@ -762,7 +888,7 @@
|
||||
|
||||
## [v30.0.0](https://github.com/tj-actions/changed-files/tree/v30.0.0) (2022-09-24)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v29...v30.0.0)
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v29.0.9...v30.0.0)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
@@ -778,13 +904,13 @@
|
||||
- chore\(deps\): update codacy/codacy-analysis-cli-action action to v4.2.0 [\#634](https://github.com/tj-actions/changed-files/pull/634) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Upgraded to v29.0.9 [\#633](https://github.com/tj-actions/changed-files/pull/633) ([jackton1](https://github.com/jackton1))
|
||||
|
||||
## [v29](https://github.com/tj-actions/changed-files/tree/v29) (2022-09-20)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v29.0.9...v29)
|
||||
|
||||
## [v29.0.9](https://github.com/tj-actions/changed-files/tree/v29.0.9) (2022-09-20)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v29.0.8...v29.0.9)
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v29...v29.0.9)
|
||||
|
||||
## [v29](https://github.com/tj-actions/changed-files/tree/v29) (2022-09-20)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v29.0.8...v29)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
@@ -1709,7 +1835,7 @@
|
||||
|
||||
## [v12](https://github.com/tj-actions/changed-files/tree/v12) (2021-12-14)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v11...v12)
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v11.9...v12)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
@@ -1727,13 +1853,13 @@
|
||||
- \[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](https://github.com/tj-actions/changed-files/tree/v11) (2021-12-04)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v11.9...v11)
|
||||
|
||||
## [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)
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v11...v11.9)
|
||||
|
||||
## [v11](https://github.com/tj-actions/changed-files/tree/v11) (2021-12-04)
|
||||
|
||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v1.3.1...v11)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
|
||||
85
README.md
85
README.md
@@ -22,10 +22,11 @@ Retrieve all changed files and directories relative to the target branch or the
|
||||
* Fast execution (0-10 seconds on average).
|
||||
* Easy to debug.
|
||||
* Scales to large repositories.
|
||||
* Git submodules support.
|
||||
* Supports Git submodules.
|
||||
* Escaped JSON Output which can be used for running matrix jobs based on changed files.
|
||||
* Optionally list only changed directories.
|
||||
* List changed directories.
|
||||
* Restrict the max depth of changed directories.
|
||||
* Write outputs to files at a specified location for further processing.
|
||||
* Monorepos (Fetches only the last remote commit).
|
||||
* Supports all platforms (Linux, MacOS, Windows).
|
||||
* [GitHub-hosted runners](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners) support
|
||||
@@ -38,6 +39,7 @@ Retrieve all changed files and directories relative to the target branch or the
|
||||
* Restrict change detection to a subset of files and directories:
|
||||
* Boolean output indicating that certain files have been changed.
|
||||
* Using [Glob pattern](https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet) matching.
|
||||
* Brace expansion.
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -53,13 +55,13 @@ Retrieve all changed files and directories relative to the target branch or the
|
||||
name: CI
|
||||
|
||||
on:
|
||||
# Compare the preceeding commit of main -> to the current commit of the main branch.
|
||||
# (Note: To compare changes between the last pushed commit to the remote main branch set `since_last_remote_commit: true`)
|
||||
# Compare the preceeding commit -> to the current commit of the main branch.
|
||||
# (Note: To compare changes between the current commit to the last pushed remote commit of the main branch set `since_last_remote_commit: true`)
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
# Compare the last commit of main -> to the current commit of a PR branch.
|
||||
# (Note: To compare changes between the last pushed commit to the remote PR branch set `since_last_remote_commit: true`)
|
||||
# (Note: To compare changes between the current commit to the last pushed remote commit of a PR branch set `since_last_remote_commit: true`)
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
@@ -89,14 +91,28 @@ jobs:
|
||||
id: changed-files-specific
|
||||
uses: tj-actions/changed-files@v35
|
||||
with:
|
||||
files: |
|
||||
docs/**
|
||||
files: docs/*.{js,html} # Alternatively using: `docs/**` or `docs`
|
||||
|
||||
- name: Run step if any file(s) in the docs folder change
|
||||
if: steps.changed-files-specific.outputs.any_changed == 'true'
|
||||
run: |
|
||||
echo "One or more files in the docs folder has changed."
|
||||
echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}"
|
||||
|
||||
# Example 3
|
||||
- name: Get changed js files excluding the docs folder
|
||||
id: changed-files-excluded
|
||||
uses: tj-actions/changed-files@v35
|
||||
with:
|
||||
files: |
|
||||
**/*.js
|
||||
files_ignore: docs/** # Alternatively using: `docs`
|
||||
|
||||
- name: Run step if any other js file(s) change
|
||||
if: steps.changed-files-excluded.outputs.any_changed == 'true'
|
||||
run: |
|
||||
echo "One or more js files not in the doc folder has changed."
|
||||
echo "List all the files that have changed: ${{ steps.changed-files-excluded.outputs.all_changed_files }}"
|
||||
```
|
||||
|
||||
If you feel generous and want to show some extra appreciation:
|
||||
@@ -161,6 +177,7 @@ Support this project with a :star:
|
||||
| base\_sha | string | false | | Specify a different base commit SHA<br>used for comparing changes |
|
||||
| diff\_relative | string | false | | Exclude changes outside the current directory<br> and show path names relative to<br> it. **NOTE:** This requires you to<br> specify the top level directory via<br>the `path` input. |
|
||||
| dir\_names | string | false | `"false"` | Output unique changed directories instead of<br> filenames. **NOTE:** This returns `.` for<br> changed files located in the root<br>of the project. |
|
||||
| dir\_names\_exclude\_root | string | false | `"false"` | Exclude the root directory represented by<br> `.` from the output when `dir_names`is<br>set to `true`. |
|
||||
| dir\_names\_max\_depth | string | false | | Maximum depth of directories to output.<br> e.g `test/test1/test2` with max depth of<br>`2` returns `test/test1`. |
|
||||
| fetch\_depth | string | false | `"50"` | Depth of additional branch history fetched.<br> **NOTE**: This can be adjusted to<br>resolve errors with insufficient history. |
|
||||
| files | string | false | | File and directory patterns to detect<br> changes using only these list of<br> file(s) (Defaults to the entire repo)<br> **NOTE:** Multiline file/directory patterns should not<br>include quotes. |
|
||||
@@ -181,7 +198,7 @@ Support this project with a :star:
|
||||
| separator | string | false | `" "` | Split character for output strings |
|
||||
| sha | string | false | | Specify a different commit SHA used<br>for comparing changes |
|
||||
| since | string | false | | Get changed files for commits whose<br> timestamp is older than the given<br>time. |
|
||||
| since\_last\_remote\_commit | string | true | `"false"` | Use the last commit on the<br> remote branch as the `base_sha`. Defaults<br> to the last non merge commit<br> on the target branch for pull<br> request events and the previous remote<br> commit of the current branch for<br>push events. |
|
||||
| since\_last\_remote\_commit | string | false | `"false"` | Use the last commit on the<br> remote branch as the `base_sha`. Defaults<br> to the last non merge commit<br> on the target branch for pull<br> request events and the previous remote<br> commit of the current branch for<br>push events. |
|
||||
| until | string | false | | Get changed files for commits whose<br> timestamp is earlier than the given<br>time. |
|
||||
| write\_output\_files | string | false | `"false"` | Write outputs to files in the<br>`.github/outputs` folder by default. |
|
||||
|
||||
@@ -284,7 +301,7 @@ See [inputs](#inputs) for more information.
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Get all changed files using a list of files and take action base on the changes</summary>
|
||||
<summary>Get all changed files using a list of files and take action based on the changes</summary>
|
||||
|
||||
```yaml
|
||||
...
|
||||
@@ -402,6 +419,56 @@ See [inputs](#inputs) for more information.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Get all changed files between the previous tag and the current tag</summary>
|
||||
|
||||
```yaml
|
||||
...
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get Base SHA
|
||||
id: get-base-sha
|
||||
run: |
|
||||
echo "base_sha=$(git rev-parse "$(git tag --sort=-v:refname | head -n 2 | tail -n 1)")" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v35
|
||||
with:
|
||||
base_sha: ${{ steps.get-base-sha.outputs.base_sha }}
|
||||
|
||||
- name: Get changed files in the .github folder
|
||||
id: changed-files-specific
|
||||
uses: tj-actions/changed-files@v35
|
||||
with:
|
||||
base_sha: ${{ steps.get-base-sha.outputs.base_sha }}
|
||||
files: .github/**
|
||||
|
||||
- name: Run step if any file(s) in the .github folder change
|
||||
if: steps.changed-files-specific.outputs.any_changed == 'true'
|
||||
run: |
|
||||
echo "One or more files in the .github folder has changed."
|
||||
echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}"
|
||||
...
|
||||
```
|
||||
|
||||
See [inputs](#inputs) for more information.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Get all changed files for a repository located in a different path</summary>
|
||||
|
||||
|
||||
@@ -75,6 +75,10 @@ inputs:
|
||||
dir_names_max_depth:
|
||||
description: "Maximum depth of directories to output. e.g `test/test1/test2` with max depth of `2` returns `test/test1`."
|
||||
required: false
|
||||
dir_names_exclude_root:
|
||||
description: "Exclude the root directory represented by `.` from the output when `dir_names`is set to `true`."
|
||||
required: false
|
||||
default: "false"
|
||||
json:
|
||||
description: "Output list of changed files in a JSON formatted string which can be used for matrix jobs."
|
||||
required: false
|
||||
@@ -89,7 +93,7 @@ inputs:
|
||||
default: "50"
|
||||
since_last_remote_commit:
|
||||
description: "Use the last commit on the remote branch as the `base_sha`. Defaults to the last non merge commit on the target branch for pull request events and the previous remote commit of the current branch for push events."
|
||||
required: true
|
||||
required: false
|
||||
default: "false"
|
||||
write_output_files:
|
||||
description: "Write outputs to files in the `.github/outputs` folder by default."
|
||||
@@ -245,6 +249,7 @@ runs:
|
||||
INPUT_DIFF_RELATIVE: ${{ inputs.diff_relative }}
|
||||
INPUT_DIR_NAMES: ${{ inputs.dir_names }}
|
||||
INPUT_DIR_NAMES_MAX_DEPTH: ${{ inputs.dir_names_max_depth }}
|
||||
INPUT_DIR_NAMES_EXCLUDE_ROOT: ${{ inputs.dir_names_exclude_root }}
|
||||
INPUT_JSON: ${{ inputs.json }}
|
||||
INPUT_HAS_CUSTOM_PATTERNS: ${{ steps.glob.outputs.has-custom-patterns }}
|
||||
INPUT_JSON_RAW_FORMAT: ${{ inputs.json_raw_format }}
|
||||
|
||||
63
diff-sha.sh
63
diff-sha.sh
@@ -8,8 +8,10 @@ EXTRA_ARGS="--no-tags --prune --no-recurse-submodules"
|
||||
PREVIOUS_SHA=""
|
||||
CURRENT_SHA=""
|
||||
DIFF="..."
|
||||
IS_TAG="false"
|
||||
|
||||
if [[ "$GITHUB_REF" == "refs/tags/"* ]]; then
|
||||
IS_TAG="true"
|
||||
EXTRA_ARGS="--prune --no-recurse-submodules"
|
||||
fi
|
||||
|
||||
@@ -58,7 +60,7 @@ if [[ -z $GITHUB_EVENT_PULL_REQUEST_BASE_REF ]]; then
|
||||
if [[ -f .git/shallow ]]; then
|
||||
echo "Fetching remote refs..."
|
||||
# shellcheck disable=SC2086
|
||||
git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin "$CURRENT_BRANCH" 1>/dev/null
|
||||
git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin "$CURRENT_BRANCH" 1>/dev/null || true
|
||||
fi
|
||||
|
||||
echo "::debug::Getting HEAD SHA..."
|
||||
@@ -103,20 +105,16 @@ if [[ -z $GITHUB_EVENT_PULL_REQUEST_BASE_REF ]]; then
|
||||
PREVIOUS_SHA=""
|
||||
|
||||
if [[ "$GITHUB_EVENT_FORCED" == "false" || -z "$GITHUB_EVENT_FORCED" ]]; then
|
||||
PREVIOUS_SHA=$GITHUB_EVENT_BEFORE
|
||||
PREVIOUS_SHA=$GITHUB_EVENT_BEFORE && exit_status=$? || exit_status=$?
|
||||
else
|
||||
PREVIOUS_SHA=$(git rev-list -n 1 "HEAD^") && exit_status=$? || exit_status=$?
|
||||
fi
|
||||
else
|
||||
PREVIOUS_SHA=$(git rev-list -n 1 "$TARGET_BRANCH") && exit_status=$? || exit_status=$?
|
||||
|
||||
if [[ -z "$PREVIOUS_SHA" ]]; then
|
||||
if [[ "$GITHUB_EVENT_FORCED" == "false" || -z "$GITHUB_EVENT_FORCED" ]]; then
|
||||
PREVIOUS_SHA=$GITHUB_EVENT_BEFORE
|
||||
fi
|
||||
fi
|
||||
PREVIOUS_SHA=$(git rev-list -n 1 "HEAD^") && exit_status=$? || exit_status=$?
|
||||
fi
|
||||
|
||||
if [[ -z "$PREVIOUS_SHA" || "$PREVIOUS_SHA" == "0000000000000000000000000000000000000000" ]]; then
|
||||
PREVIOUS_SHA=$(git rev-parse "$(git branch -r --sort=-committerdate | head -1 | xargs)")
|
||||
PREVIOUS_SHA=$(git rev-list -n 1 "HEAD^") && exit_status=$? || exit_status=$?
|
||||
fi
|
||||
|
||||
if [[ "$PREVIOUS_SHA" == "$CURRENT_SHA" ]]; then
|
||||
@@ -136,6 +134,10 @@ if [[ -z $GITHUB_EVENT_PULL_REQUEST_BASE_REF ]]; then
|
||||
fi
|
||||
else
|
||||
PREVIOUS_SHA=$INPUT_BASE_SHA
|
||||
|
||||
if [[ "$IS_TAG" == "true" ]]; then
|
||||
TARGET_BRANCH=$(git describe --tags "$PREVIOUS_SHA")
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "::debug::Target branch $TARGET_BRANCH..."
|
||||
@@ -162,6 +164,13 @@ else
|
||||
echo "Fetching remote refs..."
|
||||
# shellcheck disable=SC2086
|
||||
git fetch $EXTRA_ARGS -u --progress origin pull/"$GITHUB_EVENT_PULL_REQUEST_NUMBER"/head:"$CURRENT_BRANCH" 1>/dev/null
|
||||
|
||||
if [[ "$INPUT_SINCE_LAST_REMOTE_COMMIT" != "true" ]]; then
|
||||
echo "::debug::Fetching remote target branch..."
|
||||
# shellcheck disable=SC2086
|
||||
git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin +refs/heads/"$TARGET_BRANCH":refs/remotes/origin/"$TARGET_BRANCH" 1>/dev/null
|
||||
git branch --track "$TARGET_BRANCH" origin/"$TARGET_BRANCH" 1>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "::debug::Getting HEAD SHA..."
|
||||
@@ -200,31 +209,39 @@ else
|
||||
PREVIOUS_SHA=$GITHUB_EVENT_PULL_REQUEST_BASE_SHA
|
||||
fi
|
||||
else
|
||||
PREVIOUS_SHA=$(git rev-parse origin/"$TARGET_BRANCH") && exit_status=$? || exit_status=$?
|
||||
|
||||
if [[ -f .git/shallow ]]; then
|
||||
echo "::debug::Fetching remote target branch..."
|
||||
# shellcheck disable=SC2086
|
||||
git fetch -u --progress $EXTRA_ARGS --depth="$INPUT_FETCH_DEPTH" origin +refs/heads/"$TARGET_BRANCH":refs/remotes/origin/"$TARGET_BRANCH" 1>/dev/null
|
||||
# check if the merge base is in the local history
|
||||
if ! git merge-base "$PREVIOUS_SHA" "$CURRENT_SHA" 1>/dev/null 2>&1; then
|
||||
echo "::debug::Merge base is not in the local history, fetching remote target branch..."
|
||||
# Fetch more of the target branch history until the merge base is found
|
||||
for i in {1..10}; do
|
||||
# shellcheck disable=SC2086
|
||||
git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin "$TARGET_BRANCH:$TARGET_BRANCH" 1>/dev/null
|
||||
if git merge-base "$PREVIOUS_SHA" "$CURRENT_SHA" 1>/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
echo "::debug::Merge base is not in the local history, fetching remote target branch again..."
|
||||
echo "::debug::Attempt $i/10"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
git branch --track "$TARGET_BRANCH" origin/"$TARGET_BRANCH" 1>/dev/null 2>&1 || true
|
||||
|
||||
PREVIOUS_SHA=$(git merge-base "$TARGET_BRANCH" "$CURRENT_SHA") && exit_status=$? || exit_status=$?
|
||||
fi
|
||||
|
||||
if [[ -z "$PREVIOUS_SHA" || "$PREVIOUS_SHA" == "$CURRENT_SHA" ]]; then
|
||||
PREVIOUS_SHA=$GITHUB_EVENT_PULL_REQUEST_BASE_SHA && exit_status=$? || exit_status=$?
|
||||
fi
|
||||
|
||||
if ! git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA$DIFF$CURRENT_SHA" 1>/dev/null 2>&1; then
|
||||
PREVIOUS_SHA=$(git rev-parse "$TARGET_BRANCH") && exit_status=$? || exit_status=$?
|
||||
DIFF=".."
|
||||
fi
|
||||
|
||||
echo "::debug::Previous SHA: $PREVIOUS_SHA"
|
||||
else
|
||||
PREVIOUS_SHA=$INPUT_BASE_SHA && exit_status=$? || exit_status=$?
|
||||
fi
|
||||
|
||||
if ! git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA$DIFF$CURRENT_SHA" 1>/dev/null 2>&1; then
|
||||
DIFF=".."
|
||||
fi
|
||||
|
||||
echo "::debug::Target branch: $TARGET_BRANCH"
|
||||
echo "::debug::Current branch: $CURRENT_BRANCH"
|
||||
|
||||
@@ -238,7 +255,7 @@ else
|
||||
fi
|
||||
|
||||
if ! git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA$DIFF$CURRENT_SHA" 1>/dev/null 2>&1; then
|
||||
echo "::error::Unable find a diff between $PREVIOUS_SHA and $CURRENT_SHA"
|
||||
echo "::error::Unable to determine a difference between $PREVIOUS_SHA$DIFF$CURRENT_SHA"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -47,6 +47,10 @@ function get_dirname_max_depth() {
|
||||
depth=$((depth + 1))
|
||||
done
|
||||
|
||||
if [[ "$INPUT_DIR_NAMES_EXCLUDE_ROOT" == "true" && "$output" == "." ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "$output"
|
||||
done < <(uniq)
|
||||
}
|
||||
@@ -147,7 +151,7 @@ fi
|
||||
|
||||
echo "Retrieving changes between $INPUT_PREVIOUS_SHA ($INPUT_TARGET_BRANCH) → $INPUT_CURRENT_SHA ($INPUT_CURRENT_BRANCH)"
|
||||
|
||||
if [[ "$INPUT_HAS_CUSTOM_PATTERNS" == "false" ]]; then
|
||||
if [[ "$INPUT_HAS_CUSTOM_PATTERNS" == "false" || -z "$INPUT_FILES_PATTERN_FILE" ]]; then
|
||||
if [[ "$INPUT_JSON" == "false" ]]; then
|
||||
if [[ "$INPUT_DIR_NAMES" == "true" ]]; then
|
||||
ADDED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" A | xargs -I {} dirname {} | get_dirname_max_depth | uniq | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
|
||||
@@ -1 +1 @@
|
||||
This is a test file
|
||||
This is a test file.
|
||||
|
||||
@@ -1 +1 @@
|
||||
Lorem ipsum dolor sit amet, consectetur adip eget, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
Reference in New Issue
Block a user