Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Add concurrency settings for workflow (#970)

Alireza Ziaee87847eb0da81
diff --git a/.github/workflows/build_imaginary.yml b/.github/workflows/build_imaginary.yml
index a819c1405..0ce93fd63 100644
--- a/.github/workflows/build_imaginary.yml
+++ b/.github/workflows/build_imaginary.yml
@@ -12,6 +12,8 @@ on:
default: true
description: Set to `false` to trigger _just_ a redeployment
+concurrency: ${{ github.workflow }}-${{ inputs.deploy-to }}
+
jobs:
build:
name: Build
diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml
index 35f2151b6..6a1607fe8 100644
--- a/.github/workflows/ci_cd.yml
+++ b/.github/workflows/ci_cd.yml
@@ -10,6 +10,13 @@ on:
- published
workflow_dispatch:
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event_name == 'release' && 'release' || github.ref }}
+ # Don't continue building images for a PR if the PR is updated quickly
+ # For other workflows, allow them to complete and just block on them. This
+ # ensures deployments in particular to happen in series rather than parallel.
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
+
jobs:
lint:
name: Lint
diff --git a/.github/workflows/migration_safety_warning.yml b/.github/workflows/migration_safety_warning.yml
index bca485ff2..0fa624cda 100644
--- a/.github/workflows/migration_safety_warning.yml
+++ b/.github/workflows/migration_safety_warning.yml
@@ -5,6 +5,11 @@ on:
paths:
- "**/migrations/**/*"
+concurrency:
+ # The concurrency group contains the workflow name and the branch name for pull requests.
+ group: ${{ github.workflow }}-${{ github.head_ref }}
+ cancel-in-progress: true
+
jobs:
check-and-apply-labels:
name: "Check and Apply Labels"
diff --git a/.github/workflows/push_docker_image.yml b/.github/workflows/push_docker_image.yml
index e7488031f..807632f30 100644
--- a/.github/workflows/push_docker_image.yml
+++ b/.github/workflows/push_docker_image.yml
@@ -9,6 +9,8 @@ on:
description: Commit that the image is built from
required: true
+concurrency: ${{ github.workflow }}-${{ inputs.image }}-${{ inputs.commit }}
+
jobs:
push:
name: Publish requested Docker image