From ea5104f565a9ebbb0b9cc5e13ca69d760e22a522 Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Wed, 20 Dec 2023 12:02:08 -0800 Subject: [PATCH] Limit concurrent CI runs Concurrent runs often happen due to iterative pushes to a PR. In those cases, only the most recent commit is useful for CI to run. Given current concurrency limitations, I've been in situations where the most recent commit to a PR was waiting for CI runs on older commits to finish before it could even start, due to the FIFO nature of GitHub Actions workflow run scheduling. In those situations, I've manually canceled the older CI runs to allow the most recent CI to run. This change automates that process. Concurrent CI runs on the default branch are useful, so those are still allowed. --- .github/workflows/ci.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c0b82a2c8..d0ced341d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,6 +13,11 @@ on: workflow_dispatch: +# Prevent concurrent runs on the same branch, except for the default branch. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref_type == 'branch' && github.ref_name == github.event.repository.default_branch && github.run_id }} + cancel-in-progress: true + jobs: pytest-cram: name: test (python=${{ matrix.python-version }} biopython=${{ matrix.biopython-version || 'latest' }})