Repository navigation
Conversation
6cfddc6 to
5cd964b
Compare
805320c to
910795d
Compare
The website build checks links between doc pages (`onBrokenLinks`, `onBrokenAnchors`), but it only ran as part of the deploy, when a commit landed on `main`. A PR that broke a link was green and then broke the deploy. Adds `preview-website.yml`, which runs `yarn build` in `website/` on PRs that touch `docs/**` or `website/`. In forks, it also runs on pushed branches and publishes each one as a preview at `https://<owner>.github.io/<repo>/<branch>/`, once the fork owner enables workflows and GitHub Pages from the `gh-pages` branch. "Export to GitHub" pushes to the author's fork by default, so exported diffs get previews too. `WEBSITE_BASE_URL` overrides the website's `baseUrl`. The help page links use `Link`, so they follow it. Adds a `website-install` composite action, like `yarn-install`, that sets up Node with the yarn cache for `website/yarn.lock` and installs the website's dependencies. `preview-website.yml` and `deploy-website.yml` use it, so `deploy-website.yml` no longer restores the yarn cache by hand. `preview-website.yml` also runs when the action changes. Adds `link-website-preview.yml`, which waits until the preview of a PR from a fork serves the PR head, and fails the PR if it doesn't within 15 minutes. If the PR description doesn't link the preview, it adds a "## Website preview" section to its bottom, with the link and a warning that the fork owner hosts the preview, and comments that it did. It fails if the description links the preview without that exact section. It runs on `pull_request_target`, to get a token that can edit the PR, and never checks out PR code. Changelog: [Internal]
910795d to
56ac0de
Compare
Metro review: Changes suggestedRisk: low · Commit: This PR builds the website on PRs that touch docs, publishes per-branch previews from forks to Findings
Verified
Not run: I didn't build the website with a non-root Automated review by Claude. Advisory only: it never approves or blocks, and a maintainer makes the call. |
huntie
left a comment
There was a problem hiding this comment.
Immediate gut feedback is please make this a separate comment (can still have the h2). Editing the PR description is invasive, plus this aligns with the RN website automation already.
Summary
The website build checks links between doc pages (
onBrokenLinks,onBrokenAnchors), but it only ran as part of the deploy, when a commit landed onmain. A PR that broke a link was green and then broke the deploy.Adds
preview-website.yml, which runsyarn buildinwebsite/on PRs that touchdocs/**orwebsite/. In forks, it also runs on pushed branches and publishes each one as a preview athttps://<owner>.github.io/<repo>/<branch>/, once the fork owner enables workflows and GitHub Pages from thegh-pagesbranch. "Export to GitHub" pushes to the author's fork by default, so exported diffs get previews too.WEBSITE_BASE_URLoverrides the website'sbaseUrl. The help page links useLink, so they follow it.Adds a
website-installcomposite action, likeyarn-install, that sets up Node with the yarn cache forwebsite/yarn.lockand installs the website's dependencies.preview-website.ymlanddeploy-website.ymluse it, sodeploy-website.ymlno longer restores the yarn cache by hand.preview-website.ymlalso runs when the action changes.Adds
link-website-preview.yml, which waits until the preview of a PR from a fork serves the PR head, and fails the PR if it doesn't within 15 minutes. If the PR description doesn't link the preview, it adds a "## Website preview" section to its bottom, with the link and a warning that the fork owner hosts the preview, and comments that it did. It fails if the description links the preview without that exact section. It runs onpull_request_target, to get a token that can edit the PR, and never checks out PR code.Changelog: [Internal]
Test plan
main, in TEST ONLY: link-website-preview vzaidman/metro#10:pull_request_targetruns the workflow frommain, so it doesn't run on this PR.yarn format-checkpasses, and the action and workflows parse as YAML.FB_INTERNAL=1 WEBSITE_BASE_URL=/metro/export-D128585771/ yarn buildinwebsite/succeeds, and the home and help page links start with that base. WithoutWEBSITE_BASE_URL, they start with/docs/as before.gh-pagesunder<branch>/, and served by GitHub Pages at the preview URL, with.shamatching the pushed commit.link-website-preview.ymlscript, run locally with a local server and mocked API, fails when.shais missing or from another commit. When.shamatches the PR head, it appends the section and comments if the description doesn't link the preview, passes if it includes the exact section, also with CRLF line endings, and fails if it links the preview without it.