Member-only story
Github Workflows: working with concurrency
When running SonarQube in GitHub Actions, you often want to avoid multiple scans running at the same time.
Imagine you have a Sonarqube set up in your repo and you want to configure your workflows so that only one Sonarqube scan is allowed at the same time. GitHub Actions concurrency lets you do this in different ways depending on whether you want to:
- Replace older runs with newer ones, or
- Queue runs and process them one at a time
The concurrency keyword
concurrency in GitHub Actions controls how many executions are allowed at the same time for a given concurrency group.
You can define it at two scopes:
Workflow (pipeline) level
When concurrency is defined at the top of the workflow file, it applies to the entire workflow run.
name: CI
on:
push:
concurrency:
group: ci-${{ github.repository }}-${{ github.ref }}
cancel-in-progress: false
queue: max
jobs:
build:
runs-on: ubuntu-latest
steps:
- run: echo "Build"
sonarqube:
runs-on: ubuntu-latest
steps:
- run: echo "Scan"Effect: only one full workflow run in that group proceeds at a time.









