CI/CD & GitHub Actions (50 Qs)•Part 2: Advanced Workflows, Security & Containerization (Mid-Level)
What is Concurrency Control and why is `cancel-in-progress` crucial?
senior LevelCode ExampleSecurity & AuthDocker & Containers
In Simple Words:
When a developer pushes 5 rapid commits to a pull request, running 5 full CI pipelines wastes compute minutes and runner slots.
concurrency groups workflows by branch or PR ID. Setting cancel-in-progress: true automatically aborts obsolete running pipelines the moment a newer commit arrives!
yaml
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true