chore: remove codeowners #1
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 Reviwer" | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
branches: | ||
- develop | ||
jobs: | ||
pick-random-reviwer: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: pick_random_reviwer | ||
id: pick_random_reviwer | ||
uses: actions/github-script@v3 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const fs = require('fs'); | ||
const developers = JSON.parse(fs.readFileSync(`${{ github.workspace }}/reviewers.json`)); | ||
// 겹치지 않는 두명의 랜덤 리뷰어 선택 | ||
if(developers?.length == 0) { | ||
core.setOutput('comment', '리뷰어가 없습니다. 리뷰어를 추가해주세요.') | ||
} | ||
if(developers?.length == 1) { | ||
const randomReviewer = developers[0]; | ||
const comment = `🎉 @${randomReviewer} 님 랜덤 리뷰어로 선정되셨습니다! 리뷰를 부탁드립니다. 🙏` | ||
core.setOutput('comment', comment) | ||
core.setOutput('reviewer', randomReviewer) | ||
} | ||
if(developers?.length > 1) { | ||
const randomReviewer = developers[Math.floor(Math.random() * developers.length)]; | ||
let randomReviewer2; | ||
while(true) { | ||
randomReviewer2 = developers[Math.floor(Math.random() * developers.length)]; | ||
if(randomReviewer != randomReviewer2) { | ||
break; | ||
} | ||
} | ||
const comment = `🎉 @${randomReviewer}, @${randomReviewer2} 님 랜덤 리뷰어로 선정되셨습니다! 리뷰를 부탁드립니다. 🙏` | ||
core.setOutput('comment', comment) | ||
core.setOutput('reviewer', randomReviewer) | ||
core.setOutput('reviewer2', randomReviewer2) | ||
} | ||
- name: comment PR | ||
uses: mshick/add-pr-comment@v1 | ||
with: | ||
message: | | ||
Check failure on line 54 in .github/workflows/PICK_REVIEWER.yml GitHub Actions / Pick ReviwerInvalid workflow file
Check failure on line 54 in .github/workflows/PICK_REVIEWER.yml GitHub Actions / Pick ReviwerInvalid workflow file
|
||
${{ steps.pick_random_reviwer.outputs.comment }} // output 을 가져옵니다 ${{ steps.[step-id].outputs.[output-id] }} | ||
repo-token: ${{ secrets.GITHUB_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 }}, ${{ steps.pick_random_reviwer.outputs.reviewer2 }} | ||
token: ${{ secrets.GITHUB_TOKEN }} |