Skip to content

Commit b276a41

Browse files
committed
CI: Require at least one code block separator for example files in the Style Checks workflow
1 parent 6ae2072 commit b276a41

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

.github/workflows/style_checks.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,14 @@ jobs:
4949
find . -type f -not -path '*/\.git/*' -exec grep -Iq . {} \; -exec dos2unix --quiet {} \;
5050
find . -type f -not -path '*/\.git/*' -exec grep -Iq . {} \; -exec chmod 644 {} \;
5151
if [[ $(git ls-files -m) ]]; then git --no-pager diff HEAD; exit 1; fi
52+
53+
- name: Ensure example scripts have at least one code block separator
54+
run: |
55+
grep -L '# %%' $(find 'examples' -name '*.py') > output.txt
56+
nfiles=$(wc -l output.txt | awk '{print $1}')
57+
if [[ $nfiles > 0 ]]; then
58+
echo "Code block separator '# %%' is required in following example files:"
59+
cat output.txt
60+
rm output.txt
61+
exit $nfiles
62+
fi

0 commit comments

Comments
 (0)