-
Notifications
You must be signed in to change notification settings - Fork 126
51 lines (43 loc) ยท 1.43 KB
/
automation.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: ๐ค Automation
on:
pull_request_target:
types: [opened, reopened]
jobs:
assign-author:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: toshimaru/auto-author-assign@v2.1.0
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 }}
# ์ด์ PR ์ค์์ ํ์ฌ PR ์์ฑ์์ ๋ค๋ฅธ ์์ฑ์ ์ฐพ๊ธฐ
previous_pr_author=$(gh pr list --repo $current_repo \
--state all \
--search "created:<${{ github.event.pull_request.created_at }} sort:created-desc -author:${{ github.actor }}" \
--limit 3 \
--json number,author \
--jq "map(select(.number < $current_pr_num))[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