From 9b470f847f6cf420f1605a8749ae7e1be44d1789 Mon Sep 17 00:00:00 2001 From: sehkone Date: Tue, 4 Aug 2026 13:46:41 +0900 Subject: [PATCH] Stop running CI twice on every pull request `push` matched every branch and `pull_request` matched the same commits, so both fired on one commit and the whole workflow ran twice. On #87 the head commit carried two CI runs and 10 check runs -- one full set per event. They were never a "branch" run and a "merge" run; they were the same commit checked twice. Scope `push` to `main`. Merges still run CI. Drop the `pull_request` base filter as well, so a pull request against any base is covered rather than only those targeting `main`. What this gives up is CI on a branch with no pull request open, and nothing else. `pull_request` checks out the branch already merged into its base, so merge coverage is unaffected. `workflow_dispatch` replaces the lost case (`gh workflow run ci.yml --ref `), and opening the pull request as a draft works too -- nothing here filters drafts. Release automation is unaffected: release branches land through pull requests in this organization, so the `pull_request` trigger still covers them. Closes #88 --- .github/workflows/ci.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8514951..f497d61 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,13 +3,19 @@ name: CI permissions: contents: read +# TRIGGERS: `push` is scoped to `main`. Without a branch filter it also matches +# pushes to pull-request branches, which already match `pull_request`, so every +# job ran twice per commit, on two separate workflow runs. Naming `branches:` +# also stops tag pushes from matching. `pull_request` checks out the branch +# already merged into its base, so merge coverage is not what is being dropped +# here — the one thing lost is CI on a branch with no pull request open, and +# `workflow_dispatch` replaces it (`gh workflow run ci.yml --ref `). + on: - push: - branches: - - "**" pull_request: - branches: - - main + push: + branches: [main] + workflow_dispatch: env: CARGO_TERM_COLOR: always