Skip to content

Commit 8f886ef

Browse files
committed
edits to PDF workflow
1 parent 2d6bd5a commit 8f886ef

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

.github/workflows/create_pdf.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88
- '**.md'
99
- '!.github/**'
1010

11-
# Prevents multiple runs from overlapping
1211
concurrency:
1312
group: ${{ github.workflow }}-${{ github.ref }}
1413
cancel-in-progress: true
@@ -30,12 +29,28 @@ jobs:
3029
3130
- name: create pdf file(s)
3231
run: |
33-
# The --pdf-engine=xelatex flag allows for Unicode characters like ≤
3432
find . -type f \( -iname "*.md" ! -iname "README.md" \) | while read f; do
33+
# 1. Get the filename without extension and directory
34+
# 2. Replace underscores with spaces for a cleaner look
35+
CLEAN_NAME=$(basename "$f" .md | tr '_' ' ')
36+
3537
pandoc "$f" -s -o "output/${f%.md}.pdf" \
3638
--toc \
3739
--number-sections \
3840
--pdf-engine=xelatex \
41+
-V geometry:margin=1in \
42+
-V header-includes="
43+
\usepackage{fancyhdr}
44+
\pagestyle{fancy}
45+
\fancyhf{}
46+
\lhead{$CLEAN_NAME}
47+
\rhead{\thepage}
48+
\renewcommand{\headrulewidth}{0.4pt}
49+
\fancypagestyle{plain}{\fancyhf{}\lhead{$CLEAN_NAME}\rhead{\thepage}}
50+
\renewcommand{\thesection}{}
51+
\renewcommand{\thesubsection}{\arabic{subsection}}
52+
\renewcommand{\thesubsubsection}{\arabic{subsection}.\arabic{subsubsection}}
53+
" \
3954
--verbose
4055
done
4156
@@ -47,11 +62,8 @@ jobs:
4762
pushpdfs:
4863
needs: makepdfs
4964
runs-on: ubuntu-latest
50-
# Explicitly grant permission to write (push) to the repository
5165
permissions:
5266
contents: write
53-
54-
# Safety check to prevent the bot from triggering its own workflow
5567
if: github.actor != 'github-actions[bot]'
5668

5769
steps:
@@ -72,7 +84,6 @@ jobs:
7284
if git diff --staged --quiet; then
7385
echo "No changes to commit"
7486
else
75-
# [skip ci] tells GitHub not to run the workflow again for this specific commit
7687
git commit -m "Auto update pdfs [skip ci]" -a
7788
git push
7889
fi

0 commit comments

Comments
 (0)