From 4ea53490c95061378ff76dc8c43a39715c87846e Mon Sep 17 00:00:00 2001 From: showxu <10173746+showxu@users.noreply.github.com> Date: Sun, 25 Oct 2026 19:12:52 +0800 Subject: [PATCH] ci: run each check once per pull-request push --- .github/workflows/ci.yml | 16 +++------------ .github/workflows/source-policy.yml | 3 ++- README.md | 30 ++++++++++++++++++++++++----- tests/test_ci.py | 2 +- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 077f070..149ac5c 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: @@ -27,17 +28,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: @@ -107,7 +97,7 @@ jobs: tap: agents-tools/workflow-fixture tap-directory: fixtures/homebrew result: - needs: [checks, validate, policy, fixtures, demo-fixture, homebrew] + needs: [checks, validate, fixtures, demo-fixture, homebrew] 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 f292565..d19e84c 100644 --- a/README.md +++ b/README.md @@ -77,25 +77,44 @@ publishes them. ## Calling validation and policy Swift members such as `agents-tools/core`, `agents-tools/cli` and `skill-cli/cli` -use the same configuration reference and workflow calls: +use the same configuration reference and workflow calls. + +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: agents-tools/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: agents-tools/github-workflows/.github/workflows/policy.yml@ # vX.Y.Z with: allow-terms: '' dependabot-exception: true - validate: - uses: agents-tools/github-workflows/.github/workflows/swift-package.yml@ # vX.Y.Z ``` `allow-terms` is a newline-separated, case-insensitive product-name allowlist. @@ -296,7 +315,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..1877edf 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', 'homebrew')} ci.check(needs) for name in needs: for result in ('failure', 'cancelled', 'skipped'):