
PR作成時にブランチ名に応じたLabelを自動で付与する機能が便利、ぜひ付けておきましょう。

Contents 非表示
実装
ファイルレイアウトは以下の通り
.github/
- labeler.yml
workflows/
- labeler.yml
.github直下のlabeler.yml、workflowsディレクトリにも別のlabeler.ymlを追加
labeler.yml (.github直下)
enhancement:
- head-branch: ['^feature']
bug:
- head-branch: ['^fix']
refactor:
- head-branch: ['^refactor']
renovate:
- head-branch: ['^renovate']
feature/*
系のブランチならenhancement
ラベルを付与という感じにブランチ名に対応させたいラベルを記載する
labeler.yml (workflowsディレクトリ)
name: Labeler
on:
pull_request:
types: [opened, synchronize, reopened] # 必要に応じてトリガー条件は変えてください
jobs:
label:
runs-on: ubuntu-latest
steps:
- name: Label PRs
uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: .github/labeler.yml
sync-labels: false # 存在するLabelのみ許可するか
sync-labels
はそのリポジトリに既に存在するラベルのみを許可するかのBool値です、デフォルトがfalseなのでtrueにする必要がなければ明記は不要です。