Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Add better concurrency settings for workflows (#1668)
sarayourfrienda5254d407b90
diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.ymlindex 9bb0d9c9c..c83912312 100644--- a/.github/workflows/actionlint.yml+++ b/.github/workflows/actionlint.yml@@ -6,6 +6,13 @@ on:branches:- main+# Cancels all previous workflow runs for pull requests that have not completed.+concurrency:+ # The concurrency group contains the workflow name and the branch name for pull requests+ # or the commit hash for any other events.+ group: ${{ github.workflow }}-${{ github.head_ref }}+ cancel-in-progress: true+jobs:actionlint:runs-on: ubuntu-latestdiff --git a/.github/workflows/bundle_size.yml b/.github/workflows/bundle_size.ymlindex 505906642..3e114b22d 100644--- a/.github/workflows/bundle_size.yml+++ b/.github/workflows/bundle_size.yml@@ -26,7 +26,7 @@ on:concurrency:# The concurrency group contains the workflow name and the branch name for pull requests# or the commit hash for any other events.- group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}+ group: ${{ github.workflow }}-${{ github.head_ref }}cancel-in-progress: truejobs:diff --git a/.github/workflows/generate_pot.yml b/.github/workflows/generate_pot.ymlindex 9ff6d80cd..2df72ce60 100644--- a/.github/workflows/generate_pot.yml+++ b/.github/workflows/generate_pot.yml@@ -5,6 +5,10 @@ on:branches:- main+concurrency:+ group: ${{ github.workflow }}+ cancel-in-progress: true+jobs:deploy:runs-on: ubuntu-latestdiff --git a/.github/workflows/gh-pages.yaml b/.github/workflows/gh-pages.yamlindex 379c1be5b..9d6f41f2d 100644--- a/.github/workflows/gh-pages.yaml+++ b/.github/workflows/gh-pages.yaml@@ -5,6 +5,10 @@ on:branches:- main+concurrency:+ group: ${{ github.workflow }}+ cancel-in-progress: true+jobs:deploy:runs-on: ubuntu-latestdiff --git a/.github/workflows/ghcr.yml b/.github/workflows/ghcr.ymlindex 017fa0b90..959536ec1 100644--- a/.github/workflows/ghcr.yml+++ b/.github/workflows/ghcr.yml@@ -10,12 +10,13 @@ on:release:types: [published]-# Cancels all previous workflow runs for pull requests that have not completed.+# Prevents multiple deployments/builds from running at the same timeconcurrency:- # The concurrency group contains the workflow name and the branch name for pull requests- # or the commit hash for any other events.- group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}- cancel-in-progress: true+ group: ${{ github.event_name == 'release' && 'production' || github.event_name == 'push' && 'staging' || github.event.pull_request.number }}_release+ # 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 happen in series rather than parallel.+ cancel-in-progress: ${{ github.event_name == 'push' }}jobs:push-to-ghcr:diff --git a/.github/workflows/label_new_pr.yml b/.github/workflows/label_new_pr.ymlindex ecf799a66..ead2506ff 100644--- a/.github/workflows/label_new_pr.yml+++ b/.github/workflows/label_new_pr.yml@@ -8,6 +8,10 @@ on:# events that will trigger the checks defined in `pr_label_check.yml`.- opened+# Prevent API rate limiting by only allowing a single PR+# to dispatch workflows at a time+concurrency: ${{ github.workflow }}+jobs:set_label:name: Set labelsdiff --git a/.github/workflows/rollback.yml b/.github/workflows/rollback.ymlindex e69c1c7e5..d2aa01684 100644--- a/.github/workflows/rollback.yml+++ b/.github/workflows/rollback.yml@@ -10,6 +10,11 @@ on:required: truedescription: The GHCR image tag to which the environment should be rolled back+# Only allow a single rollback to happen at a time+# If you need to stop an in-progress rollback to force+# another for the same environment, you'll need to manually cancel it+concurrency: ${{ github.workflow }}-${{ inputs.environment }}+jobs:rollback:name: Perform Rollback