Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 22 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
- pre-job
if: needs.pre-job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
timeout-minutes: 30
timeout-minutes: 40
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
Expand All @@ -120,13 +120,17 @@ jobs:
cache: true
require-lockfile: true

- name: Run link checker unit tests
run: node --test scripts/check-links.test.js
- name: Run link and sitemap checker unit tests
run: pnpm run test:link-check

- name: Run comparison label unit tests
run: node --test lib/compare-labels.test.js

- name: Build next.js app
run: pnpm build

- name: Start production server
id: server
run: |
pnpm start &
echo "SERVER_PID=$!" >> "$GITHUB_ENV"
Expand All @@ -135,48 +139,28 @@ jobs:
- name: Check markdown and source links
run: pnpm link-check

# Run even if the preceding link check failed, but only with a ready server.
- name: Check sitemap URLs
if: ${{ !cancelled() && steps.server.outcome == 'success' }}
run: pnpm sitemap-check

- name: Stop production server
if: always()
run: kill "$SERVER_PID" || true

# Preserve the existing required check name; both suites run in the job above.
check-sitemap-links:
needs:
- pre-job
if: needs.pre-job.outputs.should_skip != 'true'
- build-and-check-links
if: ${{ !cancelled() && needs.pre-job.outputs.should_skip != 'true' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Run the compatibility check after shared-job cancellation

When build-and-check-links is cancelled, !cancelled() prevents this compatibility job from running, so its conclusion is skipped; GitHub treats skipped required jobs as successful for branch protection. Repositories still requiring the preserved check-sitemap-links check can therefore merge even though neither link suite completed, contrary to the requirement that all three CI checks run on every PR. Run the proxy with always() and let its existing result comparison fail for cancelled.

AGENTS.md reference: AGENTS.md:L61-L63

Useful? React with 👍 / 👎.

runs-on: ubuntu-latest
timeout-minutes: 20
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
timeout-minutes: 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- uses: pnpm/setup@703c52620218391530e48b9e8870d5c0082e1b9b # v2.1.0
id: pnpm-install
with:
runtime: node@22
cache: true
require-lockfile: true

- name: Run sitemap checker unit tests
run: node --test scripts/check-sitemap-links.test.js lib/compare-labels.test.js

- name: Build next.js app
run: pnpm build

- name: Start production server
run: |
pnpm start &
echo "SERVER_PID=$!" >> "$GITHUB_ENV"
timeout 30 bash -c 'until curl -sf http://127.0.0.1:3333 > /dev/null; do sleep 1; done'

- name: Check sitemap URLs
run: pnpm sitemap-check

- name: Stop production server
if: always()
run: kill "$SERVER_PID" || true
- name: Verify shared build and checks passed
env:
RESULT: ${{ needs.build-and-check-links.result }}
run: test "$RESULT" = success

# Summary job that depends on all other jobs
# This allows you to require only this single check in branch protection rules
Expand All @@ -193,10 +177,10 @@ jobs:
if: always()
steps:
- name: Successful CI
if: ${{ !(contains(needs.*.result, 'failure')) }}
if: ${{ !(contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }}
run: exit 0
working-directory: .
- name: Failing CI
if: ${{ contains(needs.*.result, 'failure') }}
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: exit 1
working-directory: .
Loading