Skip to content

Add CI workflow to build book PDF and diff on PRs - #25

Draft
yarikoptic wants to merge 1 commit into
BetterCodeBetterScience:mainfrom
yarikoptic:enh-ci-pdf-build
Draft

Add CI workflow to build book PDF and diff on PRs#25
yarikoptic wants to merge 1 commit into
BetterCodeBetterScience:mainfrom
yarikoptic:enh-ci-pdf-build

Conversation

@yarikoptic

Copy link
Copy Markdown
Contributor

Adds .github/workflows/build-pdf.yml, cleanup-pr-preview.yml, and .github/scripts/diff-book-pdf.sh. Modeled on the stamped-principles/stamped-paper pattern; builds base PDF locally rather than fetching from a Pages URL. Enables reviewer preview + page-by-page diff on every PR.

likely might need fixups etc... just thought to run idea by first. See example stamped-principles/stamped-paper#183 (comment) besides that diff previews no longer available since upon merge we remove the branch which contains all those individual pages diffs... I can later prepare a PR which demonstrates it there

Adds a GitHub Actions workflow that, on every PR against `main`:

- builds the book PDF from the PR branch and from the base branch (both
  with `mystmd`'s `plain_latex_book` template, pinned to sidestep the
  Typst export's issue with `**X**yz` bold markdown patterns),
- runs `diff-pdf` inside the ghcr.io/stamped-principles/diff-pdf
  container to produce a full diff PDF plus per-page 3-panel montages,
- pushes both PDFs and the per-page images to a per-PR orphan branch
  `gh-pages-pr-<N>` so reviewers can browse them via raw.github links
  from the PR conversation, and
- posts (and updates) a single PR comment linking the artifacts and
  summarizing changed / unchanged / added / removed pages.

A companion `cleanup-pr-preview.yml` deletes the orphan branch when
the PR is closed.

Modeled on stamped-principles/stamped-paper's build-pdf.yml pattern;
adapted for this repo by building the base PDF locally (this repo does
not publish the PDF to Pages).

Co-Authored-By: Claude Code 2.1.204 / Claude Opus 4.7 <noreply@anthropic.com>
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.

1 participant