-
Notifications
You must be signed in to change notification settings - Fork 172
48 lines (42 loc) · 1.55 KB
/
pr-pdfs.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Handle PDF pull request
on:
pull_request:
paths: '*.tex'
jobs:
LaTeX:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Identify changed LaTeX documents
env:
pr_number: ${{ github.event.number }}
base_sha: ${{ github.event.pull_request.base.sha }}
head_sha: ${{ github.event.pull_request.head.sha }}
run: |
mergebase_sha=$(git merge-base $base_sha $head_sha)
echo "mergebase_sha=$mergebase_sha" >> $GITHUB_ENV
changed=$(git diff-tree --name-only --merge-base $base_sha $head_sha -- '*.tex' | tr '\n' ' ')
echo "changed=$changed" >> $GITHUB_ENV
echo "pdfs=$(ls -1 $changed | sed 's,^,new/,;s,tex$,pdf,' | tr '\n' ' ')" >> $GITHUB_ENV
echo "diffs=$(ls -1 $changed | sed 's,^,diff/,;s,tex$,pdf,' | tr '\n' ' ')" >> $GITHUB_ENV
echo "pr_number=$pr_number" > environ.txt
echo "base_sha=$base_sha" >> environ.txt
echo "head_sha=$head_sha" >> environ.txt
echo "mergebase_sha=$mergebase_sha" >> environ.txt
- name: Run LaTeX
uses: ./.github/actions/texlive
if: ${{ env.changed }}
with:
run1: make ${{ env.pdfs }}
run2: -make -k OLD=$mergebase_sha NEW=HEAD ${{ env.diffs }}
- uses: actions/upload-artifact@v4
with:
name: pdf
retention-days: 1
if-no-files-found: ignore
path: |
environ.txt
new/*.pdf
diff/*.pdf