Skip to content

chore(ci): Add concurrency to workflows for efficiency #991

@denver79

Description

@denver79

Describe the issue

The Problem/Opportunity

Currently, when multiple commits are pushed to a Pull Request (PR), older workflows continue to run unnecessarily. This leads to inefficient use of CI/CD resources and longer wait times for developers to see test results.

The Suggestion

I propose adding the following concurrency block to most of the GitHub Actions workflows in the project:

concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref }}
  cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

Benefits
Cost and Time Savings: This feature automatically cancels old and now-irrelevant workflows when a new commit is pushed to a PR. This directly reduces CI/CD runner minutes and costs.

Increased Efficiency: Developers will always see the test results for only the latest code. This prevents confusion and speeds up the development process.

Better Developer Experience: Wait times for test results are shortened, and the "Actions" history becomes cleaner.

I believe this small change will be a significant improvement to the project's CI/CD processes.

### Context

_No response_

### Steps to Reproduce or Propose

1. Add the proposed `concurrency` block to the relevant GitHub Actions workflow files.
2. Push a commit to a Pull Request, which will trigger a workflow run.
3. Before the first workflow is complete, push a second commit to the same Pull Request.
4. **Expected Change:** The first workflow run should be automatically canceled by GitHub. Only the workflow for the second, most recent commit should continue to run to completion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions