Acorn v6 docs #31
Workflow file for this run
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: Lint bash code blocks | |
| on: | |
| pull_request: | |
| paths: | |
| - '**/*.md' | |
| jobs: | |
| check-bash-blocks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check for multi-line bash code blocks | |
| run: | | |
| fail=0 | |
| while IFS= read -r file; do | |
| # Strip leading ./ so GitHub annotations link to the correct file | |
| clean="${file#./}" | |
| awk -v file="$clean" ' | |
| /^```bash/ { in_block=1; lines=0; start=NR; next } | |
| /^```/ && in_block { | |
| if (lines > 1) { | |
| printf "::error file=%s,line=%d::Bash code block has multiple commands. Each block must contain exactly one command.\n", file, start | |
| found=1 | |
| } | |
| in_block=0; next | |
| } | |
| in_block && /^[^#]/ && !/^[[:space:]]*$/ { lines++ } | |
| END { if (found) exit 1 } | |
| ' "$file" || fail=1 | |
| done < <(find . -name '*.md' -not -path './.git/*' -not -name 'CLAUDE.md') | |
| if [ "$fail" -eq 1 ]; then | |
| echo "" | |
| echo "Error: Found bash code blocks with multiple commands." | |
| echo "Each bash code block must contain exactly one command." | |
| exit 1 | |
| fi | |
| echo "All bash code blocks contain a single command." |