Add policheck enablement #855
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |