Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/review-sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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
}
Comment on lines +37 to +39
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section handles #5563 (and also includes pull requests from @dotnet-bot).

}' -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 before merging."}) {
clientMutationId
}
Comment on lines +49 to +51
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section handles #5564

}' -f review=$REVIEW_ID