Interview Prep/GitHub Actions/Jobs, Steps, Matrix & Concurrency

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
All GitHub Actions questions Roadmap: GitHub Actions

More on Jobs, Steps, Matrix & Concurrency