Skip to content

ci: add assign-reviewer job #380

ci: add assign-reviewer job

ci: add assign-reviewer job #380

Workflow file for this run

name: ๐Ÿค– Automation
on:
pull_request_target:
types: [opened, reopened]
jobs:
assign-author:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: toshimaru/[email protected]
label-lang:
runs-on: ubuntu-latest
continue-on-error: true
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/labeler@v5
with:
repo-token: ${{ github.token }}
assign-reviewer:
runs-on: ubuntu-latest
steps:
- name: Get previous PR author and assign as reviewer
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
current_repo=${{ github.repository }}
current_pr_num=${{ github.event.number }}
# ์ตœ๊ทผ 3๊ฐœ์˜ PR ์ค‘ ํ˜„์žฌ PR ์ž‘์„ฑ์ž์™€ ๋‹ค๋ฅธ ์ž‘์„ฑ์ž ์ฐพ๊ธฐ ()
previous_pr_author=$(gh pr list --repo $current_repo \
--search "number:<$current_pr_num -is:closed sort:created-desc -author:$current_pr_author" \
--limit 3 --json number,author \
--jq '.[0].author.login')
if [ -n "$previous_pr_author" ]; then
gh pr edit $current_pr_num --repo $current_repo --add-reviewer $previous_pr_author
else
echo "โŒ No previous PR author found to assign as reviewer"
exit 1
fi