From d74993182938128cab327c21bf63f4d91870d863 Mon Sep 17 00:00:00 2001
From: Axel Heider <axelheider@gmx.de>
Date: Thu, 4 Apr 2024 13:45:53 +0200
Subject: [PATCH] CI: cancel older concurrent PR runs

Signed-off-by: Axel Heider <axelheider@gmx.de>
---
 .github/workflows/sel4test-sim.yml | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/.github/workflows/sel4test-sim.yml b/.github/workflows/sel4test-sim.yml
index 6568e331..33436c89 100644
--- a/.github/workflows/sel4test-sim.yml
+++ b/.github/workflows/sel4test-sim.yml
@@ -13,6 +13,14 @@ on:
     branches: [master]
   pull_request:
 
+
+# Cancel older runs of this workflow that are still not finished for the
+# current PR. This reduces the CI load. For deployment to the master branch,
+# the workflow will run on each push, but no cancellation happens here.
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || format('run-{0}', github.run_id) }}
+  cancel-in-progress: ${{ github.event_name == 'pull_request' }}
+
 jobs:
   cparser:
     name: Simulation