]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] CI: trigger push only on master to dedup PR runs
authorVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 18 Jun 2026 18:16:54 +0000 (19:16 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 18 Jun 2026 18:16:54 +0000 (19:16 +0100)
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

index 8d8ae15b5464771dc27be35a13629ad2b48e60a5..6276412621ce56df000ac6e0155ad9d9244be10e 100644 (file)
@@ -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/<branch>) and `pull_request` (refs/pull/<n>/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/<branch>) and one for `pull_request`
-# (ref refs/pull/<n>/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: