-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (48 loc) · 1.54 KB
/
pr_triage.yml
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
52
name: "Pull Request Triage"
on:
pull_request_target:
types: [ opened, ready_for_review ]
jobs:
triage:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
# Grab sources to get latest labeler.yml
- name: Fetch sources
uses: actions/checkout@v4
with:
# Ensure we pin the source origin as pull_request_target run under forks.
fetch-depth: 0
repository: fsegurai/ngx-markdown
ref: main
- name: Update labels based on changes
uses: actions/labeler@v5
with:
sync-labels: true
dot: true
- name: Assign PR creator
uses: actions/github-script@v6
with:
script: |
const pr = context.payload.pull_request;
const assignees = pr.assignees.map(assignee => assignee.login);
let assignee = pr.user.login;
if (!assignees.includes(assignee)) {
if (assignee.includes('bot')) {
await github.rest.pulls.requestReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number,
reviewers: ['fsegurai']
});
} else {
await github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
assignees: [assignee]
});
}
}