0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Github で PR(プルリクエスト) 作成した時に Assignees を自動で Assign yourself する

Last updated at Posted at 2023-11-05

本記事でできること

PR(プルリクエスト)を作成した際に、PRを作成したユーザーを自動的に Assignees に追加する。

コード

.github/workflows/auto-assign-pr-creator.yaml を作成する

name: PR automation

on:
  pull_request:
    types: opened

permissions:
  pull-requests: write
  repository-projects: read

jobs:
  assign:
    name: PR automation

    # 実行が10分を超えるとタイムアウトするように設定する
    timeout-minutes: 10

    # ジョブが実行される環境は、環境に合わせて設定する
    runs-on: ubuntu-22.04

    # コミットが重なった時同時に実行されないように、進行中のジョブをキャンセルするように設定する。
    concurrency:
      group: ${{ github.workflow }}-${{ github.ref }}
      cancel-in-progress: true

    # PR作成者をアサインに追加する。
    steps:
      - name: Set GitHub assignees
        env:
          GH_TOKEN: ${{ github.token }}
        run: gh pr edit ${{ github.event.number }} --add-assignee ${{ github.actor }} --repo ${{ github.repository }}

感想

毎回 Assignees を設定するの地味にめんどくさかった。。
無事自動化できてストレス減りました:smile:

ps. 初めて GitHubActions 使用してみたが、便利すぎる!!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?