From a406fd964889a93a22d436b9b3127211217c15c0 Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Wed, 11 Jan 2023 00:40:17 +0300 Subject: [PATCH 1/2] Use concurrency for GitHub Actions workflow This PR ensures that only the last execution per branch always works, even when pushed multiple times in a row, for example. The older one is canceled. Refs: https://docs.github.com/en/actions/using-jobs/using-concurrency https://github.blog/changelog/2021-04-19-github-actions-limit-workflow-run-or-job-concurrency/ --- ci/.github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ci/.github/workflows/ci.yml b/ci/.github/workflows/ci.yml index 016db2d..9ffafab 100644 --- a/ci/.github/workflows/ci.yml +++ b/ci/.github/workflows/ci.yml @@ -10,6 +10,9 @@ on: - '*' permissions: contents: read +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true env: RSPEC_CI: true # This tells rspec-rails what branch to run in ci From cef70b111b4016a52d3e227df36e7d0120735074 Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Wed, 11 Jan 2023 18:56:08 +0300 Subject: [PATCH 2/2] Limit build auto-cancel to only PR builds --- ci/.github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/.github/workflows/ci.yml b/ci/.github/workflows/ci.yml index 9ffafab..09c7f4c 100644 --- a/ci/.github/workflows/ci.yml +++ b/ci/.github/workflows/ci.yml @@ -11,7 +11,7 @@ on: permissions: contents: read concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true env: RSPEC_CI: true