SDL: Cancel current CI actions when a PR is updated

From f9ad84fd5de9eb84d41bc25c3971e5838f1948ae Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 4 Dec 2022 09:06:06 -0800
Subject: [PATCH] Cancel current CI actions when a PR is updated

This should help get build feedback more quickly when someone is iterating on a PR
---
 .github/workflows/android.yml    | 4 ++++
 .github/workflows/emscripten.yml | 4 ++++
 .github/workflows/ios.yml        | 6 +++++-
 .github/workflows/main.yml       | 4 ++++
 .github/workflows/msvc.yml       | 4 ++++
 .github/workflows/n3ds.yml       | 4 ++++
 .github/workflows/ps2.yaml       | 4 ++++
 .github/workflows/psp.yaml       | 4 ++++
 .github/workflows/riscos.yml     | 4 ++++
 .github/workflows/vita.yaml      | 4 ++++
 .github/workflows/vmactions.yml  | 4 ++++
 11 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml
index 9b3875e4766c..a67d739f685d 100644
--- a/.github/workflows/android.yml
+++ b/.github/workflows/android.yml
@@ -2,6 +2,10 @@ name: Build (Android)
 
 on: [push, pull_request]
 
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+  cancel-in-progress: true
+
 jobs:
   android:
     name: ${{ matrix.platform.name }}
diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml
index 0a5cd7bc1797..834c56540ef7 100644
--- a/.github/workflows/emscripten.yml
+++ b/.github/workflows/emscripten.yml
@@ -2,6 +2,10 @@ name: Build (Emscripten)
 
 on: [push, pull_request]
 
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+  cancel-in-progress: true
+
 jobs:
   emscripten:
     runs-on: ubuntu-latest
diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml
index 6034ce071b75..ba6368225322 100644
--- a/.github/workflows/ios.yml
+++ b/.github/workflows/ios.yml
@@ -2,6 +2,10 @@ name: Build (iOS/tvOS)
 
 on: [push, pull_request]
 
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+  cancel-in-progress: true
+
 jobs:
   Build:
     name: ${{ matrix.platform.name }}
@@ -17,4 +21,4 @@ jobs:
     steps:
       - uses: actions/checkout@v3
       - name: Build
-        run: xcodebuild -project Xcode/SDL/SDL.xcodeproj -target '${{ matrix.platform.target }}' -configuration Release -sdk ${{ matrix.platform.sdk }} clean build
\ No newline at end of file
+        run: xcodebuild -project Xcode/SDL/SDL.xcodeproj -target '${{ matrix.platform.target }}' -configuration Release -sdk ${{ matrix.platform.sdk }} clean build
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 50243a89f9ba..c237cdf9a387 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -2,6 +2,10 @@ name: Build
 
 on: [push, pull_request]
 
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+  cancel-in-progress: true
+
 jobs:
   Build:
     name: ${{ matrix.platform.name }}
diff --git a/.github/workflows/msvc.yml b/.github/workflows/msvc.yml
index 01d95485da10..c1ff7347c6eb 100644
--- a/.github/workflows/msvc.yml
+++ b/.github/workflows/msvc.yml
@@ -2,6 +2,10 @@ name: Build (MSVC)
 
 on: [push, pull_request]
 
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+  cancel-in-progress: true
+
 jobs:
   Build:
     name: ${{ matrix.platform.name }}
diff --git a/.github/workflows/n3ds.yml b/.github/workflows/n3ds.yml
index b7d7d9d11c24..1e1a8d6be1be 100644
--- a/.github/workflows/n3ds.yml
+++ b/.github/workflows/n3ds.yml
@@ -2,6 +2,10 @@ name: Build (Nintendo 3DS)
 
 on: [push, pull_request]
 
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+  cancel-in-progress: true
+
 jobs:
   n3ds:
     runs-on: ubuntu-latest
diff --git a/.github/workflows/ps2.yaml b/.github/workflows/ps2.yaml
index 92f29894f1d6..9cacd920ccb1 100644
--- a/.github/workflows/ps2.yaml
+++ b/.github/workflows/ps2.yaml
@@ -2,6 +2,10 @@ name: Build (Sony Playstation 2)
 
 on: [push, pull_request]
 
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+  cancel-in-progress: true
+
 jobs:
   ps2:
     runs-on: ubuntu-latest
diff --git a/.github/workflows/psp.yaml b/.github/workflows/psp.yaml
index 8c436e6b2193..3564ebdcaee0 100644
--- a/.github/workflows/psp.yaml
+++ b/.github/workflows/psp.yaml
@@ -2,6 +2,10 @@ name: Build (Sony Playstation Portable)
 
 on: [push, pull_request]
 
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+  cancel-in-progress: true
+
 jobs:
   psp:
     runs-on: ubuntu-latest
diff --git a/.github/workflows/riscos.yml b/.github/workflows/riscos.yml
index c336618eac35..3cb4bbf93c1e 100644
--- a/.github/workflows/riscos.yml
+++ b/.github/workflows/riscos.yml
@@ -2,6 +2,10 @@ name: Build (RISC OS)
 
 on: [push, pull_request]
 
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+  cancel-in-progress: true
+
 jobs:
   Build:
     name: ${{ matrix.platform.name }}
diff --git a/.github/workflows/vita.yaml b/.github/workflows/vita.yaml
index 4a8e6a7e9d9f..3a06515b4b3b 100644
--- a/.github/workflows/vita.yaml
+++ b/.github/workflows/vita.yaml
@@ -2,6 +2,10 @@ name: Build (Sony Playstation Vita)
 
 on: [push, pull_request]
 
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+  cancel-in-progress: true
+
 defaults:
   run:
     shell: sh
diff --git a/.github/workflows/vmactions.yml b/.github/workflows/vmactions.yml
index c5d2a6837a72..11eb29821985 100644
--- a/.github/workflows/vmactions.yml
+++ b/.github/workflows/vmactions.yml
@@ -2,6 +2,10 @@ name: Build (VM Actions)
 
 on: [push, pull_request]
 
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+  cancel-in-progress: true
+
 jobs:
   freebsd:
     runs-on: macos-12