2021-03-05 02:36:52 +00:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
2021-04-23 10:14:21 +00:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2022-05-14 18:43:09 +00:00
|
|
|
- "**"
|
2021-03-05 02:36:52 +00:00
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
2022-07-18 20:34:41 +00:00
|
|
|
pull_request_review:
|
|
|
|
types:
|
|
|
|
- submitted
|
2021-03-05 02:36:52 +00:00
|
|
|
|
|
|
|
jobs:
|
2021-06-18 14:19:28 +00:00
|
|
|
shellcheck:
|
|
|
|
name: Run shellcheck
|
2021-05-25 04:30:19 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-06-18 14:19:28 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout to branch
|
2022-03-01 19:50:35 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-06-18 14:19:28 +00:00
|
|
|
- name: shellcheck
|
2022-04-21 15:19:27 +00:00
|
|
|
uses: reviewdog/action-shellcheck@v1.15
|
2022-05-14 18:43:09 +00:00
|
|
|
|
2022-02-17 07:35:49 +00:00
|
|
|
test-pull-requests-from-forks:
|
|
|
|
name: Test changed-files diff on pull_requests from forks
|
2022-02-16 07:49:49 +00:00
|
|
|
runs-on: ${{ matrix.platform }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
2022-03-16 05:38:55 +00:00
|
|
|
max-parallel: 4
|
2022-02-16 07:49:49 +00:00
|
|
|
matrix:
|
2022-03-16 06:08:10 +00:00
|
|
|
platform: [ubuntu-latest, windows-latest, macos-latest, macos-11, ubuntu-18.04, windows-2022]
|
2022-02-16 07:49:49 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-03-01 19:50:35 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-02-16 07:49:49 +00:00
|
|
|
with:
|
2022-02-23 08:39:20 +00:00
|
|
|
submodules: true
|
2022-02-16 07:49:49 +00:00
|
|
|
fetch-depth: 0
|
|
|
|
|
2022-02-17 07:35:49 +00:00
|
|
|
- name: Get changed files use_fork_point
|
|
|
|
id: changed-files-fork-point
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
use_fork_point: "true"
|
|
|
|
|
|
|
|
- name: Show output
|
|
|
|
run: |
|
|
|
|
echo '${{ toJSON(steps.changed-files-fork-point.outputs) }}'
|
|
|
|
shell:
|
|
|
|
bash
|
|
|
|
|
2022-02-16 07:49:49 +00:00
|
|
|
- name: Get changed files
|
|
|
|
id: changed-files
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
base_sha: ${{ github.event.pull_request.base.sha }}
|
|
|
|
|
|
|
|
- name: Show output
|
|
|
|
run: |
|
|
|
|
echo '${{ toJSON(steps.changed-files.outputs) }}'
|
|
|
|
shell:
|
|
|
|
bash
|
2021-06-18 14:19:28 +00:00
|
|
|
|
2021-08-28 01:53:03 +00:00
|
|
|
test-multiple-repositories:
|
|
|
|
name: Test with multiple repositories
|
|
|
|
runs-on: ${{ matrix.platform }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
2022-03-16 05:38:55 +00:00
|
|
|
max-parallel: 4
|
2021-08-28 01:53:03 +00:00
|
|
|
matrix:
|
2022-03-16 06:08:10 +00:00
|
|
|
platform: [ubuntu-latest, windows-latest, macos-latest, macos-11, ubuntu-18.04, windows-2022]
|
2021-08-28 01:53:03 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout into dir1
|
2022-03-01 19:50:35 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-08-28 01:53:03 +00:00
|
|
|
with:
|
2022-02-23 08:39:20 +00:00
|
|
|
submodules: true
|
2021-08-28 01:53:03 +00:00
|
|
|
fetch-depth: 0
|
|
|
|
path: dir1
|
|
|
|
- name: Run changed-files with defaults on the dir1
|
|
|
|
id: changed-files-dir1
|
|
|
|
uses: ./dir1
|
|
|
|
with:
|
|
|
|
path: dir1
|
|
|
|
- name: Show output
|
|
|
|
run: |
|
2021-09-04 13:08:20 +00:00
|
|
|
echo '${{ toJSON(steps.changed-files-dir1.outputs) }}'
|
2021-08-28 01:53:03 +00:00
|
|
|
shell:
|
|
|
|
bash
|
|
|
|
- name: List all modified files
|
|
|
|
run: |
|
2021-10-12 13:47:12 +00:00
|
|
|
for file in ${{ steps.changed-files-dir1.outputs.modified_files }}; do
|
2021-09-04 13:08:20 +00:00
|
|
|
echo "$file"
|
2021-08-28 01:53:03 +00:00
|
|
|
done
|
|
|
|
shell:
|
|
|
|
bash
|
|
|
|
- name: Checkout into dir2
|
2022-03-01 19:50:35 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-08-28 01:53:03 +00:00
|
|
|
with:
|
2022-02-23 08:39:20 +00:00
|
|
|
submodules: true
|
2021-08-28 01:53:03 +00:00
|
|
|
fetch-depth: 0
|
|
|
|
path: dir2
|
|
|
|
- name: Run changed-files with defaults on the dir2
|
|
|
|
id: changed-files-dir2
|
|
|
|
uses: ./dir2
|
|
|
|
with:
|
|
|
|
path: dir2
|
|
|
|
- name: Show output
|
|
|
|
run: |
|
2021-09-04 13:08:20 +00:00
|
|
|
echo '${{ toJSON(steps.changed-files-dir2.outputs) }}'
|
2021-08-28 01:53:03 +00:00
|
|
|
shell:
|
|
|
|
bash
|
|
|
|
- name: List all modified files
|
|
|
|
run: |
|
2021-10-12 13:47:12 +00:00
|
|
|
for file in ${{ steps.changed-files-dir2.outputs.modified_files }}; do
|
2021-09-04 13:08:20 +00:00
|
|
|
echo "$file"
|
2021-08-28 01:53:03 +00:00
|
|
|
done
|
|
|
|
shell:
|
|
|
|
bash
|
|
|
|
|
2022-07-18 20:34:41 +00:00
|
|
|
test-similar-base-and-commit-sha:
|
|
|
|
name: Test changed-files similar base and commit sha
|
|
|
|
runs-on: ${{ matrix.platform }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
max-parallel: 4
|
|
|
|
matrix:
|
|
|
|
platform: [ubuntu-latest, windows-latest, macos-latest, macos-11, ubuntu-18.04, windows-2022]
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout to branch
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Run changed-files with a single commit history
|
|
|
|
id: changed-files
|
|
|
|
uses: ./
|
|
|
|
|
|
|
|
- name: Show output
|
|
|
|
run: |
|
|
|
|
echo '${{ toJSON(steps.changed-files.outputs) }}'
|
|
|
|
shell:
|
|
|
|
bash
|
|
|
|
|
2021-12-04 11:11:27 +00:00
|
|
|
test-non-existent-base-sha:
|
|
|
|
name: Test changed-files non existent base sha
|
2021-06-18 14:19:28 +00:00
|
|
|
runs-on: ${{ matrix.platform }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
2022-03-16 05:38:55 +00:00
|
|
|
max-parallel: 4
|
2021-06-18 14:19:28 +00:00
|
|
|
matrix:
|
2022-03-16 06:08:10 +00:00
|
|
|
platform: [ubuntu-latest, windows-latest, macos-latest, macos-11, ubuntu-18.04, windows-2022]
|
2021-06-18 14:19:28 +00:00
|
|
|
|
2021-05-25 04:30:19 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout to branch
|
2022-03-01 19:50:35 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-08-28 01:53:03 +00:00
|
|
|
|
2021-12-04 11:11:27 +00:00
|
|
|
- name: Run changed-files with non existent base sha
|
2021-05-25 04:30:19 +00:00
|
|
|
id: changed-files
|
2021-12-04 11:11:27 +00:00
|
|
|
uses: ./
|
2021-05-25 04:30:19 +00:00
|
|
|
continue-on-error: true
|
2021-12-04 11:11:27 +00:00
|
|
|
with:
|
|
|
|
base_sha: "4554456"
|
|
|
|
|
|
|
|
- name: Show output
|
|
|
|
run: |
|
|
|
|
echo "${{ toJSON(steps.changed-files.outputs) }}"
|
|
|
|
shell:
|
|
|
|
bash
|
2022-06-30 02:42:32 +00:00
|
|
|
|
|
|
|
- name: Exit with 1 if no error is raised
|
|
|
|
if: steps.changed-files.outcome != 'failure'
|
|
|
|
run: |
|
|
|
|
echo "Expected: (failure) got ${{ steps.changed-files.outcome }}"
|
|
|
|
exit 1
|
2022-05-14 18:43:09 +00:00
|
|
|
|
2021-12-04 11:11:27 +00:00
|
|
|
- name: Run changed-files-specific with non existent base sha
|
|
|
|
id: changed-files-specific
|
2021-05-25 04:30:19 +00:00
|
|
|
uses: ./
|
2021-12-04 11:11:27 +00:00
|
|
|
continue-on-error: true
|
|
|
|
with:
|
|
|
|
files: action.yml
|
|
|
|
base_sha: "4554456"
|
|
|
|
|
|
|
|
- name: Show output
|
|
|
|
run: |
|
|
|
|
echo "${{ toJSON(steps.changed-files-specific.outputs) }}"
|
|
|
|
shell:
|
|
|
|
bash
|
2022-06-30 02:42:32 +00:00
|
|
|
|
|
|
|
- name: Exit with 1 if no error is raised
|
|
|
|
if: steps.changed-files-specific.outcome != 'failure'
|
|
|
|
run: |
|
|
|
|
echo "Expected: (failure) got ${{ steps.changed-files-specific.outcome }}"
|
|
|
|
exit 1
|
2021-12-04 11:11:27 +00:00
|
|
|
|
|
|
|
test-non-existent-sha:
|
|
|
|
name: Test changed-files non existent sha
|
|
|
|
runs-on: ${{ matrix.platform }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
2022-03-16 05:38:55 +00:00
|
|
|
max-parallel: 4
|
2021-12-04 11:11:27 +00:00
|
|
|
matrix:
|
2022-03-16 06:08:10 +00:00
|
|
|
platform: [ubuntu-latest, windows-latest, macos-latest, macos-11, ubuntu-18.04, windows-2022]
|
2021-12-04 11:11:27 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout to branch
|
2022-03-01 19:50:35 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-12-04 11:11:27 +00:00
|
|
|
|
|
|
|
- name: Run changed-files with non existent sha
|
|
|
|
id: changed-files
|
|
|
|
uses: ./
|
|
|
|
continue-on-error: true
|
|
|
|
with:
|
|
|
|
base_sha: "4554456"
|
2021-08-28 01:53:03 +00:00
|
|
|
|
2021-05-25 04:30:19 +00:00
|
|
|
- name: Show output
|
|
|
|
run: |
|
|
|
|
echo "${{ toJSON(steps.changed-files.outputs) }}"
|
2021-06-18 14:19:28 +00:00
|
|
|
shell:
|
|
|
|
bash
|
2022-06-30 02:42:32 +00:00
|
|
|
|
|
|
|
- name: Exit with 1 if no error is raised
|
|
|
|
if: steps.changed-files.outcome != 'failure'
|
|
|
|
run: |
|
|
|
|
echo "Expected: (failure) got ${{ steps.changed-files.outcome }}"
|
|
|
|
exit 1
|
2022-05-14 18:43:09 +00:00
|
|
|
|
2021-12-04 11:11:27 +00:00
|
|
|
- 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
|
2022-06-30 02:42:32 +00:00
|
|
|
|
|
|
|
- name: Exit with 1 if no error is raised
|
|
|
|
if: steps.changed-files-specific.outcome != 'failure'
|
|
|
|
run: |
|
|
|
|
echo "Expected: (failure) got ${{ steps.changed-files-specific.outcome }}"
|
|
|
|
exit 1
|
2021-05-25 04:30:19 +00:00
|
|
|
|
2021-03-05 02:36:52 +00:00
|
|
|
test:
|
|
|
|
name: Test changed-files
|
2021-06-18 14:19:28 +00:00
|
|
|
runs-on: ${{ matrix.platform }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
2022-03-16 05:38:55 +00:00
|
|
|
max-parallel: 4
|
2021-06-18 14:19:28 +00:00
|
|
|
matrix:
|
2022-03-16 06:08:10 +00:00
|
|
|
platform: [ubuntu-latest, windows-latest, macos-latest, macos-11, ubuntu-18.04, windows-2022]
|
2021-06-18 14:19:28 +00:00
|
|
|
|
2021-03-05 02:36:52 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-03-01 19:50:35 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-04-23 10:17:20 +00:00
|
|
|
with:
|
2022-02-23 08:39:20 +00:00
|
|
|
submodules: true
|
2021-04-23 10:17:20 +00:00
|
|
|
fetch-depth: 0
|
2021-03-05 12:28:53 +00:00
|
|
|
- name: Run changed-files with defaults
|
2021-03-05 03:36:52 +00:00
|
|
|
id: changed-files
|
2021-03-05 02:36:52 +00:00
|
|
|
uses: ./
|
2021-03-05 03:36:52 +00:00
|
|
|
- name: Show output
|
|
|
|
run: |
|
2021-09-04 13:08:20 +00:00
|
|
|
echo '${{ toJSON(steps.changed-files.outputs) }}'
|
2021-06-18 14:19:28 +00:00
|
|
|
shell:
|
|
|
|
bash
|
2021-03-25 23:23:19 +00:00
|
|
|
- name: List all modified files
|
2021-03-20 12:09:58 +00:00
|
|
|
run: |
|
2021-10-12 13:47:12 +00:00
|
|
|
for file in ${{ steps.changed-files.outputs.modified_files }}; do
|
2021-03-20 12:09:58 +00:00
|
|
|
echo $file
|
|
|
|
done
|
2021-06-18 14:19:28 +00:00
|
|
|
shell:
|
|
|
|
bash
|
2021-04-02 12:27:48 +00:00
|
|
|
- name: Run step when README.md changes
|
2021-04-02 13:00:06 +00:00
|
|
|
if: contains(steps.changed-files.outputs.modified_files, 'README.md')
|
2021-04-02 12:27:48 +00:00
|
|
|
run: |
|
2021-04-02 13:12:33 +00:00
|
|
|
echo "Your README.md has been modified ${{ steps.changed-files.outputs.modified_files }}."
|
2021-06-18 14:19:28 +00:00
|
|
|
shell:
|
|
|
|
bash
|
2022-04-28 06:08:15 +00:00
|
|
|
- name: Run changed-files with quotepath disabled
|
|
|
|
id: changed-files-quotepath
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
quotepath: "false"
|
|
|
|
- name: Show output
|
|
|
|
run: |
|
|
|
|
echo '${{ toJSON(steps.changed-files-quotepath.outputs) }}'
|
|
|
|
shell:
|
|
|
|
bash
|
2022-06-12 14:08:13 +00:00
|
|
|
- name: Run changed-files with dir_names
|
2022-06-12 14:11:04 +00:00
|
|
|
id: changed-files-dir-names
|
2022-06-12 14:08:13 +00:00
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
dir_names: "true"
|
|
|
|
- name: Show output
|
|
|
|
run: |
|
2022-06-12 14:11:04 +00:00
|
|
|
echo '${{ toJSON(steps.changed-files-dir-names.outputs) }}'
|
2022-06-12 14:08:13 +00:00
|
|
|
shell:
|
|
|
|
bash
|
2021-09-04 13:08:20 +00:00
|
|
|
- name: Run changed-files with forward slash separator
|
|
|
|
id: changed-files-forward-slash
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
separator: "/"
|
|
|
|
- name: Show output
|
|
|
|
run: |
|
|
|
|
echo '${{ toJSON(steps.changed-files-forward-slash.outputs) }}'
|
|
|
|
shell:
|
|
|
|
bash
|
2022-03-08 11:59:26 +00:00
|
|
|
- name: Run changed-files with newline separator
|
|
|
|
id: changed-files-newline
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
separator: "\n"
|
|
|
|
- name: Show output
|
|
|
|
run: |
|
|
|
|
echo '${{ toJSON(steps.changed-files-newline.outputs) }}'
|
|
|
|
shell:
|
|
|
|
bash
|
2021-09-04 13:08:20 +00:00
|
|
|
- name: Run changed-files with pipe separator
|
|
|
|
id: changed-files-pipe
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
separator: "|"
|
|
|
|
- name: Show output
|
|
|
|
run: |
|
|
|
|
echo '${{ toJSON(steps.changed-files-pipe.outputs) }}'
|
|
|
|
shell:
|
|
|
|
bash
|
2022-08-03 20:01:40 +00:00
|
|
|
- name: Run changed-files with json output
|
|
|
|
id: changed-files-json
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
json: true
|
|
|
|
- name: Show output
|
|
|
|
run: |
|
|
|
|
echo '${{ toJSON(steps.changed-files-json.outputs) }}'
|
|
|
|
echo '${{ toJSON(steps.changed-files-json.outputs.all_changed_files) }}'
|
|
|
|
shell:
|
|
|
|
bash
|
2021-03-05 12:28:53 +00:00
|
|
|
- name: Run changed-files with comma separator
|
|
|
|
id: changed-files-comma
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
separator: ","
|
|
|
|
- name: Show output
|
|
|
|
run: |
|
2021-09-04 13:08:20 +00:00
|
|
|
echo '${{ toJSON(steps.changed-files-comma.outputs) }}'
|
2021-06-18 14:19:28 +00:00
|
|
|
shell:
|
|
|
|
bash
|
2022-03-08 11:59:26 +00:00
|
|
|
- name: Run changed-files with specific files from a source file using a newline separator
|
|
|
|
id: changed-files-specific-newline-source-file
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
files_from_source_file: |
|
|
|
|
test/changed-files-list.txt
|
|
|
|
separator: "\n"
|
|
|
|
- name: Show output
|
|
|
|
run: |
|
|
|
|
echo '${{ toJSON(steps.changed-files-specific-newline-source-file.outputs) }}'
|
|
|
|
shell:
|
|
|
|
bash
|
2022-05-14 21:05:44 +00:00
|
|
|
- name: Run changed-files for old new filenames test rename 1
|
2022-05-14 21:54:38 +00:00
|
|
|
id: changed-files-all-old-new-renamed-files-1
|
2022-05-14 21:05:44 +00:00
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
base_sha: d1c0ee4
|
|
|
|
sha: 4d04215
|
2022-05-25 21:47:58 +00:00
|
|
|
include_all_old_new_renamed_files: true
|
2022-05-14 21:05:44 +00:00
|
|
|
- name: Show output
|
|
|
|
run: |
|
2022-05-14 21:54:38 +00:00
|
|
|
echo '${{ toJSON(steps.changed-files-all-old-new-renamed-files-1.outputs) }}'
|
2022-05-14 21:05:44 +00:00
|
|
|
shell:
|
|
|
|
bash
|
2022-05-14 21:54:38 +00:00
|
|
|
- name: Check all_old_new_renamed_files output
|
2022-05-14 21:56:47 +00:00
|
|
|
if: "!contains(steps.changed-files-all-old-new-renamed-files-1.outputs.all_old_new_renamed_files, 'test/test rename 1.txt,test/test rename-1.txt')"
|
2022-05-14 21:05:44 +00:00
|
|
|
run: |
|
2022-05-14 21:56:47 +00:00
|
|
|
echo "Invalid output: Expected to include (test/test rename 1.txt,test/test rename-1.txt) got (${{ steps.changed-files-all-old-new-renamed-files-1.outputs.all_old_new_renamed_files }})"
|
2022-05-14 21:05:44 +00:00
|
|
|
exit 1
|
|
|
|
shell:
|
|
|
|
bash
|
|
|
|
- name: Run changed-files for old new filenames test rename 2
|
2022-05-14 21:54:38 +00:00
|
|
|
id: changed-files-all-old-new-renamed-files-2
|
2022-05-14 21:05:44 +00:00
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
base_sha: 4d04215
|
|
|
|
sha: fe238e6
|
2022-05-25 21:47:58 +00:00
|
|
|
include_all_old_new_renamed_files: true
|
2022-05-14 21:05:44 +00:00
|
|
|
- name: Show output
|
|
|
|
run: |
|
2022-05-14 21:54:38 +00:00
|
|
|
echo '${{ toJSON(steps.changed-files-all-old-new-renamed-files-2.outputs) }}'
|
2022-05-14 21:05:44 +00:00
|
|
|
shell:
|
|
|
|
bash
|
2022-05-14 21:54:38 +00:00
|
|
|
- name: Check all_old_new_renamed_files output
|
2022-05-14 21:56:47 +00:00
|
|
|
if: "!contains(steps.changed-files-all-old-new-renamed-files-2.outputs.all_old_new_renamed_files, 'test/test rename 2.txt,test/test rename-2.txt')"
|
2022-05-14 21:05:44 +00:00
|
|
|
run: |
|
2022-05-14 21:56:47 +00:00
|
|
|
echo "Invalid output: Expected to include (test/test rename 2.txt test/test rename-2.txt) got (${{ steps.changed-files-all-old-new-renamed-files-2.outputs.all_old_new_renamed_files }})"
|
2022-05-14 21:05:44 +00:00
|
|
|
exit 1
|
|
|
|
shell:
|
|
|
|
bash
|
2021-05-01 11:55:01 +00:00
|
|
|
- name: Run changed-files with specific files
|
|
|
|
id: changed-files-specific
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
files: |
|
|
|
|
.github/workflows/test.yml
|
2021-05-01 23:58:35 +00:00
|
|
|
action.yml
|
2022-01-26 03:41:38 +00:00
|
|
|
**/test.txt
|
2022-02-15 03:33:45 +00:00
|
|
|
files_ignore: |
|
|
|
|
test/test/test.txt
|
2021-09-04 13:08:20 +00:00
|
|
|
- name: Show output
|
|
|
|
run: |
|
|
|
|
echo '${{ toJSON(steps.changed-files-specific.outputs) }}'
|
|
|
|
shell:
|
|
|
|
bash
|
2022-01-25 01:50:47 +00:00
|
|
|
- name: Check if a excluded file is not included in any_changed
|
2022-01-26 03:41:38 +00:00
|
|
|
if: "contains(steps.changed-files-specific.outputs.all_changed_files, 'test/test/test.txt')"
|
2022-01-25 01:50:47 +00:00
|
|
|
run: |
|
2022-01-26 03:41:38 +00:00
|
|
|
echo "Invalid output: Expected not to include (test/test/test.txt) got (${{ steps.changed-files-specific.outputs.all_changed_files }})"
|
2022-01-25 01:50:47 +00:00
|
|
|
exit 1
|
|
|
|
shell:
|
|
|
|
bash
|
2021-09-05 12:22:47 +00:00
|
|
|
- name: Verify any_changed for specific files
|
2022-01-26 03:41:38 +00:00
|
|
|
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') && !contains(steps.changed-files-specific.outputs.all_changed_files, 'test/test.txt')"
|
2021-05-16 20:26:22 +00:00
|
|
|
run: |
|
2021-05-17 08:19:10 +00:00
|
|
|
if [[ "${{ steps.changed-files-specific.outputs.any_changed }}" != "false" ]]; then
|
|
|
|
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific.outputs.any_changed }})"
|
2021-05-16 20:26:22 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2021-06-18 14:19:28 +00:00
|
|
|
shell:
|
|
|
|
bash
|
2022-01-25 01:50:47 +00:00
|
|
|
- name: Check if a excluded file is not included in any_modified
|
2022-01-26 03:41:38 +00:00
|
|
|
if: "contains(steps.changed-files-specific.outputs.all_modified_files, 'test/test/test.txt')"
|
2022-01-25 01:50:47 +00:00
|
|
|
run: |
|
2022-01-26 03:41:38 +00:00
|
|
|
echo "Invalid output: Expected not to include (test/test/test.txt) got (${{ steps.changed-files-specific.outputs.all_modified_files }})"
|
2022-01-25 01:50:47 +00:00
|
|
|
exit 1
|
|
|
|
shell:
|
|
|
|
bash
|
2021-12-14 07:01:31 +00:00
|
|
|
- name: Verify any_modified for specific files
|
2022-01-26 03:41:38 +00:00
|
|
|
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') && !contains(steps.changed-files-specific.outputs.all_modified_files, 'test/test.txt')"
|
2021-12-14 07:01:31 +00:00
|
|
|
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
|
2022-01-25 01:50:47 +00:00
|
|
|
- name: Check if a excluded file is not included in any_deleted
|
2022-01-26 03:41:38 +00:00
|
|
|
if: "contains(steps.changed-files-specific.outputs.deleted_files, 'test/test/test.txt')"
|
2022-01-25 01:50:47 +00:00
|
|
|
run: |
|
2022-01-26 03:41:38 +00:00
|
|
|
echo "Invalid output: Expected not to include (test/test/test.txt) got (${{ steps.changed-files-specific.outputs.deleted_files }})"
|
2022-01-25 01:50:47 +00:00
|
|
|
exit 1
|
|
|
|
shell:
|
|
|
|
bash
|
2021-09-05 12:22:47 +00:00
|
|
|
- name: Verify any_deleted for specific files
|
2022-01-26 03:41:38 +00:00
|
|
|
if: "!contains(steps.changed-files-specific.outputs.deleted_files, 'action.yml') && !contains(steps.changed-files-specific.outputs.deleted_files, '.github/workflows/test.yml') && !contains(steps.changed-files-specific.outputs.deleted_files, 'test/test.txt')"
|
2021-09-05 12:22:47 +00:00
|
|
|
run: |
|
|
|
|
if [[ "${{ steps.changed-files-specific.outputs.any_deleted }}" != "false" ]]; then
|
|
|
|
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific.outputs.any_deleted }})"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
shell:
|
|
|
|
bash
|
2021-08-06 10:14:50 +00:00
|
|
|
- name: Run changed-files with specific files comma check duplicates
|
|
|
|
id: changed-files-specific-duplicate-output
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
files: |
|
|
|
|
entrypoint.sh
|
|
|
|
*.sh
|
2021-12-14 07:01:31 +00:00
|
|
|
- name: Verify all_changed_files files has no duplicates
|
2021-12-14 05:21:49 +00:00
|
|
|
if: contains(steps.changed-files-specific-duplicate-output.outputs.all_changed_files, 'entrypoint.sh')
|
2021-08-06 10:14:50 +00:00
|
|
|
run: |
|
2021-12-14 07:01:31 +00:00
|
|
|
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 }})
|
2021-09-04 13:42:11 +00:00
|
|
|
UNIQUE_ALL_CHANGED_AND_MODIFIED_FILES=$(echo "$ALL_CHANGED_AND_MODIFIED_FILES" | tr ' ' '\n' | sort -u | xargs)
|
2021-08-06 10:14:50 +00:00
|
|
|
|
2021-09-04 13:42:11 +00:00
|
|
|
if [[ "$ALL_CHANGED_AND_MODIFIED_FILES[@]" != "$UNIQUE_ALL_CHANGED_AND_MODIFIED_FILES[@]" ]]; then
|
|
|
|
echo "Duplicate output: Expected "$UNIQUE_ALL_CHANGED_AND_MODIFIED_FILES" got $ALL_CHANGED_AND_MODIFIED_FILES"
|
2021-08-06 10:14:50 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
shell:
|
|
|
|
bash
|
2021-12-14 07:01:31 +00:00
|
|
|
- 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
|
2021-05-01 12:59:18 +00:00
|
|
|
- name: Run changed-files with specific files comma separator
|
|
|
|
id: changed-files-specific-comma
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
files: |
|
|
|
|
.github/workflows/test.yml
|
2021-05-01 23:58:35 +00:00
|
|
|
action.yml
|
2021-05-01 12:59:18 +00:00
|
|
|
separator: ","
|
2021-09-04 13:08:20 +00:00
|
|
|
- name: Show output
|
|
|
|
run: |
|
|
|
|
echo '${{ toJSON(steps.changed-files-specific-comma.outputs) }}'
|
|
|
|
shell:
|
|
|
|
bash
|
2021-07-17 14:51:08 +00:00
|
|
|
- name: Verify any_changed files comma separator
|
2021-12-14 05:21:49 +00:00
|
|
|
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')"
|
2021-09-04 13:08:20 +00:00
|
|
|
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 }})"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
shell:
|
|
|
|
bash
|
2021-12-14 07:01:31 +00:00
|
|
|
- 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
|
2021-09-05 12:22:47 +00:00
|
|
|
- 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: |
|
|
|
|
if [[ "${{ steps.changed-files-specific-comma.outputs.any_deleted }}" != "false" ]]; then
|
|
|
|
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-comma.outputs.any_deleted }})"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
shell:
|
|
|
|
bash
|
2021-09-04 13:08:20 +00:00
|
|
|
- name: Run changed-files with specific files pipe separator
|
|
|
|
id: changed-files-specific-pipe
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
files: |
|
2022-01-05 02:38:03 +00:00
|
|
|
**/test.yml
|
2021-09-04 13:08:20 +00:00
|
|
|
action.yml
|
|
|
|
separator: "|"
|
|
|
|
- name: Show output
|
|
|
|
run: |
|
|
|
|
echo '${{ toJSON(steps.changed-files-specific-pipe.outputs) }}'
|
|
|
|
shell:
|
|
|
|
bash
|
|
|
|
- name: Verify any_changed files comma separator
|
2021-12-14 05:21:49 +00:00
|
|
|
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')"
|
2021-09-04 13:08:20 +00:00
|
|
|
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 }})"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
shell:
|
|
|
|
bash
|
2021-12-14 07:01:31 +00:00
|
|
|
- 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
|
2021-09-05 12:22:47 +00:00
|
|
|
- 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: |
|
|
|
|
if [[ "${{ steps.changed-files-specific-pipe.outputs.any_deleted }}" != "false" ]]; then
|
|
|
|
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-pipe.outputs.any_deleted }})"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
shell:
|
|
|
|
bash
|
2021-09-04 13:08:20 +00:00
|
|
|
- name: Run changed-files with specific files forward slash separator
|
|
|
|
id: changed-files-specific-forward-slash
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
files: |
|
|
|
|
.github/workflows/test.yml
|
|
|
|
action.yml
|
|
|
|
separator: "/"
|
|
|
|
- name: Show output
|
|
|
|
run: |
|
|
|
|
echo '${{ toJSON(steps.changed-files-specific-forward-slash.outputs) }}'
|
|
|
|
shell:
|
|
|
|
bash
|
2022-02-17 07:35:49 +00:00
|
|
|
- name: Verify any_changed files forward slash separator
|
2021-12-14 05:21:49 +00:00
|
|
|
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')"
|
2021-07-17 14:51:08 +00:00
|
|
|
run: |
|
2022-02-17 07:35:49 +00:00
|
|
|
if [[ "${{ steps.changed-files-specific-forward-slash.outputs.any_changed }}" != "false" ]]; then
|
2021-09-04 13:08:20 +00:00
|
|
|
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-forward-slash.outputs.any_changed }})"
|
2021-07-17 14:51:08 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
shell:
|
|
|
|
bash
|
2022-02-17 07:35:49 +00:00
|
|
|
- name: Verify any_modified files forward slash separator
|
2021-12-14 07:01:31 +00:00
|
|
|
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: |
|
2022-02-17 07:35:49 +00:00
|
|
|
if [[ "${{ steps.changed-files-specific-forward-slash.outputs.any_modified }}" != "false" ]]; then
|
2021-12-14 07:01:31 +00:00
|
|
|
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-forward-slash.outputs.any_modified }})"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
shell:
|
|
|
|
bash
|
2022-02-17 07:35:49 +00:00
|
|
|
- name: Verify any_deleted files forward slash separator
|
2021-09-05 12:22:47 +00:00
|
|
|
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: |
|
2022-02-17 07:35:49 +00:00
|
|
|
if [[ "${{ steps.changed-files-specific-forward-slash.outputs.any_deleted }}" != "false" ]]; then
|
2021-09-05 12:22:47 +00:00
|
|
|
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-forward-slash.outputs.any_deleted }})"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
shell:
|
|
|
|
bash
|
2021-07-17 14:51:08 +00:00
|
|
|
- name: Run changed-files with specific files from a source file
|
|
|
|
id: changed-files-specific-source-file
|
|
|
|
uses: ./
|
|
|
|
with:
|
2021-07-17 15:46:59 +00:00
|
|
|
files_from_source_file: |
|
2021-07-17 14:51:08 +00:00
|
|
|
test/changed-files-list.txt
|
|
|
|
test/changed-files-list.txt
|
|
|
|
files: |
|
2022-03-29 18:18:12 +00:00
|
|
|
**/workflows/greetings.yml
|
2022-01-25 01:50:47 +00:00
|
|
|
- name: Check if a excluded file is not included in any_changed
|
2022-01-26 03:41:38 +00:00
|
|
|
if: contains(steps.changed-files-specific-source-file.outputs.all_changed_files, 'test/test/test.txt')
|
2022-01-25 01:50:47 +00:00
|
|
|
run: |
|
2022-01-26 03:41:38 +00:00
|
|
|
echo "Invalid output: Expected not to include (test/test/test.txt) got (${{ steps.changed-files-specific-source-file.outputs.all_changed_files }})"
|
2022-01-25 01:50:47 +00:00
|
|
|
exit 1
|
|
|
|
shell:
|
|
|
|
bash
|
2021-09-05 12:22:47 +00:00
|
|
|
- name: Verify any_changed from source files
|
2021-10-15 17:36:09 +00:00
|
|
|
if: |
|
|
|
|
(
|
2021-12-14 05:21:49 +00:00
|
|
|
!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') &&
|
2022-03-29 18:18:12 +00:00
|
|
|
!contains(steps.changed-files-specific-source-file.outputs.all_changed_files, '.github/workflows/greetings.yml') &&
|
2022-01-26 03:41:38 +00:00
|
|
|
!contains(steps.changed-files-specific-source-file.outputs.all_changed_files, 'test/test.txt')
|
2021-10-15 17:36:09 +00:00
|
|
|
)
|
2021-07-17 14:51:08 +00:00
|
|
|
run: |
|
2021-09-04 13:08:20 +00:00
|
|
|
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 }})"
|
2021-07-17 14:51:08 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
shell:
|
|
|
|
bash
|
2022-01-25 01:50:47 +00:00
|
|
|
- name: Check if a excluded file is not included in any_modified
|
2022-01-26 03:41:38 +00:00
|
|
|
if: contains(steps.changed-files-specific-source-file.outputs.all_modified_files, 'test/test/test.txt')
|
2022-01-25 01:50:47 +00:00
|
|
|
run: |
|
2022-01-26 03:41:38 +00:00
|
|
|
echo "Invalid output: Expected not to include (test/test/test.txt) got (${{ steps.changed-files-specific-source-file.outputs.all_modified_files }})"
|
2022-01-25 01:50:47 +00:00
|
|
|
exit 1
|
|
|
|
shell:
|
|
|
|
bash
|
2021-12-14 07:01:31 +00:00
|
|
|
- name: Verify any_modified from source files
|
|
|
|
if: |
|
|
|
|
(
|
|
|
|
!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') &&
|
2022-03-29 18:18:12 +00:00
|
|
|
!contains(steps.changed-files-specific-source-file.outputs.all_modified_files, '.github/workflows/greetings.yml') &&
|
2022-01-26 03:41:38 +00:00
|
|
|
!contains(steps.changed-files-specific-source-file.outputs.all_modified_files, 'test/test.txt')
|
2021-12-14 07:01:31 +00:00
|
|
|
)
|
|
|
|
run: |
|
|
|
|
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:
|
|
|
|
bash
|
2022-01-25 01:50:47 +00:00
|
|
|
- name: Check if a excluded file is not included in any_deleted
|
2022-01-26 03:41:38 +00:00
|
|
|
if: contains(steps.changed-files-specific-source-file.outputs.deleted_files, 'test/test/test.txt')
|
2022-01-25 01:50:47 +00:00
|
|
|
run: |
|
2022-01-26 03:41:38 +00:00
|
|
|
echo "Invalid output: Expected not to include (test/test/test.txt) got (${{ steps.changed-files-specific-source-file.outputs.deleted_files }})"
|
2022-01-25 01:50:47 +00:00
|
|
|
exit 1
|
|
|
|
shell:
|
|
|
|
bash
|
2021-09-05 12:22:47 +00:00
|
|
|
- name: Verify any_deleted from source files
|
2022-01-26 03:41:38 +00:00
|
|
|
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')"
|
2021-09-05 12:22:47 +00:00
|
|
|
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 }})"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
shell:
|
|
|
|
bash
|
2021-07-17 14:51:08 +00:00
|
|
|
- name: Show output
|
|
|
|
run: |
|
2021-09-04 13:08:20 +00:00
|
|
|
echo '${{ toJSON(steps.changed-files-specific-source-file.outputs) }}'
|
2021-07-17 14:51:08 +00:00
|
|
|
shell:
|
|
|
|
bash
|
|
|
|
- name: Run changed-files with specific files from a source file using a comma separator
|
|
|
|
id: changed-files-specific-comma-source-file
|
|
|
|
uses: ./
|
|
|
|
with:
|
2021-07-17 15:46:59 +00:00
|
|
|
files_from_source_file: |
|
2021-07-17 14:51:08 +00:00
|
|
|
test/changed-files-list.txt
|
|
|
|
separator: ","
|
2021-09-05 12:22:47 +00:00
|
|
|
- name: Show output
|
|
|
|
run: |
|
|
|
|
echo '${{ toJSON(steps.changed-files-specific-comma-source-file.outputs) }}'
|
|
|
|
shell:
|
|
|
|
bash
|
2021-05-17 08:02:50 +00:00
|
|
|
- name: Verify any_changed files comma separator
|
2022-03-14 05:01:27 +00:00
|
|
|
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')"
|
2021-05-17 08:02:50 +00:00
|
|
|
run: |
|
2021-09-04 13:08:20 +00:00
|
|
|
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 }})"
|
2021-05-17 08:02:50 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2021-06-18 14:19:28 +00:00
|
|
|
shell:
|
|
|
|
bash
|
2021-12-14 07:01:31 +00:00
|
|
|
- name: Verify any_modified files comma separator
|
2022-03-14 05:01:27 +00:00
|
|
|
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')"
|
2021-12-14 07:01:31 +00:00
|
|
|
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
|
2021-09-05 12:22:47 +00:00
|
|
|
- name: Verify any_deleted files with comma separator
|
2022-03-14 05:01:27 +00:00
|
|
|
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')"
|
2021-05-01 12:59:18 +00:00
|
|
|
run: |
|
2021-09-05 12:22:47 +00:00
|
|
|
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 }})"
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-06-18 14:19:28 +00:00
|
|
|
shell:
|
|
|
|
bash
|
2021-07-14 20:57:17 +00:00
|
|
|
- name: Run changed-files with custom sha
|
|
|
|
id: changed-files-custom-sha
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
sha: ${{ github.event.pull_request.head.sha }}
|
|
|
|
- name: Show output
|
|
|
|
run: |
|
2021-09-04 13:08:20 +00:00
|
|
|
echo '${{ toJSON(steps.changed-files-custom-sha.outputs) }}'
|
2021-07-14 20:57:17 +00:00
|
|
|
shell:
|
|
|
|
bash
|
2021-10-30 19:55:58 +00:00
|
|
|
- name: Run changed-files with since_last_remote_commit set to true
|
|
|
|
id: changed-files-since-last-remote-commit
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
since_last_remote_commit: 'true'
|
|
|
|
- name: Show output
|
|
|
|
run: |
|
|
|
|
echo '${{ toJSON(steps.changed-files-since-last-remote-commit.outputs) }}'
|
|
|
|
shell:
|
|
|
|
bash
|
2021-12-04 12:00:44 +00:00
|
|
|
- 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 }}
|
2021-07-17 15:46:59 +00:00
|
|
|
- name: Run changed-files with a custom base sha
|
2021-12-04 12:00:44 +00:00
|
|
|
if: github.event_name == 'pull_request'
|
2021-07-17 15:46:59 +00:00
|
|
|
id: changed-files-custom-base-sha
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
base_sha: ${{ steps.last_successful_commit.outputs.commit_hash }}
|
|
|
|
- name: Show output
|
2021-12-04 12:00:44 +00:00
|
|
|
if: github.event_name == 'pull_request'
|
2021-07-17 15:46:59 +00:00
|
|
|
run: |
|
2021-09-04 13:08:20 +00:00
|
|
|
echo '${{ toJSON(steps.changed-files-custom-base-sha.outputs) }}'
|
2021-07-17 15:46:59 +00:00
|
|
|
shell:
|
|
|
|
bash
|
2021-07-17 19:13:26 +00:00
|
|
|
- name: Run changed-files with specific files (only-changed)
|
|
|
|
id: changed-files-specific-only-changed
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
files: |
|
2022-01-05 02:38:03 +00:00
|
|
|
.github/**/test.yml
|
2021-07-17 19:13:26 +00:00
|
|
|
- name: Verify only_changed files
|
|
|
|
if: steps.changed-files-specific-only-changed.outputs.other_changed_files != ''
|
|
|
|
run: |
|
|
|
|
if [[ "${{ steps.changed-files-specific-only-changed.outputs.only_changed }}" != "false" ]]; then
|
|
|
|
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-only-changed.outputs.only_changed }})"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
shell:
|
|
|
|
bash
|
2021-09-05 12:22:47 +00:00
|
|
|
- name: Verify only_deleted files
|
|
|
|
if: steps.changed-files-specific-only-changed.outputs.other_deleted_files != ''
|
|
|
|
run: |
|
|
|
|
if [[ "${{ steps.changed-files-specific-only-changed.outputs.only_deleted }}" != "false" ]]; then
|
2022-02-02 03:30:40 +00:00
|
|
|
echo "Invalid output: Expected (false) got (${{ steps.changed-files-specific-only-changed.outputs.only_deleted }})."
|
2021-09-05 12:22:47 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
shell:
|
|
|
|
bash
|
2021-07-17 19:13:26 +00:00
|
|
|
- name: Show output
|
|
|
|
run: |
|
2021-09-04 13:08:20 +00:00
|
|
|
echo '${{ toJSON(steps.changed-files-specific-only-changed.outputs) }}'
|
2021-07-17 19:13:26 +00:00
|
|
|
shell:
|
|
|
|
bash
|