diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml index 7683c7da..ab0538c0 100644 --- a/.github/workflows/deploy-pages.yml +++ b/.github/workflows/deploy-pages.yml @@ -14,6 +14,7 @@ on: - 'package-lock.json' - '.github/workflows/deploy-pages.yml' pull_request: + types: [opened, synchronize, reopened, ready_for_review] paths: - 'aggregator.html' - 'src/**' @@ -32,6 +33,7 @@ concurrency: jobs: build: + if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }} name: Validate and package Pages site runs-on: ubuntu-latest steps: diff --git a/utils/ci-pages.unit.spec.ts b/utils/ci-pages.unit.spec.ts index 5130c2bb..fbece795 100644 --- a/utils/ci-pages.unit.spec.ts +++ b/utils/ci-pages.unit.spec.ts @@ -9,9 +9,9 @@ type Concurrency = { "cancel-in-progress"?: boolean | string; }; type Workflow = { - on?: Partial>; + on?: Partial>; concurrency?: Concurrency; - jobs?: Record; + jobs?: Record; }; function readWorkflow(filename: string): Workflow { @@ -26,6 +26,18 @@ function matchesAnyPath(patterns: string[], filename: string): boolean { const pagesWorkflow = readWorkflow("deploy-pages.yml"); const unitWorkflow = readWorkflow("unit-ci.yml"); +describe("Pages pull request lifecycle", () => { + it("defers draft validation and starts checks when the pull request is ready", () => { + expect(pagesWorkflow.jobs?.build?.if).toBe( + "${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}" + ); + expect(pagesWorkflow.on?.pull_request?.types).toEqual( + expect.arrayContaining(["opened", "synchronize", "reopened", "ready_for_review"]) + ); + expect(pagesWorkflow.jobs?.deploy?.if).toBe("github.event_name != 'pull_request'"); + }); +}); + describe("CI workflow path filters", () => { it.each(["push", "pull_request"] as const)("runs Pages checks for the manifest on %s", (trigger) => { const patterns = pagesWorkflow.on?.[trigger]?.paths ?? [];