Write the standard concurrency setting for PR CI and for production deploys.
BeginnerConceptJobs, Steps, Matrix & Concurrency
Answer
# PR CI: newer commits make older runs pointless
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
# Deploy job: never cancel a deploy halfway, serialize per environment
jobs:
deploy:
environment: prod
concurrency:
group: deploy-prod
cancel-in-progress: false
More on Jobs, Steps, Matrix & Concurrency
How does `needs` work, and what happens to a job whose dependency failed or was skipped?BeginnerWhat is the implicit `success()` in a job `if`, and why is `always()` usually the wrong fix?IntermediateWhat values can `needs.<job>.result` take?BeginnerHow does a matrix expand, and how are job names generated?BeginnerHow do `include` and `exclude` work in a matrix?IntermediateWhat do `fail-fast` and `max-parallel` do?Beginner