GitHub Actions の concurrency 制御

head_ref にはブランチ名が入るので同じブランチ上で複数ジョブが走った場合に古いジョブをキャンセルすることができる。

concurrency: 
  group: ${{ github.head_ref }}
  cancel-in-progress: true

Workflow syntax for GitHub Actions - GitHub Docs

Private Repo の GitHub Actions で使用量を無駄に食いたくないときに設定しておくべきやつ。

調査してみた

pull_requestpull_request_target event でも下記の通り、ブランチ名が取得できることを確認した。