Skip to content

fix(cd): make the docs sync job open a PR - #190

Merged
Davidonium merged 1 commit into
mainfrom
fix/dhernando/docs-sync-pr
Sep 3, 2026
Merged

Davidonium merged 1 commit into
mainfrom
fix/dhernando/docs-sync-pr

Conversation

@Davidonium

Copy link
Copy Markdown
Collaborator

The sync-docs job has never opened a PR against landing_page. The v0.26.0 run went green with wrote 84 reference pages followed by no changes to sync.

Three bugs, each enough on its own to drop the PR:

  • git diff --quiet -- <path> only sees tracked, modified files. The cloud-cli/reference directory doesn't exist in landing_page yet, so all 84 pages were untracked and invisible. Even later, newly added command pages would stay invisible. Now it stages first and checks git diff --cached.
  • --base main pointed at a branch landing_page doesn't have — its default is master. Now resolved at runtime from defaultBranchRef.
  • || echo "PR already exists" swallowed every gh pr create failure, including the bad base. Replaced by a gh pr list --head pre-check, so real failures fail the job.

Also adds set -euo pipefail, permissions: contents: read, and partition: deploy on the generated section index so the docs sidebar resolves for the reference pages.

Verified against a sparse clone of landing_page: the old check returns exit 0 on the generated tree, the new one returns exit 1 with 84 files staged, and defaultBranchRef resolves to master.

Follow-up, not fixable from this repo: documentation/cloud-cli.md is a leaf page there, so a cloud-cli/ directory next to it gives Hugo two pages at the same URL and a section with no _index.md. It needs a git mv to cloud-cli/_index.md before or with the first sync PR.

The guard `git diff --quiet` only reports tracked, modified files, so the
84 pages written into a directory that does not exist yet in landing_page
were invisible and every release exited with "no changes to sync". Stage
first, then check the index.

Two more failures were hidden behind that one: `--base main` pointed at a
branch landing_page does not have (its default is master), and the
trailing `|| echo` swallowed the resulting error. Resolve the base from
defaultBranchRef and let a failed `gh pr create` fail the job.

Also give the generated section index `partition: deploy` so the sidebar
resolves for the reference pages.
@Davidonium
Davidonium requested a review from a team September 2, 2026 10:24
@AstraBert

Copy link
Copy Markdown
Contributor

Follow-up, not fixable from this repo: documentation/cloud-cli.md is a leaf page there, so a cloud-cli/ directory next to it gives Hugo two pages at the same URL and a section with no _index.md. It needs a git mv to cloud-cli/_index.md before or with the first sync PR.

I think we need to open a PR that manually removes the cloud_cli page the first time we create this, then following syncs should work without troubles

@Davidonium
Davidonium merged commit fc5281a into main Sep 3, 2026
7 checks passed
@Davidonium
Davidonium deleted the fix/dhernando/docs-sync-pr branch September 3, 2026 06:51
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.

3 participants