Bump wincent from a3427e1
to 1d8aa88
#647
Workflow file for this run
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
--- | |
# https://github.com/dylanaraps/pure-sh-bible/commit/9d54e96011 | |
name: Shellcheck code in Markdown | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Run shellcheck | |
run: | | |
# test shell syntax of Markdown code snippets | |
# https://github.com/dylanaraps/pure-sh-bible/commit/9d54e96011 | |
trap 'printf "shellcheck complete\n"' EXIT INT | |
# Extract code blocks from the README. | |
while IFS='' read -r line; do | |
test "${code-}" = '1' && | |
test "${line-}" != '```' && | |
printf '%s\n' "${line-}" | |
case "${line-}" in | |
'```sh' | '```bash' | '```zsh' | '```shell') | |
code='1' | |
;; | |
'```') | |
code='' | |
;; | |
*) ;; | |
esac | |
done < <( | |
# Markdown filename extensions | |
# https://github.com/github/linguist/blob/7503f7588c/lib/linguist/languages.yml#L3707-L3718 | |
command find -- . \ | |
-name '*.md' -o \ | |
-name 'contents.lr' -o \ | |
-name '*.livemd' -o \ | |
-name '*.markdown' -o \ | |
-name '*.mdown' -o \ | |
-name '*.mdwn' -o \ | |
-name '*.mdx' -o \ | |
-name '*.mkd' -o \ | |
-name '*.mkdn' -o \ | |
-name '*.mkdown' -o \ | |
-name '*.ronn' -o \ | |
-name '*.scd' -o \ | |
-name '*.workbook' | |
) >'./codesnippets_code' | |
# Print the code blocks. | |
while IFS='' read -r line; do | |
printf '%s\n' "${line-}" | |
done <'./codesnippets_code' | |
# Run shellcheck on the extracted code blocks | |
# and this test script itself. | |
# SC1071: allow shell directives outside sh, bash, ksh, dash | |
# SC1090: allow linking to a dynamic location | |
# SC1091: allow linking to, but not following, linked scripts | |
# SC2123: allow `PATH=...` | |
# SC2312: allow masking of return values | |
command shellcheck \ | |
--exclude="SC1071,SC1090,SC1091,SC2123,SC2312" \ | |
--wiki-link-count="$(command getconf UINT_MAX)" \ | |
--check-sourced \ | |
--enable=all \ | |
--source-path=/dev/null \ | |
--external-sources \ | |
--include="" \ | |
--shell=bash \ | |
--severity=style \ | |
--norc \ | |
--color=always \ | |
-- \ | |
./codesnippets_code \ | |
"$0" || | |
exit 1 | |
... |