-
Notifications
You must be signed in to change notification settings - Fork 331
59 lines (53 loc) · 2.48 KB
/
maintainer_merge_review.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
53
54
55
56
57
58
59
name: Maintainer merge (review)
on:
pull_request_review:
# triggers on a review, whether or not it is accompanied by a comment
types: [submitted]
jobs:
ping_zulip:
name: Ping maintainers on Zulip
if: (startsWith(github.event.review.body, 'maintainer merge') || contains(toJSON(github.event.review.body), '\nmaintainer merge'))
runs-on: ubuntu-latest
steps:
- name: Check whether user is part of mathlib-reviewers team
uses: TheModdingInquisition/[email protected]
with:
organization: 'leanprover-community'
team: 'mathlib-reviewers' # required. The team to check for
token: ${{ secrets.MATHLIB_REVIEWERS_TEAM_KEY }} # required. Personal Access Token with the `read:org` permission
exit: true # optional. If the action should exit if the user is not part of the team. Defaults to true.
- uses: actions/checkout@v4
with:
ref: master
- name: Determine Zulip topic
id: determine_topic
run: |
./scripts/get_tlabel.sh "${PR}" >> "$GITHUB_OUTPUT"
env:
PR: /repos/leanprover-community/mathlib4/issues/${{ github.event.issue.number }}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Send message on Zulip
uses: zulip/github-actions-zulip/send-message@v1
with:
api-key: ${{ secrets.ZULIP_API_KEY }}
email: '[email protected]'
organization-url: 'https://leanprover.zulipchat.com'
to: 'mathlib reviewers'
type: 'stream'
topic: ${{ steps.determine_topic.outputs.topic }}
content: |
${{ format('{0} requested a maintainer merge from review on PR [#{1}]({2}):', github.event.review.user.login, github.event.pull_request.number, github.event.pull_request.html_url ) }}
> ${{ github.event.pull_request.title }}
- name: Add comment to PR
uses: GrantBirki/comment@v2
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
🚀 Pull request has been placed on the maintainer queue by ${{ github.event.review.user.login }}.
- name: Add label to PR
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const { owner, repo, number: issue_number } = context.issue;
await github.rest.issues.addLabels({ owner, repo, issue_number, labels: ['maintainer-merge'] });