From 71605c251d7d05f6dcebbe57a5e78d90af1b8d1d Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 18 Jun 2026 19:16:54 +0100 Subject: [PATCH] [Minor] CI: trigger push only on master to dedup PR runs A commit on a branch with an open PR fired both a push and a pull_request run; concurrency cancel-in-progress reaped one, leaving a spurious *cancelled* run that reads like a CI failure. Restrict push to master so feature branches run a single pull_request workflow; key the concurrency group on PR number / ref to still cancel superseded runs. --- .github/workflows/ci.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d8ae15b54..6276412621 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,21 +4,21 @@ on: pull_request: branches: - master + # Push only triggers on master. Feature branches are covered by the + # `pull_request` event once a PR is open, so we never fire both `push` + # (refs/heads/) and `pull_request` (refs/pull//merge) for the + # same commit -- which previously left a spurious *cancelled* run that + # reads like a CI failure. Trade-off: pushing to a branch with no open + # PR doesn't run CI; open (or draft) the PR to get it. push: branches: - - '**' + - master -# A commit pushed to a branch that also has an open PR fires two runs at -# once: one for `push` (ref refs/heads/) and one for `pull_request` -# (ref refs/pull//merge). They duplicate each other's work and, sharing -# the hosted runners, double CPU load -- which is enough to push the heavy -# 001_merged rspamd's controller startup past the functional suites' fixed -# readiness timeouts and flake (e.g. 440_ssl_server). The only identifier -# the two events share is the head commit SHA (their refs differ), so key -# the concurrency group on it: both events for one commit collapse to a -# single run, and cancel-in-progress reaps the loser instead of racing it. +# Cancel a still-running CI when a newer commit supersedes it: per PR for +# pull_request events, per ref for master pushes. This only reaps genuinely +# outdated runs now -- the push/pull_request duplicate is gone at the source. concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.head.sha || github.sha }} + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: -- 2.47.3