Skip to content

Documentation: skip deployment when the run has no push credentials - #132

Merged
ChrisRackauckas merged 1 commit into
masterfrom
docs-skip-deploy-without-credentials
Sep 4, 2026
Merged

ChrisRackauckas merged 1 commit into
masterfrom
docs-skip-deploy-without-credentials

Conversation

@ChrisRackauckas

Copy link
Copy Markdown
Member

Documentation jobs fail on pull requests from forks and on every Dependabot-triggered run,
after the documentation has built successfully. Recent examples: SciML/FindFirstFunctions.jl#114,
SciML/ModelingToolkitCourse#70, SciML/DiffEqFlux.jl#1070.

Cause

Documenter's deploy_folder treats deployment as possible when either credential is merely
non-empty:

token_ok = env_nonempty("GITHUB_TOKEN")
key_ok   = env_nonempty("DOCUMENTER_KEY")
auth_ok  = token_ok | key_ok

GitHub still injects a GITHUB_TOKEN for fork and Dependabot pull requests — it is just
read-only — so auth_ok is true. Combined with push_preview = true (which the SciML docs
builds use), Documenter builds the docs, attempts to push the preview to gh-pages, and the
job dies with:

fatal: unable to access '...': The requested URL returned error: 403
ERROR: LoadError: failed process: ... `git push -q upstream HEAD:gh-pages`

The documentation itself was fine; only the push failed. The red check is noise, and it trains
reviewers to ignore a failing Documentation job.

Fix

Pass the credentials only when the run can actually deploy. When they are empty Documenter
reports Deploying: ✗ and exits 0, so the job still verifies that the documentation builds —
which is the only thing an untrusted pull request can verify.

Preview deployment is unchanged for same-repository pull requests by a human, and deployment on
push/tag/schedule is untouched.

🤖 Generated with Claude Code

https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R

Documentation jobs fail on pull requests from forks and on every Dependabot-triggered run,
*after* the documentation has built successfully. Recent examples: SciML/FindFirstFunctions.jl#114,
SciML/ModelingToolkitCourse#70, SciML/DiffEqFlux.jl#1070.

## Cause

Documenter's `deploy_folder` treats deployment as possible when either credential is merely
non-empty:

```julia
token_ok = env_nonempty("GITHUB_TOKEN")
key_ok   = env_nonempty("DOCUMENTER_KEY")
auth_ok  = token_ok | key_ok
```

GitHub still injects a `GITHUB_TOKEN` for fork and Dependabot pull requests — it is just
read-only — so `auth_ok` is true. Combined with `push_preview = true` (which the SciML docs
builds use), Documenter builds the docs, attempts to push the preview to `gh-pages`, and the
job dies with:

```
fatal: unable to access '...': The requested URL returned error: 403
ERROR: LoadError: failed process: ... `git push -q upstream HEAD:gh-pages`
```

The documentation itself was fine; only the push failed. The red check is noise, and it trains
reviewers to ignore a failing Documentation job.

## Fix

Pass the credentials only when the run can actually deploy. When they are empty Documenter
reports `Deploying: ✗` and exits 0, so the job still verifies that the documentation builds —
which is the only thing an untrusted pull request can verify.

Preview deployment is unchanged for same-repository pull requests by a human, and deployment on
push/tag/schedule is untouched.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R
@ChrisRackauckas
ChrisRackauckas merged commit 9267d44 into master Sep 4, 2026
3 checks passed
@ChrisRackauckas
ChrisRackauckas deleted the docs-skip-deploy-without-credentials branch September 4, 2026 05:05
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