diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e7ba292..6884e5f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,9 @@ name: CI on: push: + branches: [master] pull_request: - types: [opened, edited, synchronize, reopened] + types: [opened, synchronize, reopened] workflow_dispatch: permissions: {} jobs: @@ -26,17 +27,6 @@ jobs: contents: read actions: read uses: ./.github/workflows/swift-package.yml - policy: - permissions: - contents: read - uses: ./.github/workflows/policy.yml - with: - allow-terms: | - ChatGPT - Codex - Cursor - Claude - dependabot-exception: true fixtures: runs-on: ${{ matrix.runner }} permissions: @@ -99,7 +89,7 @@ jobs: echo "$GITHUB_WORKSPACE/.build/venv/bin" >> "$GITHUB_PATH" - run: python3 scripts/test-fixtures.py demo --toolchain .build/presentation-source/skills/github-readme-design/scripts result: - needs: [checks, validate, policy, fixtures, demo-fixture] + needs: [checks, validate, fixtures, demo-fixture] if: always() runs-on: ubuntu-24.04 permissions: diff --git a/.github/workflows/source-policy.yml b/.github/workflows/source-policy.yml index 19a3189..e5cf572 100644 --- a/.github/workflows/source-policy.yml +++ b/.github/workflows/source-policy.yml @@ -1,6 +1,7 @@ name: Source policy on: - push: {} + push: + branches: [master] pull_request: types: [opened, edited, synchronize, reopened] workflow_dispatch: {} diff --git a/README.md b/README.md index 73fd4bc..ce3a4fc 100644 --- a/README.md +++ b/README.md @@ -73,23 +73,42 @@ publishes them. ## Calling validation and policy +Callers run validation once for each pull-request push, once for each push to +the default branch and on manual dispatch. Source policy runs on pull requests +and default-branch pushes, and also when a pull request is edited, because it +checks the title: + ```yaml name: CI on: push: + branches: [master] pull_request: - types: [opened, edited, synchronize, reopened] + types: [opened, synchronize, reopened] + workflow_dispatch: permissions: contents: read actions: read +jobs: + validate: + uses: swift-library/github-workflows/.github/workflows/swift-package.yml@ # vX.Y.Z +``` + +```yaml +name: Source policy +on: + push: + branches: [master] + pull_request: + types: [opened, edited, synchronize, reopened] +permissions: + contents: read jobs: policy: uses: swift-library/github-workflows/.github/workflows/policy.yml@ # vX.Y.Z with: allow-terms: '' dependabot-exception: false - validate: - uses: swift-library/github-workflows/.github/workflows/swift-package.yml@ # vX.Y.Z ``` `allow-terms` is a newline-separated, case-insensitive product-name allowlist. @@ -245,7 +264,8 @@ changed-step diagnostic and recording diff. Build and toolchain errors fail the harness. Regenerate the passing recording with the same toolchain's `node /src/cli.ts terminal record --script --executable --out `. -CI calls the validation and policy workflows with passing fixture packages. +CI calls the validation workflow with passing fixture packages, and the source +policy workflow calls the policy workflow for this repository's own changes. The root configuration targets `fixtures/passing` and declares every validation job type. The scripts exercise each job's rejection path against failing fixtures on its matching runner. A failing reusable-workflow call cannot be an diff --git a/tests/test_ci.py b/tests/test_ci.py index feb76d8..00a2dff 100644 --- a/tests/test_ci.py +++ b/tests/test_ci.py @@ -12,7 +12,7 @@ class CIResultTests(unittest.TestCase): def test_all_dependencies_must_succeed(self): needs = {name: {'result': 'success'} - for name in ('checks', 'validate', 'policy', 'fixtures', 'demo-fixture')} + for name in ('checks', 'validate', 'fixtures', 'demo-fixture')} ci.check(needs) for name in needs: for result in ('failure', 'cancelled', 'skipped'):