Skip to content

ci(docs): build the docs site from a workflow with a docs filter - #4801

Merged
dan-petty merged 4 commits into
mainfrom
ci/4656-build-the-docs-site-from-a
Nov 11, 2026
Merged

dan-petty merged 4 commits into
mainfrom
ci/4656-build-the-docs-site-from-a

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Add .github/workflows/pages.yml, which builds docs/ and deploys it to GitHub Pages with the official Pages actions, pinned by commit SHA. It runs on a push to main that changes docs/ or the workflow, and on a manual run. Only the deploy job can write to Pages.

The legacy Pages build of main:/docs runs 3 jobs on each push to main, also when the push changes no file under docs/. The account runs at most 20 hosted jobs at one time, so each such job makes the queue of each pull request longer. When the owner sets the Pages source to GitHub Actions, a merge that changes no site file starts no Pages job.

docs/SDLC.md, the head of docs/_config.yml and an amendment line in ADR 0012 now name the workflow as the builder of the site.

Closes #4656

Change: openspec/changes/archive/2026-11-11-4656-build-the-docs-site-from-a/

The legacy Pages build of main:/docs runs 3 jobs on each push to main,
also when the push changes no file under docs/. pages.yml builds and
deploys docs/ with the official Pages actions only on a push to main that
changes docs/ or the workflow, and on a manual run.
@dan-petty dan-petty added type/infra Type infra: the build, CI, images or cluster scope/docs Documents, guides, ADRs and generated references labels Nov 11, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Owner step: set the Pages source to GitHub Actions

Only a person changes repository settings, so this PR does not change the source.

  1. Open Settings > Pages > Build and deployment. Set Source to GitHub Actions. Or run: uv run devops gh api -X PUT repos/dan-petty/devops-cli/pages -f build_type=workflow
  2. Make sure that the source is changed: uv run devops gh api repos/dan-petty/devops-cli/pages --jq .build_type gives workflow.

Order. You can do the step before or after the merge.

  • Before the merge (recommended): the merge push changes .github/workflows/pages.yml, so the Pages workflow builds and deploys the site at once.
  • After the merge: until the switch, the legacy build and the Pages workflow both publish the same docs/. After the switch, if the site does not show the latest docs/, start one manual run: Actions > Pages > Run workflow, on main.

Check after the switch.

  • A merge that changes no file under docs/ starts no Pages job: uv run devops gh api "repos/dan-petty/devops-cli/actions/runs?head_sha=<sha>" --jq '.workflow_runs[].name' lists neither pages-build-deployment nor Pages.
  • A merge that changes docs/ starts one Pages run with the jobs Build Site and Deploy Site, and the published site shows the change.

@dan-petty

dan-petty commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner Author

Measurements (Actions API)

Window: 2026-11-04 00:00 UTC to 2026-11-11 19:37 UTC (7.8 days). Script: list the runs of the dynamic workflow pages-build-deployment, then git diff-tree of each head commit.

Before (legacy build of main:/docs)

Item Value
Pushes to main 606
Runs of pages-build-deployment 606 (471 success, 135 cancelled)
Jobs in each run 3 (build, report-build-status, deploy)
Jobs in the window at most 1,818
Pushes that changed no file under docs/ 351 of 606 (58%)
Jobs of those pushes at most 1,053 (about 135 each day)
Job time, 40 successful runs build mean 25.3 s (max 32 s), report-build-status mean 4.1 s, deploy mean 10.0 s (max 18 s)
Runner time about 39 s each run, at most about 400 runner-min in the window

After (expected, after the owner switch)

Item Value
Pushes that start a Pages run 255 of 606 (only pushes that change docs/ or pages.yml)
Jobs in each run 2 (Build Site, Deploy Site)
Jobs in the window 510 (72% fewer than 1,818)
Pushes that start no Pages job 351

The runner time of a Pages run is not measured yet, because the workflow runs only on main. To measure it after the merge: uv run devops gh api "repos/dan-petty/devops-cli/actions/workflows/pages.yml/runs?per_page=20" --jq ".workflow_runs[] | [.id, .conclusion, .run_started_at, .updated_at] | @tsv".

Checks on this branch

  • uv run devops ci --only actionlint,zizmor: pass. zizmor 1.30.1 on pages.yml: no findings.
  • uv run devops ci test tests/invariants/test_workflow_contracts.py: 117 passed.
  • uv run devops ci docs, uv run devops openspec check, uv run devops gh pages verify: pass.

@dan-petty
dan-petty marked this pull request as ready for review November 11, 2026 21:48
@dan-petty
dan-petty enabled auto-merge (squash) November 11, 2026 21:48
@dan-petty
dan-petty merged commit bbb952e into main Nov 11, 2026
25 checks passed
@dan-petty
dan-petty deleted the ci/4656-build-the-docs-site-from-a branch November 11, 2026 21:59
@dan-petty

Copy link
Copy Markdown
Owner Author

After the merge: first run of the Pages workflow (Actions API)

Run 43107855142, push of merge commit bbb952ed09 (the push changed .github/workflows/pages.yml):

Job Result Time
Build Site success 31 s (22:08:39 to 22:09:10 UTC)
Deploy Site success 27 s (22:09:39 to 22:10:06 UTC)
  • The run waited about 9 minutes in the queue (created 21:59:25 UTC) before its first job started.
  • The Pages source is still legacy, and the deploy succeeded. So a deploy from main works before the switch, as the README of deploy-pages says. For this commit, both the legacy build and the workflow deployed the same docs/.
  • Compared with the legacy build (3 jobs, about 39 s of runner time in each run), the workflow uses 2 jobs and about 58 s of runner time in each run, but runs only for a push that changes docs/ or pages.yml.

The saving starts when the owner does the step in the comment above (Pages source: GitHub Actions).

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

Labels

scope/docs Documents, guides, ADRs and generated references type/infra Type infra: the build, CI, images or cluster

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci(pages): build the docs site from a workflow with a docs filter

1 participant