Skip to content

Commit

Permalink
Our GitHub Action should ignore diff/*.pdf errors
Browse files Browse the repository at this point in the history
Due to unchanged nearby tables and other reasons, latexdiff will sometimes
spuriously fail. CI should succeed nonetheless and just omit the diff PDF.
This is why we use `make -k`, but it does not affect make's exit status.

Extend run.sh so that it can ignore exit statuses. We could have just
used `make -i` or arranged to use `-latexdiff-vc` in the recipe, but doing
this in run.sh allows us to separate the two `make` commands so they are
tidily interleaved with their output in the logs.

(Somewhat unfortunately because action arguments can't be lists of strings
this increases the coupling between pr-pdfs.yaml and action.yaml.)
  • Loading branch information
jmarshall committed Feb 10, 2023
1 parent 0957dd9 commit c044c04
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
9 changes: 6 additions & 3 deletions .github/actions/texlive/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ name: texlive
description: Run commands in a TeXLive docker image

inputs:
run:
description: Commands to be executed
run1:
description: Commands to be executed first
required: true
run2:
description: Commands to be executed second

runs:
using: docker
image: docker://texlive/texlive:latest
entrypoint: .github/actions/texlive/run.sh
args:
- ${{ inputs.run }}
- ${{ inputs.run1 }}
- ${{ inputs.run2 }}
10 changes: 8 additions & 2 deletions .github/actions/texlive/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ git config --global --add safe.directory "$GITHUB_WORKSPACE" || exit

for cmd
do
mode=
case "$cmd" in
-*) mode=" (ignoring errors)"
cmd="${cmd#-}"
esac

echo
echo "[command]$cmd"
eval "$cmd" || exit
echo "[command]$cmd$mode"
eval "$cmd" || test -n "$mode" || exit
done
3 changes: 2 additions & 1 deletion .github/workflows/pr-pdfs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ jobs:
uses: ./.github/actions/texlive
if: ${{ env.changed }}
with:
run: make ${{ env.pdfs }} && make -k OLD=$mergebase_sha NEW=HEAD ${{ env.diffs }}
run1: make ${{ env.pdfs }}
run2: -make -k OLD=$mergebase_sha NEW=HEAD ${{ env.diffs }}

- uses: actions/upload-artifact@v3
with:
Expand Down

0 comments on commit c044c04

Please sign in to comment.