Repository: ember-cli/ember-cli
Pull request #9697 (2021-11-16 01:36:07)

feat: cancel stale actions workflows
This uses Github Action's [concurrency](docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#concurrency) feature to kill the workflow runs of commits that are not the current
head commit of a PR.  `head_ref` is only set for PRs [source](docs.github.com/en/actions/learn-github-actions/contexts#github-context), which is why we fall back to `ref` (so push workflows will run one job for each branch for the most recent commit).


Patch:
diff --git a/blueprints/addon/files/.github/workflows/ci.yml b/blueprints/addon/files/.github/workflows/ci.yml
index 6dbb1102a..36f10beda 100644
--- a/blueprints/addon/files/.github/workflows/ci.yml
+++ b/blueprints/addon/files/.github/workflows/ci.yml
@@ -7,6 +7,10 @@ on:
       - master
   pull_request: {}
 
+concurrency:
+   group: ci-${{ github.head_ref || github.ref }}
+   cancel-in-progress: true
+
 jobs:
   test:
     name: "Tests"
diff --git a/blueprints/app/files/.github/workflows/ci.yml b/blueprints/app/files/.github/workflows/ci.yml
index 1fb67a911..55cc0eb7e 100644
--- a/blueprints/app/files/.github/workflows/ci.yml
+++ b/blueprints/app/files/.github/workflows/ci.yml
@@ -7,6 +7,10 @@ on:
       - master
   pull_request: {}
 
+concurrency:
+   group: ci-${{ github.head_ref || github.ref }}
+   cancel-in-progress: true
+
 jobs:
   lint:
     name: "Lint"


Test patch:
diff --git a/tests/fixtures/addon/defaults/.github/workflows/ci.yml b/tests/fixtures/addon/defaults/.github/workflows/ci.yml
index 125979d8b..b4eaec80f 100644
--- a/tests/fixtures/addon/defaults/.github/workflows/ci.yml
+++ b/tests/fixtures/addon/defaults/.github/workflows/ci.yml
@@ -7,6 +7,10 @@ on:
       - master
   pull_request: {}
 
+concurrency:
+   group: ci-${{ github.head_ref || github.ref }}
+   cancel-in-progress: true
+
 jobs:
   test:
     name: "Tests"
diff --git a/tests/fixtures/addon/yarn/.github/workflows/ci.yml b/tests/fixtures/addon/yarn/.github/workflows/ci.yml
index 143d0bf87..a81d75d48 100644
--- a/tests/fixtures/addon/yarn/.github/workflows/ci.yml
+++ b/tests/fixtures/addon/yarn/.github/workflows/ci.yml
@@ -7,6 +7,10 @@ on:
       - master
   pull_request: {}
 
+concurrency:
+   group: ci-${{ github.head_ref || github.ref }}
+   cancel-in-progress: true
+
 jobs:
   test:
     name: "Tests"
diff --git a/tests/fixtures/app/defaults/.github/workflows/ci.yml b/tests/fixtures/app/defaults/.github/workflows/ci.yml
index 7526c1e04..06541de4f 100644
--- a/tests/fixtures/app/defaults/.github/workflows/ci.yml
+++ b/tests/fixtures/app/defaults/.github/workflows/ci.yml
@@ -7,6 +7,10 @@ on:
       - master
   pull_request: {}
 
+concurrency:
+   group: ci-${{ github.head_ref || github.ref }}
+   cancel-in-progress: true
+
 jobs:
   lint:
     name: "Lint"
diff --git a/tests/fixtures/app/npm/.github/workflows/ci.yml b/tests/fixtures/app/npm/.github/workflows/ci.yml
index 7526c1e04..06541de4f 100644
--- a/tests/fixtures/app/npm/.github/workflows/ci.yml
+++ b/tests/fixtures/app/npm/.github/workflows/ci.yml
@@ -7,6 +7,10 @@ on:
       - master
   pull_request: {}
 
+concurrency:
+   group: ci-${{ github.head_ref || github.ref }}
+   cancel-in-progress: true
+
 jobs:
   lint:
     name: "Lint"
diff --git a/tests/fixtures/app/yarn/.github/workflows/ci.yml b/tests/fixtures/app/yarn/.github/workflows/ci.yml
index e48ff8104..16b346207 100644
--- a/tests/fixtures/app/yarn/.github/workflows/ci.yml
+++ b/tests/fixtures/app/yarn/.github/workflows/ci.yml
@@ -7,6 +7,10 @@ on:
       - master
   pull_request: {}
 
+concurrency:
+   group: ci-${{ github.head_ref || github.ref }}
+   cancel-in-progress: true
+
 jobs:
   lint:
     name: "Lint"