Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 19, 2025

Added a concurrency block to the CI/CD workflow to automatically cancel previous in-progress workflow runs when new pushes are made to the same branch or PR. This reduces wasted CI resources when multiple pushes are made to the same PR branch.

Problem

Currently, when multiple commits are pushed rapidly to the same PR branch, each push triggers a new CI/CD workflow run while previous runs continue executing. This leads to:

  • Wasted CI resources and compute time
  • Multiple concurrent runs testing outdated code
  • Delayed feedback on the latest changes
  • Potential confusion about which CI results are relevant

Solution

Added a concurrency control block to .github/workflows/cicd.yaml:

# cancel any in-progress runs for the same branch/PR when a new run starts
concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
  cancel-in-progress: true

The concurrency group uses ${{ github.workflow }}-${{ github.head_ref || github.ref }} which means:

  • For PR events: groups by workflow name + head branch name (github.head_ref)
  • For push events: groups by workflow name + full ref (github.ref)
  • Each unique combination gets its own concurrency group

When cancel-in-progress: true is set, GitHub automatically cancels any running workflows in the same concurrency group when a new workflow starts.

Testing

This change can be verified by:

  1. Opening a PR that triggers the CI/CD workflow
  2. Pushing additional commits to the same PR branch before the first run completes
  3. Observing that previous workflow runs are automatically cancelled
  4. Confirming only the latest workflow run continues to completion

The behavior will be visible in the GitHub Actions UI where cancelled runs will show a "cancelled" status.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copy link
Contributor

@Copilot 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.

Copilot wasn't able to review any files in this pull request.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Copilot Copilot AI changed the title [WIP] chore(ci): cancel in-progress workflow runs on new pushes chore(ci): cancel in-progress workflow runs on new pushes Aug 19, 2025
@Copilot Copilot AI requested a review from sbolel August 19, 2025 03:08
Copilot finished work on behalf of sbolel August 19, 2025 03:08
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.

2 participants