Skip to content

Commit

Permalink
Merge pull request #26 from rgomezr/exp-addingWorkflow-prAutoAssign
Browse files Browse the repository at this point in the history
Adding `pr_auto_assign.yml` as a workflow
  • Loading branch information
rgomezr authored Jul 21, 2023
2 parents 034b90f + 100c4ba commit 71d3eec
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/pr_auto_assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Auto-Assign Pull Request Creator
on:
pull_request:
types: [opened]

jobs:
assign_creator:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2

- name: Set assignee to creator
run: |
# Get the pull request number
PR_NUMBER=$(jq --raw-output .number "$GITHUB_EVENT_PATH")
# Get the creator's login (username)
CREATOR_LOGIN=$(jq --raw-output .pull_request.user.login "$GITHUB_EVENT_PATH")
# Set the assignee to the creator
echo "Setting assignee to $CREATOR_LOGIN for pull request #$PR_NUMBER"
GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}"
API_URL="https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER"
curl -X POST -H "Authorization: token $GITHUB_TOKEN" -H "Content-Type: application/json" -d "{\"assignees\":[\"$CREATOR_LOGIN\"]}" "$API_URL"

0 comments on commit 71d3eec

Please sign in to comment.