fix: switch field content #503
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Pick Random Reviwer" | |
on: | |
pull_request: | |
types: | |
- opened | |
jobs: | |
pick-random-reviwer: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: pick_random_reviwer | |
id: pick_random_reviwer | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{secrets.TOKEN}} | |
script: | | |
const review_team = ['sinryuji', 'Paul2021-R', 'weejihye', 'wochae']; | |
const candidate = review_team.filter((e) => e != '${{ github.event.pull_request.user.login }}'); | |
const randomReviewer = candidate[Math.floor(Math.random() * candidate.length)]; | |
const comment = `๐ @${randomReviewer} ๋ ๋๋ค ๋ฆฌ๋ทฐ์ด๋ก ๋น์ฒจ๋์ จ์ต๋๋ค! ๋ฆฌ๋ทฐ๋ฅผ ๋ถํ๋๋ฆฝ๋๋ค. ๐` | |
core.setOutput('comment', comment) | |
core.setOutput('reviewer', randomReviewer) | |
- name: comment PR | |
uses: mshick/add-pr-comment@v1 | |
with: | |
message: | | |
${{ steps.pick_random_reviwer.outputs.comment }} | |
repo-token: ${{ secrets.TOKEN }} | |
repo-token-user-login: 'github-actions[bot]' | |
- name: Add Pull Request Reviewer | |
uses: madrapps/add-reviewers@v1 | |
with: | |
reviewers: ${{ steps.pick_random_reviwer.outputs.reviewer }} | |
token: ${{ secrets.TOKEN }} | |
# - name: pick_random_reviwer | |
# id: pick_random_reviwer | |
# uses: actions/github-script@v3 | |
# with: | |
# github-token: ${{secrets.TOKEN}} | |
# script: | | |
# const team1 = ['sinryuji', 'Paul2021-R', 'weejihye', 'perman0519', 'juhyeonlee134', 'wochae']; | |
# const team2 = ['perman0519', 'juhyeonlee134', 'wochae']; | |
# const candidate1 = team1.filter((e) => e != '${{ github.event.pull_request.user.login }}'); | |
# const candidate2 = team2.filter((e) => e != '${{ github.event.pull_request.user.login }}'); | |
# const randomReviewer1 = candidate1[Math.floor(Math.random() * candidate1.length)]; | |
# const randomReviewer2 = candidate2[Math.floor(Math.random() * candidate2.length)]; | |
# const comment1 = `๐ @${randomReviewer1} ๋ ๋๋ค ๋ฆฌ๋ทฐ์ด๋ก ๋น์ฒจ๋์ จ์ต๋๋ค! ๋ฆฌ๋ทฐ๋ฅผ ๋ถํ๋๋ฆฝ๋๋ค. ๐` | |
# const comment2 = `๐ @${randomReviewer2} ๋ ๋๋ค ๋ฆฌ๋ทฐ์ด๋ก ๋น์ฒจ๋์ จ์ต๋๋ค! ๋ฆฌ๋ทฐ๋ฅผ ๋ถํ๋๋ฆฝ๋๋ค. ๐` | |
# core.setOutput('comment1', comment1) | |
# core.setOutput('comment2', comment2) | |
# core.setOutput('reviewer1', randomReviewer1) | |
# core.setOutput('reviewer2', randomReviewer2) |