Documentation change for #658: Documentation change for #657: Documentation change for #656: Documentation change for #655: Documentation change for #654: Documentation change for #653: Documentation change for #652: Documentation change for #651: Documentation change for #650: Documentation change for #649: Documentation change for #648: Documentation change for #647: Documentation change for #646: Documentation change for #645: Documentation change for #644: Documentation change for #643: Documentation change for #: #108
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: Outside Collaborator | |
on: | |
pull_request_target: | |
types: | |
- opened | |
- reopened | |
concurrency: | |
group: '${{ github.workflow }}-${{ github.event_name }} @ ${{ github.event.pull_request.number || github.sha }}' | |
cancel-in-progress: true | |
jobs: | |
assign-reviewer: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Check if PR author is outside collaborator | |
env: | |
PR_AUTHOR_LOGIN: ${{ github.event.pull_request.user.login }} | |
REPO_NAME: ${{ github.event.repository.full_name }} | |
PR_NUMBER: ${{ github.event.number }} | |
run: | | |
PERMISSION_LEVEL=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
"https://api.github.com/repos/$REPO_NAME/collaborators/$PR_AUTHOR_LOGIN/permission" | jq -r .role_name) | |
if [ "$PERMISSION_LEVEL" == "none" ] || [ "$PERMISSION_LEVEL" == "read" ]; then | |
echo "PR author is an outside collaborator. Adding label..." | |
curl -s -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-d '["outside collaborator"]' \ | |
"https://api.github.com/repos/$REPO_NAME/issues/$PR_NUMBER/labels" | |
fi |