This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4fe65f3
commit 9d54e96
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name: Shellcheck | ||
on: [push] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Run shellcheck. | ||
run: ./test.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/sh | ||
# shellcheck source=/dev/null | ||
# | ||
# Tests for the Pure sh Bible. | ||
|
||
main() { | ||
trap 'rm -f readme_code test_file' EXIT INT | ||
|
||
# Extract code blocks from the README. | ||
while read -r line; do | ||
[ "$code" ] && [ "$line" != \`\`\` ] && | ||
printf '%s\n' "$line" | ||
|
||
case $line in | ||
\`\`\`sh) code=1 ;; | ||
\`\`\`) code= | ||
esac | ||
done < README.md > readme_code | ||
|
||
# Run shellcheck and source the code. | ||
shellcheck -s sh readme_code test.sh || exit 1 | ||
} | ||
|
||
main "$@" |