diff --git a/.github/pull-request-policy.yml b/.github/pull-request-policy.yml index 87d0a07..d65c4f4 100644 --- a/.github/pull-request-policy.yml +++ b/.github/pull-request-policy.yml @@ -1,10 +1,4 @@ policies: - github-changes-need-approval: - when: - changed: '.github/**' - require: - approvals: 1 - conventional-title: require: title: '^(feat|fix|docs|refactor|test|chore|build|ci|perf|revert)(\([^)]+\))?!?: .+' diff --git a/.github/workflows/self-test.yml b/.github/workflows/self-test.yml index af82ce8..153ce0c 100644 --- a/.github/workflows/self-test.yml +++ b/.github/workflows/self-test.yml @@ -2,6 +2,7 @@ name: self-test on: pull_request: + types: [opened, synchronize, reopened, edited] permissions: {} diff --git a/README.md b/README.md index 6670733..f5cbe90 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,9 @@ For the fastest first run, keep the workflow and policy together: ```yaml name: PR Policy -on: [pull_request] +on: + pull_request: + types: [opened, synchronize, reopened, edited] jobs: policy: diff --git a/docs/quick-start.md b/docs/quick-start.md index de2eff3..02ddd3b 100644 --- a/docs/quick-start.md +++ b/docs/quick-start.md @@ -15,7 +15,9 @@ The inline `policy` input keeps this first experiment to one file: ```yaml name: PR Policy -on: [pull_request] +on: + pull_request: + types: [opened, synchronize, reopened, edited] jobs: policy: @@ -69,7 +71,9 @@ repository controls that make the result a merge gate. ```yaml name: PR Policy -on: [pull_request] +on: + pull_request: + types: [opened, synchronize, reopened, edited] jobs: policy: diff --git a/src/generator/workflow.ts b/src/generator/workflow.ts index 66c776e..e6a89a2 100644 --- a/src/generator/workflow.ts +++ b/src/generator/workflow.ts @@ -8,7 +8,9 @@ function appendLine(lines: string[], level: number, value: string): void { export function generateWorkflowYaml(options: WorkflowOptions): string { const lines: string[] = []; appendLine(lines, 0, 'name: PR Policy'); - appendLine(lines, 0, 'on: [pull_request]'); + appendLine(lines, 0, 'on:'); + appendLine(lines, 1, 'pull_request:'); + appendLine(lines, 2, 'types: [opened, synchronize, reopened, edited]'); appendLine(lines, 0, 'jobs:'); appendLine(lines, 1, 'policy:'); appendLine(lines, 2, 'runs-on: ubuntu-latest'); diff --git a/test b/test index 7ed6ff8..45a4fb7 100644 --- a/test +++ b/test @@ -1 +1 @@ -5 +8 diff --git a/tests/unit/generator-quick-start.test.ts b/tests/unit/generator-quick-start.test.ts index 6bdd47c..38c2b9c 100644 --- a/tests/unit/generator-quick-start.test.ts +++ b/tests/unit/generator-quick-start.test.ts @@ -18,7 +18,9 @@ describe('quick start generator', () => { const yaml = generateWorkflowYaml(createDefaultGeneratorState().workflow); expect(yaml).toBe(`name: PR Policy -on: [pull_request] +on: + pull_request: + types: [opened, synchronize, reopened, edited] jobs: policy: runs-on: ubuntu-latest