Skip to content

Fail on LaTeX errors when warnings are errors#43

Open
fingolfin wants to merge 1 commit intomainfrom
codex/fail-on-latex-errors
Open

Fail on LaTeX errors when warnings are errors#43
fingolfin wants to merge 1 commit intomainfrom
codex/fail-on-latex-errors

Conversation

@fingolfin
Copy link
Member

Treat GAPDoc's "There were LaTeX errors" message as a
warning failure when warnings-as-errors is true.

Co-authored-by: Codex codex@openai.com

@fingolfin
Copy link
Member Author

I noticed this because I introduced a mistake in AutoDoc's manual and the CI just passed... sigh

Copy link
Contributor

@stertooy stertooy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work as intended, just one small remark :)

action.yml Outdated
run: |
if grep -q -i -e "there were latex errors" $RUNNER_TEMP/output.log; then
echo "::error::LaTeX errors were found when building the documentation!"
grep -i -e "there were latex errors" $RUNNER_TEMP/output.log
Copy link
Contributor

@stertooy stertooy Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what the intention of the final grep line is? It will just print "#W There were LaTeX errors:", but not the actual errors.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well this is modelled on the existing code a few lines below: I think the idea is to make the error "stand out" by repeating it.

But I'd be fine with removing it here -- but then also there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making the errors stand out is IMO a good thing, but I'd want to see the actual errors. The existing code (mostly?) gets to deal with one-line warnings, so repeating those lines is helpful.

But for the LaTeX errors, the actual errors are on separate lines below the '#W There were LaTeX errors' line. Something like this, maybe? (untested code!)

echo "::error::LaTeX errors were found when building the documentation!"
awk '/^#[IW] / {err=0}; /There were LaTeX errors/ {err=1}; err && /^!/ {print}' "$RUNNER_TEMP/output.log"

which should then print something like

Error: LaTeX errors were found when building the documentation!
! Missing \endcsname inserted.
! Argument of \@setref has an extra }.
! Paragraph ended before \@setref was complete.
! Extra \endcsname.
! Too many }'s.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the case where we find any errors of any form in the log, is it worth outputting the whole log file for easier debugging?

Treat GAPDoc's "There were LaTeX errors" message as a
warning failure when warnings-as-errors is true.

Co-authored-by: Codex <codex@openai.com>
@fingolfin fingolfin force-pushed the codex/fail-on-latex-errors branch from 5d1745c to ad6b251 Compare March 6, 2026 19:31
@fingolfin fingolfin requested a review from stertooy March 6, 2026 19:31
Copy link
Collaborator

@Joseph-Edwards Joseph-Edwards left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks good to me. We may wish to output the whole log file if we find any errors for easier debugging though I don't feel too strongly about this. Otherwise I'm happy to merge

Copy link
Member

@limakzi limakzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants