Skip to content

Conversation

@JoeZiminski
Copy link
Member

CI from past commits on a PR are not cancelled when a new commit is pushed.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds concurrency control to GitHub Actions workflows to automatically cancel in-progress workflow runs when new commits are pushed to pull requests, preventing resource waste from outdated CI runs.

Key Changes:

  • Added concurrency groups based on workflow name and git ref to both test and documentation workflows
  • Configured automatic cancellation for in-progress runs except on the main branch

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/docs_build_and_deploy.yml Added concurrency configuration to cancel duplicate documentation build runs on PRs
.github/workflows/code_test_and_deploy.yml Added concurrency configuration to cancel duplicate test and deployment runs on PRs

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# Cancel in-progress runs if a new run is triggered, except for main branch.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cancel-in-progress condition should also exclude tag pushes to prevent cancellation of release workflows. Tag pushes have refs like refs/tags/v* and trigger deployment jobs, which should not be cancelled.

Consider updating to: cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/') }}

Suggested change
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/') }}

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think this is required as we only make releases from main anyway.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @sfmig adding this too! Copilot suggested the above but I don't think it's necessary because we only make releases from main branch anyway?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Joe!

I think you are right! Just some points below.

we only make releases from main branch anyway?

Do you mean that in practice you don't add tags with Git, and just tag commits in main via the releases interface in GitHub?

Copilot suggested the above but I don't think it's necessary

Yeah I think the suggestion is not necessary, even if you didn't just tag commits in main using the GitHub releases interface. This is because the git ref is different for each tag. So different tags don't cancel each other.

Without the copilot suggestion, runs triggered by a push to a non-main branch will cancel any previous runs triggered in the same way. And force-pushes of a tag while the workflow is running will cancel any previous runs triggered by _the same tag _. I think this behaviour is what we want.

The above comes from the definition of the group parameter in concurrency. It defines workflows that can cancel each other. So for code_test_and_deploy.yml:

  • a push to branch-1 creates a group tests-refs/heads/branch-1
  • a pushed tag (e.g. v1.0.0) creates a group tests-refs/tags/v1.0.0 (note that the group name is specific to that tag).

Different groups do not interfere each other. So "tag v1.0.0 pushes" won't cancel "pushes to branch-1", and "tag v1.0.0 pushes" won't cancel "tag v2.0.0 pushes".

Hope this helps!

@JoeZiminski JoeZiminski requested a review from sfmig November 20, 2025 16:50
Copy link

@sfmig sfmig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants