From 1523a2f4deb566004ac41e369209ec015fbfaf79 Mon Sep 17 00:00:00 2001
From: Tom Herbers <mail@tomherbers.de>
Date: Tue, 26 Dec 2023 14:02:54 +0100
Subject: [PATCH] github: build-gluon: cancel obsolete in progress workflows
 for PRs (#3115)

Goal is to cancel Worfklows for Pull Request if they become obsolte
due to new changes.
Without this workflows will continue running, wasting resources and
delaying the run of relevant workflows.
This situation will typically occour if a author of a PR notices an
error/typo/missing bit and pushes new changes to the branch.

This won't affect concurrent workflows for otherwise triggered
workflows (push, workflow_dispatch, tag, ...).
---
 .github/workflows/build-gluon.yml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/.github/workflows/build-gluon.yml b/.github/workflows/build-gluon.yml
index 6081f8fd6..40fe7f69b 100644
--- a/.github/workflows/build-gluon.yml
+++ b/.github/workflows/build-gluon.yml
@@ -12,6 +12,10 @@ on:
 permissions:
   contents: read
 
+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref || github.run_id }}-${{ github.event.pull_request.number || github.run_id }}
+  cancel-in-progress: true
+
 jobs:
   changed:
     permissions:
-- 
GitLab