From 1087222a7b586141fa8b05182ccab3b4bd63819e Mon Sep 17 00:00:00 2001 From: Mike VanDenburgh Date: Mon, 11 Sep 2023 11:52:32 -0400 Subject: [PATCH] Fix possible race condition in deployment actions --- .github/workflows/backend-production-deploy.yml | 7 +++++++ .github/workflows/backend-staging-deploy.yml | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/.github/workflows/backend-production-deploy.yml b/.github/workflows/backend-production-deploy.yml index fea539ff0..e54d99fd4 100644 --- a/.github/workflows/backend-production-deploy.yml +++ b/.github/workflows/backend-production-deploy.yml @@ -4,6 +4,13 @@ on: release: types: [released] +concurrency: + # If this workflow is already running, cancel it to avoid a scenario + # where the older run finishes *after* the newer run and overwrites + # the deployment with an older version of the app. + group: ${{ github.workflow }} + cancel-in-progress: true + jobs: reset-release-branch: name: Update release branch diff --git a/.github/workflows/backend-staging-deploy.yml b/.github/workflows/backend-staging-deploy.yml index a17d651d7..7efe35d8d 100644 --- a/.github/workflows/backend-staging-deploy.yml +++ b/.github/workflows/backend-staging-deploy.yml @@ -7,6 +7,13 @@ on: paths-ignore: - "web/**" +concurrency: + # If this workflow is already running, cancel it to avoid a scenario + # where the older run finishes *after* the newer run and overwrites + # the deployment with an older version of the app. + group: ${{ github.workflow }} + cancel-in-progress: true + jobs: deploy: name: Deploy to Heroku