githubでプルリクエストを作った人を自動でassigneesにする
4000 ワード
githubでプルリクエストを作った人を自動でassigneesにする
はじめに
こんにちは。webエンジニア社会人をしている ningenMe です。
タイトル通り、assignees設定を自動化します。
下記のことを行います。
- プルリクエストを作った人を自動で
assignees
にする - github actionsで処理を行う
- yamlではパースなどを自分で書かずに、GitHub Actions公式 のものを使う
GitHub
実際に動くソースはこちら
name: assignees-sample
on:
pull_request:
branches: [ main ]
jobs:
assignees:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/[email protected]
if: github.event_name == 'pull_request'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
assignees: `${{ github.actor }}`
});
UI上でどうなるか
PRの右側らへんを見るとassigneesが付いているのがわかります。
説明
説明と言うほど説明することはないです。
actions/github-script という便利なものがあるのでそれを活用します。
バージョンは 2021/09/14 時点での最新のものを記載しています。
実際に使う場合は https://github.com/actions/github-script/tags で最新を確認すると良いと思います。
先行研究
一応上記とはやり方が別になっていると思います。大した処理ではないのでなんでも良い気はします。
さいごに
超ライトな記事でした。
ではでは。
Author And Source
この問題について(githubでプルリクエストを作った人を自動でassigneesにする), 我々は、より多くの情報をここで見つけました https://qiita.com/ningenMe/items/416b3f9e593151360d58著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .