Skip to content

ci(docs): recheck the PR before each preview push attempt (follow-up to #213) - #214

Open
timosachsenberg wants to merge 1 commit into
mainfrom
claude/docs-preview-recheck
Open

timosachsenberg wants to merge 1 commit into
mainfrom
claude/docs-preview-recheck

Conversation

@timosachsenberg

Copy link
Copy Markdown
Contributor

Requested by Timo · project thread

What this changes

This is the CodeRabbit finding on #213 (thread), which was merged before the fix went in.

The retry loop in deploy-preview can run for a few minutes. In that time, the same PR might get a newer head whose preview is deployed first. The older build's retry would then overwrite that newer preview. Likewise, if the PR is closed and the cleanup job removes pr-<N>/, a retry could recreate the directory.

  • Each attempt now asks the API whether the PR is still open at workflow_run.head_sha (gh api .../pulls/N). If it is closed or has a newer head, the step leaves gh_pages alone and ends without error.
  • The step sets published=true only when it pushed, or when the preview was already current. The comment step runs only then, so a skipped run doesn't post a link to a preview it didn't deploy.

Testing

  • actionlint 1.7.12 with shellcheck: no findings.
  • I ran the deploy script locally against a bare repo with a stubbed gh, starting six deploys at once. Four of them were for open PRs and were all deployed. One was for a PR that had a newer head, and its existing preview was left untouched. One was for a closed PR, and no directory was created for it. The two skipped runs set no published output.

AI use

  • Substantial: Claude Code wrote the change and the local test. A maintainer still has to review it before merging.

Design intent: keep the check inside the loop, right after gh_pages is refreshed, because only there do we know that this push would replace the current state. The check before the loop (from #213) stays, so a mismatched artifact is rejected before anything is downloaded.


Generated by Claude Code

A retry could otherwise overwrite the preview of a newer head of the
same PR, or recreate the directory of a PR that was closed and cleaned
up in the meantime. Each attempt now asks the API whether the PR is
still open at the commit the docs were built from, and the preview
comment is only written when this run published the preview.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0149aXmb68jU8gXuhSYiRqYt
Copilot AI balanced review requested due to automatic review settings November 24, 2026 10:10
@timosachsenberg timosachsenberg self-assigned this Nov 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 37 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: da90d47f-71a5-45d4-a889-b7f9f034f29f
Commits

Reviewing files that changed from the base of the PR and between 19f0686 and 35dbab4.

Files selected for processing: 1

  • .github/workflows/deploy-docs.yml
  • 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

@openmsgithubapp

Copy link
Copy Markdown

📖 Documentation Preview

The documentation for this PR has been built and is available at:
🔗 View Preview

This preview will be updated automatically when you push new commits to this PR.


Preview built from commit: 35dbab4

openmsgithubapp Bot pushed a commit that referenced this pull request Nov 24, 2026

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.

3 participants