-
Notifications
You must be signed in to change notification settings - Fork 464
52 lines (49 loc) · 2.03 KB
/
review-sdk.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: Review automatic pull requests
on:
pull_request_target:
types: [opened, ready_for_review]
permissions:
issues: write
pull-requests: write
jobs:
auto_review:
runs-on: ubuntu-latest
if: ${{ github.repository == 'dotnet/roslyn-analyzers' && (github.event.pull_request.user.login == 'dotnet-bot' || github.event.pull_request.user.login == 'dotnet-maestro[bot]') }}
steps:
- name: Create review
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULL_REQUEST_ID: ${{ github.event.pull_request.node_id }}
run: |
gh api graphql -f query='
mutation($pull: ID!) {
addPullRequestReview(input: {pullRequestId: $pull}) {
pullRequestReview {
id
}
}
}' -f pull=$PULL_REQUEST_ID > data.json
cat data.json
echo 'REVIEW_ID='$(jq -r '.data.addPullRequestReview.pullRequestReview.id' data.json) >> $GITHUB_ENV
- name: Submit approval
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ env.REVIEW_ID != '' && env.REVIEW_ID != 'null' && !contains(github.event.pull_request.body, 'Updates sdk.version') }}
run: |
gh api graphql -f query='
mutation($review: ID!) {
submitPullRequestReview(input: {pullRequestReviewId: $review, event: APPROVE, body: "Auto-approve"}) {
clientMutationId
}
}' -f review=$REVIEW_ID
- name: Submit change request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ env.REVIEW_ID != '' && env.REVIEW_ID != 'null' && contains(github.event.pull_request.body, 'Updates sdk.version') }}
run: |
gh api graphql -f query='
mutation($review: ID!) {
submitPullRequestReview(input: {pullRequestReviewId: $review, event: REQUEST_CHANGES, body: "This PR changes the .NET SDK version. Review required from @dotnet/roslyn-infrastructure-current-swat before merging."}) {
clientMutationId
}
}' -f review=$REVIEW_ID