GitHub Actionsの便利アクション

actions/labeler

ルールファイルに従って任意のラベルをつけてくれる。

name: "Pull Request Labeler"
on:
  pull_request:
    types:
      - opened
      - synchronize
      - reopened

jobs:
  labeler:
    permissions:
      contents: read
      pull-requests: write
    runs-on: ubuntu-latest
    steps:
      - uses: actions/labeler@v5

labelerのルールファイルはこんなかんじ。

github-actions:
- changed-files:
  - any-glob-to-any-file: ['.github/**/*']
python:
- changed-files:
  - any-glob-to-any-file: ['**/*.py']

label cheker for pull request

ラベルが設定されているか確認してくれるアクション。 普段仕事している組織はGitHubのリリースタグで情報を管理していて、その一部でラベルを使っておりPRに含めてほしいため採用。

github.com

---
name: Label Checker
on:
  pull_request:
    types:
      - opened
      - synchronize
      - reopened
      - labeled
      - unlabeled

jobs:

  check_labels:
    name: Check labels
    runs-on: ubuntu-latest
    steps:
      - uses: docker://agilepathway/pull-request-label-checker:latest
        with:
          one_of: major,minor,patch
          repo_token: ${{ secrets.GITHUB_TOKEN }}