Skip to content

Open a draft documentation PR when code merges to main - #1217

Draft
dhruv8sh wants to merge 1 commit into
mainfrom
chore/docs-auto-pr
Draft

dhruv8sh wants to merge 1 commit into
mainfrom
chore/docs-auto-pr

Conversation

@dhruv8sh

Copy link
Copy Markdown
Collaborator

Summary

  • When code merges to main, open a draft documentation PR so the doc updates for that change have a home and don't get forgotten.
  • The draft PR branches from the merged commit (docs/<sha>) with one empty commit, links the source PR, and lists the files the merge changed.
  • Merges that only touch docs/** or Markdown are skipped.

Changes

File Change
.github/workflows/docs-pr.yml New workflow on push to main (ignoring docs/Markdown-only pushes); job-scoped contents: write and pull-requests: write.
scripts/open-docs-pr.sh Creates the docs/<sha> branch, pushes it, and opens the draft PR with gh. Falls back to the commit's own diff when the push's before-SHA is all zeros. Caps the file list at 100. DRY_RUN=1 prints the PR instead.
scripts/README.md Adds the script to the scripts table (Prettier re-padded the existing rows).

Closes

Closes #1105

Test plan

  • cargo test-fastly && cargo test-axum (plus cargo test-cloudflare)
  • cargo clippy-fastly && cargo clippy-axum (plus cargo clippy-cloudflare, cargo check-cloudflare)
  • cargo fmt --all -- --check
  • JS tests: cd crates/trusted-server-js/lib && npx vitest run (on the pinned Node 24.12.0)
  • JS format: cd crates/trusted-server-js/lib && npm run format
  • Docs format: cd docs && npm run format
  • WASM build: cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1
  • Manual testing via fastly compute serve
  • Other:
    • actionlint on the workflow and shellcheck on the script: clean.
    • DRY_RUN=1 against Make body hold parser-aware and stream Next.js processing #1135's merge commit: correct title, source PR resolved to Make body hold parser-aware and stream Next.js processing #1135, all 29 changed files listed; the all-zero before-SHA fallback produces the same result.
    • Full path in a scratch clone pushing to a local bare remote with a stub gh: the branch has exactly one empty commit on the merge commit, and gh pr create --draft --base main receives the expected title and body.
    • The workflow itself was not run end to end (that would push to this repository).

Notes for reviewers

  • The repository setting Allow GitHub Actions to create and approve pull requests must be enabled for the workflow's gh pr create to succeed.
  • PRs opened with the default GITHUB_TOKEN do not trigger other workflows, so CI will not run on these draft PRs until someone pushes to them. Swapping in a GitHub App token would change that if CI on open is wanted.

Checklist

  • Changes follow AGENTS.md conventions
  • No unwrap() in production code — use expect("should ...") (no Rust changes)
  • Uses tracing macros (not println!) (no Rust changes)
  • New code has tests (shell/workflow only; verified with the dry-run and local-remote runs above)
  • No secrets or credentials committed

Each push to main that changes more than Markdown runs scripts/open-docs-pr.sh, which pushes a docs/<sha> branch with one empty commit and opens a draft PR linking the source PR and listing the files it changed.

Closes #1105.

Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
@dhruv8sh dhruv8sh added this to the 202610 milestone Sep 28, 2026
@aram356
aram356 marked this pull request as draft September 28, 2026 15:22

This branch has not been deployed

No deployments
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.

Automatically open PR for documentation changes when code merged to main

1 participant