Skip to content

Only build once in PR workflows: Step 1 - #28975

Merged
mvvmm merged 12 commits into
productionfrom
only-build-one-in-github-workflows
Mar 19, 2026
Merged

mvvmm merged 12 commits into
productionfrom
only-build-one-in-github-workflows

Conversation

@mvvmm

@mvvmm mvvmm commented Mar 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Note: We're adding back the compiles job, to meet the repo requirements of having a compiles job. So currently, this still builds twice. We will change the repo rules after merging this PR to only require build and validate. Then we will add another PR to remove the compiles job.

Previously, opening a PR triggered two separate full site builds: one in ci.yml (for checks) and one in publish-preview.yml (for preview deployment). This PR consolidates them into a single build.

What changed

Deleted publish-preview.yml — the separate workflow that built the site on every push to non-production branches is gone.

Restructured ci.yml into four focused jobs:

  • build — runs the full site build, uploads dist/ as a GitHub Actions artifact. Handles link-check failures gracefully: if the build produced output but exited non-zero (link validation failure), the job still passes and sets an output flag so downstream jobs can report it without blocking the preview deploy.
  • validate — downloads the artifact and runs ESLint, format checks, redirect validation, and tests. No rebuild needed.
  • publish-preview — downloads the artifact and deploys to Cloudflare Workers preview. Replaces the build+deploy that publish-preview.yml used to do. The computed BRANCH_SLUG is passed as a step output to the post-preview-url-comment script, so branch slug logic is no longer duplicated between shell and TypeScript.
  • notify — posts or removes the CI failure comment on the PR.

Updated bin scripts:

  • bin/post-pr-ci-failure-comment/index.ts — looks for Build and Validate jobs instead of the old Compiles job name.
  • bin/post-preview-url-comment/index.ts — reads BRANCH_SLUG from the environment (set by the deploy step) instead of computing it independently. Supports both pull_request and push event contexts for the PR number lookup.
  • bin/post-preview-url-comment/util.ts — removed branchToSubdomain since the slug is now computed once in the shell deploy step and passed through.
  • bin/post-preview-url-comment/index.node.test.ts — removed branchToSubdomain tests.

Testing

Note: Ignore the Compiles job in these screenshots, it would need to be removed

With invalid link, but otherwise successful build

Screenshot 2026-03-13 at 11 35 34 AM Screenshot 2026-03-13 at 11 35 29 AM

With actual failing build

Screenshot 2026-03-13 at 3 25 00 PM Screenshot 2026-03-13 at 3 43 27 PM Screenshot 2026-03-13 at 3 43 37 PM

@github-actions

github-actions Bot commented Mar 13, 2026 •

Copy link
Copy Markdown
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/.github/ @cloudflare/content-engineering, @kodster28, @mvvmm, @colbywhite, @ahaywood
*.ts @cloudflare/content-engineering, @kodster28

@github-actions

github-actions Bot commented Mar 13, 2026 •

Copy link
Copy Markdown
Contributor

@mvvmm mvvmm mentioned this pull request Mar 13, 2026
@mvvmm
mvvmm marked this pull request as ready for review March 13, 2026 20:45
@mvvmm
mvvmm requested a review from a team March 13, 2026 20:45
@mvvmm
mvvmm requested review from a team, ahaywood, colbywhite and kodster28 as code owners March 13, 2026 20:45
@mvvmm mvvmm changed the title Only build once in PR workflows Only build once in PR workflows: Step 1 Mar 19, 2026
@mvvmm
mvvmm merged commit c635af2 into production Mar 19, 2026
14 checks passed
@mvvmm
mvvmm deleted the only-build-one-in-github-workflows branch March 19, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants