forked from todogroup/todogroup.org
-
Notifications
You must be signed in to change notification settings - Fork 9
29 lines (28 loc) · 1.1 KB
/
notify-reviewers.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
# 当有PR提交时,通知 review tema
name: Notify Reviewers
on:
pull_request:
types: [opened, reopened, synchronize]
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Notify Reviewers
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: pullRequest } = await github.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number
});
const reviewers = pullRequest.requested_reviewers.map(reviewer => reviewer.login);
const reviewersString = reviewers.join(', ');
const body = `@${reviewersString} Please review this PR: ${pullRequest.html_url}`;
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body
});