Skip to content

Commit

Permalink
CI: Require at least one code block separator for example files in th…
Browse files Browse the repository at this point in the history
…e Style Checks workflow
  • Loading branch information
seisman committed Nov 14, 2023
1 parent 6ae2072 commit b276a41
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/style_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,14 @@ jobs:
find . -type f -not -path '*/\.git/*' -exec grep -Iq . {} \; -exec dos2unix --quiet {} \;
find . -type f -not -path '*/\.git/*' -exec grep -Iq . {} \; -exec chmod 644 {} \;
if [[ $(git ls-files -m) ]]; then git --no-pager diff HEAD; exit 1; fi
- name: Ensure example scripts have at least one code block separator
run: |
grep -L '# %%' $(find 'examples' -name '*.py') > output.txt
nfiles=$(wc -l output.txt | awk '{print $1}')
if [[ $nfiles > 0 ]]; then
echo "Code block separator '# %%' is required in following example files:"
cat output.txt
rm output.txt
exit $nfiles
fi

0 comments on commit b276a41

Please sign in to comment.