Created
November 7, 2023 20:34
-
-
Save sbe-arg/27612752102df82de533e6f9df2c7fe0 to your computer and use it in GitHub Desktop.
github-old-lint.yaml
This file contains hidden or 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: validator | |
on: | |
push: | |
branches-ignore: | |
- master | |
defaults: | |
run: | |
# Adapted from https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell | |
# But set the errtrace & nounset bash options to make our run scripts more defensive. | |
# See this blog for more details on bash's options https://transang.me/best-practice-to-make-a-shell-script/#the-set-flags | |
shell: bash --noprofile --norc -Eeuo pipefail {0} | |
jobs: | |
shellcheck-local: | |
name: shellcheck_local | |
runs-on: ubuntu-20.04 # ratchet:exclude | |
timeout-minutes: 5 | |
steps: | |
- name: checkout-code | |
uses: actions/checkout@v3 # ratchet:exclude | |
- name: shellcheck-bash-scripts | |
uses: ludeeus/[email protected] | |
with: | |
severity: error | |
scandir: './files/github/scripts' | |
validator-local: | |
name: validator_local | |
runs-on: ubuntu-20.04 # ratchet:exclude | |
timeout-minutes: 10 | |
steps: | |
- name: checkout-code | |
uses: actions/checkout@v3 # ratchet:exclude | |
- name: check-workflow-files | |
run: | | |
echo "::add-matcher::.github/actionlint-matcher.json" | |
bash <(curl --show-error -s --fail https://raw.githubusercontent.com/rhysd/actionlint/e4caae93a1bc24ab2e349236b6b389900e5a7914/scripts/download-actionlint.bash) | |
for file in $(ls .github/workflows) | |
do | |
failure=false | |
cat .github/workflows/${file} \ | |
| ./actionlint \ | |
-color \ | |
-format '{{range $err := .}}::error file={{$err.Filepath}},line={{$err.Line}},col={{$err.Column}}::{{$err.Message}}%0A```%0A{{replace $err.Snippet "\\n" "%0A"}}%0A```\n{{end}}' \ | |
-ignore 'SC2002:' \ | |
-ignore 'SC2086:' \ | |
-ignore 'SC2045:' \ | |
-ignore 'SC2016:' - || failure=true | |
# https://github.com/koalaman/shellcheck/wiki/SCXXXX | |
if $failure | |
then | |
echo "${file} - failure" | |
exit 1 | |
fi | |
done | |
validator-childs: | |
name: validator_childs | |
runs-on: ubuntu-20.04 # ratchet:exclude | |
timeout-minutes: 10 | |
steps: | |
- name: checkout-code | |
uses: actions/checkout@v3 # ratchet:exclude | |
- name: check-workflow-files | |
run: | | |
echo "::add-matcher::.github/actionlint-matcher.json" | |
bash <(curl --show-error -s --fail https://raw.githubusercontent.com/rhysd/actionlint/e4caae93a1bc24ab2e349236b6b389900e5a7914/scripts/download-actionlint.bash) | |
for file in $(ls files/github/workflows) | |
do | |
failure=false | |
cat files/github/workflows/${file} \ | |
| ./actionlint \ | |
-color \ | |
-format '{{range $err := .}}::error file={{$err.Filepath}},line={{$err.Line}},col={{$err.Column}}::{{$err.Message}}%0A```%0A{{replace $err.Snippet "\\n" "%0A"}}%0A```\n{{end}}' \ | |
-ignore 'SC2002:' \ | |
-ignore 'SC2086:' \ | |
-ignore 'SC2045:' \ | |
-ignore 'SC2237:' \ | |
-ignore 'SC2087:' \ | |
-ignore 'SC2157:' \ | |
-ignore 'SC2034:' \ | |
-ignore 'SC2143:' \ | |
-ignore 'SC2078:' \ | |
-ignore 'SC1073:' \ | |
-ignore 'SC2091:' \ | |
-ignore 'SC2129:' \ | |
-ignore 'SC2016:' - || failure=true | |
# https://github.com/koalaman/shellcheck/wiki/SCXXXX | |
if $failure | |
then | |
echo "${file} - failure" | |
exit 1 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment