[RELEASE] v0.0.3.1 #120
Workflow file for this run
This file contains hidden or 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: 👽 Auto Assign | |
| on: | |
| pull_request: | |
| types: [opened] | |
| permissions: | |
| pull-requests: write | |
| issues: write | |
| jobs: | |
| assign: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const others = ['ehye1', 'jjangminii', 'yumin-kim2']; | |
| const author = context.payload.pull_request.user.login; | |
| const prNumber = context.payload.pull_request.number; | |
| function pickRandom(arr, count) { | |
| const shuffled = [...arr].sort(() => Math.random() - 0.5); | |
| return shuffled.slice(0, count); | |
| } | |
| let reviewers; | |
| if (author === 'kimminna') { | |
| // kimminna가 PR 작성 시: 나머지 3명 중 2명 랜덤 | |
| reviewers = pickRandom(others, 2); | |
| } else { | |
| // 나머지가 PR 작성 시: kimminna 고정 + 나머지 3명 중 작성자 제외 1명 랜덤 | |
| const eligible = others.filter(c => c !== author); | |
| const random = pickRandom(eligible, 1); | |
| reviewers = ['kimminna', ...random]; | |
| } | |
| await github.rest.pulls.requestReviewers({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: prNumber, | |
| reviewers, | |
| }); | |
| await github.rest.issues.addAssignees({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: prNumber, | |
| assignees: [author], | |
| }); |