Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/code_test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ on:
# This will only run on main by default.
- cron: "0 0 1,15 * *"

# 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
Member

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!

Copy link
Member Author

Choose a reason for hiding this comment

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

cool thanks @sfmig! that's very illuminating, I never quite understood what the refs/ syntax was


jobs:
linting:
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/docs_build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ on:
pull_request:
workflow_dispatch:

# 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' }}

jobs:
build_sphinx_docs:
name: Build Sphinx Docs
Expand Down
Loading