From 1e94ad2db5b0facc326168f9e1992e141c25706f Mon Sep 17 00:00:00 2001
From: Daniel Arndt <arndtd@ornl.gov>
Date: Thu, 18 Nov 2021 17:01:43 -0500
Subject: [PATCH] Replace cancel-builds-on-update by concurrency feature in the
 GitHub CI

---
 .github/workflows/cancelling.yml | 19 -------------------
 .github/workflows/indent.yml     |  4 ++++
 .github/workflows/linux.yml      |  4 ++++
 .github/workflows/osx.yml        |  4 ++++
 .github/workflows/windows.yml    |  4 ++++
 5 files changed, 16 insertions(+), 19 deletions(-)
 delete mode 100644 .github/workflows/cancelling.yml

diff --git a/.github/workflows/cancelling.yml b/.github/workflows/cancelling.yml
deleted file mode 100644
index 8134ce940d..0000000000
--- a/.github/workflows/cancelling.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-name: cancel-duplicates
-on:
-  workflow_run:
-    workflows: ['github-docker', 'github-linux', 'github-OSX', 'github-windows', 'indent']
-    types: ['requested']
-
-jobs:
-  cancel-duplicate-workflow-runs:
-    name: "Cancel duplicate workflow runs"
-    runs-on: ubuntu-latest
-    steps:
-      - uses: potiuk/cancel-workflow-runs@master
-        name: "Cancel duplicate workflow runs"
-        with:
-          cancelMode: duplicates
-          cancelFutureDuplicates: true
-          token: ${{ secrets.GITHUB_TOKEN }}
-          sourceRunId: ${{ github.event.workflow_run.id }}
-          notifyPRCancel: true
diff --git a/.github/workflows/indent.yml b/.github/workflows/indent.yml
index be63f4b8ec..eae7be5a0f 100644
--- a/.github/workflows/indent.yml
+++ b/.github/workflows/indent.yml
@@ -2,6 +2,10 @@ name: indent
 
 on: [push, pull_request]
 
+concurrency:
+  group: ${ {github.event_name }}-${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: ${{github.event_name == 'pull_request'}}
+
 jobs:
   indent:
     # run the indent checks
diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
index 8ae6a80ef9..dc2282f2c1 100644
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -2,6 +2,10 @@ name: github-linux
 
 on: [push, pull_request]
 
+concurrency:
+  group: ${ {github.event_name }}-${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: ${{github.event_name == 'pull_request'}}
+
 jobs:
   linux-release-serial:
     # simple serial release build using g++
diff --git a/.github/workflows/osx.yml b/.github/workflows/osx.yml
index 9201b02928..fce0866b32 100644
--- a/.github/workflows/osx.yml
+++ b/.github/workflows/osx.yml
@@ -2,6 +2,10 @@ name: github-OSX
 
 on: [push, pull_request]
 
+concurrency:
+  group: ${ {github.event_name }}-${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: ${{github.event_name == 'pull_request'}}
+
 jobs:
   osx-serial:
     # simple serial build using apple clang
diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml
index d4171b78d2..7af8f712aa 100644
--- a/.github/workflows/windows.yml
+++ b/.github/workflows/windows.yml
@@ -2,6 +2,10 @@ name: github-windows
 
 on: [push, pull_request]
 
+concurrency:
+  group: ${ {github.event_name }}-${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: ${{github.event_name == 'pull_request'}}
+
 jobs:
   windows-serial:
     # Serial build on Windows
-- 
2.39.5