2022-09-03 01:29:32 -07:00
|
|
|
name: "ignore_paths"
|
2020-10-25 21:00:46 +01:00
|
|
|
|
2022-09-03 01:29:32 -07:00
|
|
|
on:
|
2020-10-25 21:00:46 +01:00
|
|
|
push:
|
2022-11-06 20:50:21 +01:00
|
|
|
branches:
|
|
|
|
- "master"
|
2020-10-25 21:00:46 +01:00
|
|
|
pull_request:
|
2022-11-06 20:50:21 +01:00
|
|
|
branches:
|
|
|
|
- "master"
|
2020-10-25 21:00:46 +01:00
|
|
|
|
2022-11-06 20:47:49 +01:00
|
|
|
permissions: {}
|
|
|
|
|
2020-10-25 21:00:46 +01:00
|
|
|
jobs:
|
2021-11-14 11:01:29 +01:00
|
|
|
ignore_paths:
|
|
|
|
name: ignore_paths
|
2020-10-25 21:00:46 +01:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os:
|
|
|
|
- ubuntu-latest
|
|
|
|
- macos-latest
|
|
|
|
steps:
|
2022-09-03 01:29:32 -07:00
|
|
|
- name: Checkout
|
2023-10-08 17:52:30 +02:00
|
|
|
uses: actions/checkout@v4.1.0
|
2022-09-03 01:29:32 -07:00
|
|
|
|
|
|
|
- name: Run ShellCheck
|
|
|
|
uses: ./
|
|
|
|
id: check
|
|
|
|
with:
|
|
|
|
ignore_paths: ignore ./testfiles/ignore_some/duplicate_name.bash **/ignore_some/ignore.bash
|
|
|
|
|
|
|
|
- name: Verify check
|
|
|
|
run: |
|
|
|
|
fail=false
|
|
|
|
|
|
|
|
# verify a non-ignored path is not excluded
|
|
|
|
expect="testfiles/test.bash"
|
|
|
|
if [[ ! "${{ steps.check.outputs.files }}" =~ $expect ]];then
|
|
|
|
echo "::error:: Expected file $expect not found in ${{ steps.check.outputs.files }}"
|
|
|
|
fail=true
|
|
|
|
fi
|
|
|
|
|
|
|
|
# verify a file with the same name as an ignored file but at a
|
|
|
|
# different path is not excluded
|
|
|
|
expect="testfiles/duplicate_name.bash"
|
|
|
|
if [[ ! "${{ steps.check.outputs.files }}" =~ $expect ]];then
|
|
|
|
echo "::error:: Expected file $expect not found in ${{ steps.check.outputs.files }}"
|
|
|
|
fail=true
|
|
|
|
fi
|
|
|
|
|
|
|
|
# verify ignored full path excluded
|
|
|
|
notexpect="testfiles/ignore_some/duplicate_name.bash"
|
|
|
|
if [[ "${{ steps.check.outputs.files }}" =~ $notexpect ]];then
|
|
|
|
echo "::error:: Unexpected file $notexpect found in ${{ steps.check.outputs.files }}"
|
|
|
|
fail=true
|
|
|
|
fi
|
|
|
|
|
|
|
|
# verify ignored directory excluded
|
|
|
|
notexpect="testfiles/ignore/ignore.bash"
|
|
|
|
if [[ "${{ steps.check.outputs.files }}" =~ $notexpect ]];then
|
|
|
|
echo "::error:: Unexpected file $notexpect found in ${{ steps.check.outputs.files }}"
|
|
|
|
fail=true
|
|
|
|
fi
|
|
|
|
|
|
|
|
# verify ignored glob excluded
|
|
|
|
notexpect="testfiles/ignore_some/ignore.bash"
|
|
|
|
if [[ "${{ steps.check.outputs.files }}" =~ $notexpect ]];then
|
|
|
|
echo "::error:: Unexpected file $notexpect found in ${{ steps.check.outputs.files }}"
|
|
|
|
fail=true
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $fail;then
|
|
|
|
exit 1
|
|
|
|
fi
|