2021-03-05 02:36:52 +00:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
2021-04-23 10:14:21 +00:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2021-05-25 04:30:19 +00:00
|
|
|
- '**'
|
2021-03-05 02:36:52 +00:00
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
|
|
|
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
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: shellcheck
|
|
|
|
uses: reviewdog/action-shellcheck@v1.5
|
|
|
|
|
|
|
|
test-no-head-sha:
|
2021-05-25 04:30:19 +00:00
|
|
|
name: Test changed-files missing head sha
|
2021-06-18 14:19:28 +00:00
|
|
|
runs-on: ${{ matrix.platform }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2021-06-18 23:09:00 +00:00
|
|
|
platform: [ubuntu-latest, windows-latest, macos-latest]
|
2021-06-18 14:19:28 +00:00
|
|
|
|
2021-05-25 04:30:19 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout to branch
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Run changed-files with defaults
|
|
|
|
id: changed-files
|
|
|
|
continue-on-error: true
|
|
|
|
uses: ./
|
|
|
|
|
|
|
|
- name: Show output
|
|
|
|
run: |
|
|
|
|
echo "${{ toJSON(steps.changed-files.outputs) }}"
|
2021-06-18 14:19:28 +00:00
|
|
|
shell:
|
|
|
|
bash
|
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
|
|
|
|
matrix:
|
2021-06-18 23:09:00 +00:00
|
|
|
platform: [ubuntu-latest, windows-latest, macos-latest]
|
2021-06-18 14:19:28 +00:00
|
|
|
|
2021-03-05 02:36:52 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2021-06-18 14:19:28 +00:00
|
|
|
uses: actions/checkout@v2
|
2021-04-23 10:17:20 +00:00
|
|
|
with:
|
|
|
|
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-03-05 11:17:27 +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-03-25 23:23:19 +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
|
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: |
|
|
|
|
echo "${{ toJSON(steps.changed-files-comma.outputs) }}"
|
2021-06-18 14:19:28 +00:00
|
|
|
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
|
2021-05-16 20:26:22 +00:00
|
|
|
- name: Verify any_changed files
|
2021-05-17 08:26:35 +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')"
|
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
|
2021-05-01 11:55:01 +00:00
|
|
|
- name: Show output
|
|
|
|
run: |
|
|
|
|
echo "${{ toJSON(steps.changed-files-specific.outputs) }}"
|
2021-06-18 14:19:28 +00:00
|
|
|
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-05-17 08:02:50 +00:00
|
|
|
- name: Verify any_changed files comma separator
|
2021-05-17 08:19:10 +00:00
|
|
|
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')"
|
2021-05-17 08:02:50 +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-17 08:02:50 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2021-06-18 14:19:28 +00:00
|
|
|
shell:
|
|
|
|
bash
|
2021-05-01 12:59:18 +00:00
|
|
|
- name: Show output
|
|
|
|
run: |
|
|
|
|
echo "${{ toJSON(steps.changed-files-specific-comma.outputs) }}"
|
2021-06-18 14:19:28 +00:00
|
|
|
shell:
|
|
|
|
bash
|