Push three commits to a pull request in five minutes and GitHub Actions runs your CI three times, in full. Only the last result matters. The other two burn minutes and hold runners the current run is waiting for.
I recently scanned the workflows of 139 popular JS/TS repos (1k–20k stars). 97 of 129 repos with push/PR workflows (75%) had at least one workflow with no concurrency group at all. So this isn't a beginner problem; it's in well-maintained projects too.
The fix
Add this at the top level of the workflow, next to on: :
concurrency : group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress : ${{ github.event_name == 'pull_request' }}
Enter fullscreen mode
Exit fullscreen mode
Runs in the same group are serialized. When a new one starts, the one in progress is cancelled if cancel-in-progress is true.…