Update README.md #912
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
- '**' | |
jobs: | |
shellcheck: | |
name: Run shellcheck | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: shellcheck | |
uses: reviewdog/[email protected] | |
test: | |
name: Test verify-changed-files | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [ubuntu-latest, windows-latest, macos-latest, macos-11, windows-2022] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Test files has no changes | |
uses: ./ | |
id: changed_files_not_expected | |
with: | |
files: | | |
test/*.txt | |
test/*.sql | |
test/**/*.txt | |
test/**/*.sql | |
- name: Display changed files | |
if: steps.changed_files_not_expected.outputs.files_changed == 'true' | |
run: | | |
echo "Changed files (Not expected): ${{ steps.changed_files_not_expected.outputs.changed_files }}" | |
exit 1 | |
- name: Make changes | |
run: | | |
printf '%s\n' "323442" "424" >> test/new.txt | |
printf '%s\n' "323442" "424" >> test/new1.txt | |
printf '%s\n' "323442" "424" >> test/new2.txt | |
- name: Test test/new.txt file has changes | |
uses: ./ | |
id: changed_files_expected | |
with: | |
separator: '\n' | |
files: | | |
test/*.txt | |
test/*.sql | |
test/**/*.txt | |
test/**/*.sql | |
- name: Display changed files | |
if: steps.changed_files_expected.outputs.files_changed == 'true' | |
run: | | |
echo "Changed files: ${{ steps.changed_files_expected.outputs.changed_files }}" | |
- name: Verify Changes to test/new.txt | |
if: steps.changed_files_expected.outputs.files_changed != 'true' | |
run: | | |
echo "No Changes found: (Not expected)" | |
exit 1 | |
- name: Generate an unstaged file | |
run: | | |
echo "New changes" > unstaged.txt | |
- name: Test unstaged file has changes | |
uses: ./ | |
id: changed_unstaged_files_expected | |
with: | |
files: | | |
unstaged.txt | |
- name: Display unstaged changed files | |
if: steps.changed_unstaged_files_expected.outputs.files_changed == 'true' | |
run: | | |
echo "Changed files: ${{ steps.changed_unstaged_files_expected.outputs.changed_files }}" | |
- name: Verify Changes to unstaged.txt | |
if: steps.changed_unstaged_files_expected.outputs.files_changed != 'true' | |
run: | | |
echo "No Changes found: (Not expected)" | |
exit 1 | |
- name: Test unstaged file changes are ignored | |
uses: ./ | |
id: changed_unstaged_files_not_expected | |
with: | |
files: | | |
!test/new.txt | |
!test/new1.txt | |
!test/new2.txt | |
!unstaged.txt | |
- name: Verify Changes to unstaged.txt are ignored | |
if: steps.changed_unstaged_files_not_expected.outputs.files_changed != 'false' | |
run: | | |
echo "Changes found: (Not expected)" | |
exit 1 | |
- name: Test unstaged file has changes | |
uses: ./ | |
id: changed_unstaged2_files_expected | |
with: | |
files: | | |
!test/new.txt | |
!test/new1.txt | |
!test/new2.txt | |
unstaged.txt | |
- name: Verify Changes to unstaged.txt are ignored | |
if: steps.changed_unstaged2_files_expected.outputs.files_changed != 'true' | |
run: | | |
echo "No Changes found: (Not expected)" | |
exit 1 |