login page #23
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: Auto Assign Reviewer and Add Labels | |
on: | |
pull_request: | |
types: [opened] | |
jobs: | |
assign-reviewer-and-labels: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Assign Reviewer | |
run: | | |
# Define the reviewer(s) | |
REVIEWER="${{ secrets.REVIEWER_USERNAME }}" | |
# Get the pull request number | |
PR_NUMBER=$(jq --raw-output .number "$GITHUB_EVENT_PATH") | |
# Assign reviewer to the pull request | |
curl -X POST \ | |
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-d "{\"reviewers\":[\"$REVIEWER\"]}" \ | |
"https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER/requested_reviewers" | |
- name: Add Labels | |
run: | | |
# Define the labels to add | |
LABELS='["enhancement", "GSSoc"]' # Adding GSSoc label | |
# Get the pull request number | |
PR_NUMBER=$(jq --raw-output .number "$GITHUB_EVENT_PATH") | |
# Add labels to the pull request | |
for label in $LABELS; do | |
curl -X POST \ | |
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-d "{\"labels\":[\"$label\"]}" \ | |
"https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/labels" | |
done |