mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-10-23 09:33:20 +00:00
Defer Pages validation until draft pull requests are ready
This commit is contained in:
1 parent
32874ea97f
commit
070fef7669
2 files changed
+16
-2
No files matched your search
@@ -14,6 +14,7 @@ on:
|
|||||||
- 'package-lock.json'
|
- 'package-lock.json'
|
||||||
- '.github/workflows/deploy-pages.yml'
|
- '.github/workflows/deploy-pages.yml'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
types: [opened, synchronize, reopened, ready_for_review]
|
||||||
paths:
|
paths:
|
||||||
- 'aggregator.html'
|
- 'aggregator.html'
|
||||||
- 'src/**'
|
- 'src/**'
|
||||||
@@ -32,6 +33,7 @@ concurrency:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
|
||||||
name: Validate and package Pages site
|
name: Validate and package Pages site
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ type Concurrency = {
|
|||||||
"cancel-in-progress"?: boolean | string;
|
"cancel-in-progress"?: boolean | string;
|
||||||
};
|
};
|
||||||
type Workflow = {
|
type Workflow = {
|
||||||
on?: Partial<Record<Trigger, { paths?: string[] }>>;
|
on?: Partial<Record<Trigger, { paths?: string[]; types?: string[] }>>;
|
||||||
concurrency?: Concurrency;
|
concurrency?: Concurrency;
|
||||||
jobs?: Record<string, { concurrency?: Concurrency }>;
|
jobs?: Record<string, { if?: string; concurrency?: Concurrency }>;
|
||||||
};
|
};
|
||||||
|
|
||||||
function readWorkflow(filename: string): Workflow {
|
function readWorkflow(filename: string): Workflow {
|
||||||
@@ -26,6 +26,18 @@ function matchesAnyPath(patterns: string[], filename: string): boolean {
|
|||||||
const pagesWorkflow = readWorkflow("deploy-pages.yml");
|
const pagesWorkflow = readWorkflow("deploy-pages.yml");
|
||||||
const unitWorkflow = readWorkflow("unit-ci.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", () => {
|
describe("CI workflow path filters", () => {
|
||||||
it.each(["push", "pull_request"] as const)("runs Pages checks for the manifest on %s", (trigger) => {
|
it.each(["push", "pull_request"] as const)("runs Pages checks for the manifest on %s", (trigger) => {
|
||||||
const patterns = pagesWorkflow.on?.[trigger]?.paths ?? [];
|
const patterns = pagesWorkflow.on?.[trigger]?.paths ?? [];
|
||||||
|
|||||||
Reference in new issue
Block a user