Skip to content

Commit 965c7a1

Browse files
Copilothifly81
andcommitted
Address code review feedback - pin package versions and add glob safety checks
Co-authored-by: hifly81 <[email protected]>
1 parent 357d1c9 commit 965c7a1

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

.github/workflows/generate-pdfs-on-release.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,18 @@ jobs:
2121
run: |
2222
sudo apt-get update
2323
sudo apt-get install -y pandoc texlive-xetex texlive-fonts-recommended texlive-plain-generic
24-
pip install jupyter nbconvert
24+
pip install jupyter==1.1.1 nbconvert==7.16.6
2525
2626
- name: Convert notebooks to PDF
2727
run: |
2828
mkdir -p pdfs
29-
for notebook in *.ipynb; do
29+
shopt -s nullglob
30+
notebooks=(*.ipynb)
31+
if [ ${#notebooks[@]} -eq 0 ]; then
32+
echo "No notebooks found to convert"
33+
exit 0
34+
fi
35+
for notebook in "${notebooks[@]}"; do
3036
echo "Converting $notebook to PDF..."
3137
jupyter nbconvert --to pdf "$notebook" --output-dir=pdfs || echo "Warning: Failed to convert $notebook"
3238
done
@@ -35,7 +41,13 @@ jobs:
3541
env:
3642
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3743
run: |
38-
for pdf in pdfs/*.pdf; do
44+
shopt -s nullglob
45+
pdfs=(pdfs/*.pdf)
46+
if [ ${#pdfs[@]} -eq 0 ]; then
47+
echo "No PDFs found to upload"
48+
exit 0
49+
fi
50+
for pdf in "${pdfs[@]}"; do
3951
echo "Uploading $pdf to release..."
4052
gh release upload ${{ github.event.release.tag_name }} "$pdf" --clobber
4153
done

0 commit comments

Comments
 (0)