Skip to content

ci: check the site before every deploy and publish only what passed - #1172

Merged
Bunton33 merged 1 commit into
devfrom
ci/deploy-gate
Oct 19, 2026
Merged

Bunton33 merged 1 commit into
devfrom
ci/deploy-gate

Conversation

@Bunton33

Copy link
Copy Markdown
Contributor

Nothing broken gets published anymore. The deploy (ci.yml) now runs the docs checks on the build it's about to publish, and publishes only if they all pass. A failure stops the deploy, leaves the live wiki as it was, and posts the existing Discord alert.

Deploy steps (ci.yml)

  1. Markdown, secrets and photo GPS checks, each as its own step so one failure doesn't hide the others.
  2. mkdocs build -d site.
  3. check_links.py on that build, plus a check that CNAME made it into the build.
  4. Publish that exact folder with ghp-import --no-jekyll --push --force. This is what mkdocs gh-deploy --force runs internally, with the same remote, branch and commit message ("Deployed with MkDocs version: …"). A simulation in a throwaway clone produced a gh-pages commit with .nojekyll, CNAME and index.html.

Gaps closed after two adversarial reviews

  • Missing snippet includes: pymdownx.snippets gets check_paths: true. A reviewer showed that a missing include emptied 203 pages and the build still passed. Now the build fails and names the file.
  • Image loss: check_links.py compares each page's images with its Markdown, with snippet includes expanded. It fails if a page loses all its images, or if the site has under 90% of the expected total. The old rule only fired after about 70% were gone.
  • Stylesheets, scripts and menu links: check_links.py now checks these too, reporting each problem once.
  • Redirects: check_links.py checks that every redirect in mkdocs.yml produced a page. A redirect with a missing target is silently skipped.

Tests

Case Result
Current tree Pass: 681 pages, 3,157 of 3,143 expected images, 0 errors
selectolax 1.0.1 build (this morning's outage) Fail: total too low, and 331 pages lost all images
Images stripped from 97 pages Fail: 69 pages flagged, and the total fell under 90%
Missing stylesheet, menu page, and redirect target Fail: 3 errors, each reported once
Missing snippet include Build fails: Snippet at path … could not be found

Not changed (pre-existing)

The mogrify -resize '750x>' step has never resized anything. The unquoted > is read by the shell as a redirect, so mogrify gets no file. Fixing the quoting would start shrinking published PNGs, so that belongs in its own PR.

🤖 Generated with Claude Code

The deploy used to build and publish in one step, so a build that lost
every image (selectolax 1.0.1, 2026-10-19) went straight to the live
wiki. Now ci.yml runs the PR checks first (Markdown, secrets, photo GPS),
builds once, checks that build, and publishes that same folder with
ghp-import (what `mkdocs gh-deploy --force` runs internally, same flags
and commit message). If any check fails, nothing is published and the
Discord alert fires. Each check is its own step so one failure doesn't
hide the others.

Two adversarial reviews found gaps, now closed:
- pymdownx.snippets check_paths: a missing --8<-- include now fails the
  build instead of silently publishing half-empty pages.
- check_links.py: compares each page's images with its Markdown (snippet
  includes expanded) and fails if a page loses all its images or the
  site has under 90% of the expected total; checks stylesheets, scripts,
  and menu links; checks every redirect in mkdocs.yml was generated.
- The deploy also confirms CNAME is in the build.

Tested: the current tree passes (681 pages, 3157 of 3143 expected
images, 0 errors). Each of these fails: the selectolax 1.0.1 build, a
15% partial image loss, a missing stylesheet, menu page, or redirect
target, and a missing snippet include.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 073c62ed-c293-431b-9197-731f16110105
📥 Commits

Reviewing files that changed from the base of the PR and between 67a719b and e3c143c.

📒 Files selected for processing: 5
  • .github/workflows/ci.yml
  • AGENTS.md
  • mkdocs.yml
  • tools/docs-checks/README.md
  • tools/docs-checks/check_links.py
+--------------------------------------------+
| `undefined` is not a business requirement. |
+--------------------------------------------+
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Bunton33
Bunton33 merged commit 84aa972 into dev Oct 19, 2026
2 of 3 checks passed
@Bunton33
Bunton33 deleted the ci/deploy-gate branch October 19, 2026 05:08
@Bunton33 Bunton33 mentioned this pull request Oct 19, 2026
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.

2 participants