diff --git a/.github/workflows/cloudflare-preview-forks-build.yml b/.github/workflows/cloudflare-preview-forks-build.yml index 77c19eb6..6b444198 100644 --- a/.github/workflows/cloudflare-preview-forks-build.yml +++ b/.github/workflows/cloudflare-preview-forks-build.yml @@ -78,10 +78,12 @@ jobs: - name: Install dependencies run: npm ci - # textlint and prettier run in test.yml. They are left out here so a - # wording or formatting problem doesn't hold back the preview. + # textlint, prettier, and failing on broken links run in test.yml. They + # are left out here so those problems don't hold back the preview. - name: Build run: npm run build + env: + PREVIEW_BUILD: "true" - name: Save PR number run: echo "${{ github.event.pull_request.number }}" > dist/pr-number.txt diff --git a/astro.config.mjs b/astro.config.mjs index c3d22966..7e5dfcaa 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -77,7 +77,12 @@ export default defineConfig({ prefetch(), linkValidator({ checkExternal: false, - failOnBrokenLinks: true, + // Previews report broken links without failing, like textlint and + // prettier; the build in test.yml is the check that fails. + failOnBrokenLinks: !( + process.env.PREVIEW_BUILD || + (process.env.CF_PAGES && process.env.CF_PAGES_BRANCH !== "main") + ), exclude: ["/_astro/*", "/s/*", "/board", "/download/*"], }), ],