Auto Assign Users #9
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: Auto Assign Users | |
on: | |
issues: | |
types: [opened] | |
workflow_dispatch: | |
jobs: | |
auto-assign-team: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Assign specified users to the issue | |
run: | | |
users=("jgomez720" "PapalapticAfterblast") | |
ISSUE_NUMBER=30 # Get issue number from the input | |
# Assign users to the issue using the correct endpoint | |
response=$(curl -s -o /dev/null -w "%{http_code}" -X POST \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Content-Type: application/json" \ | |
-d "{\"assignees\": [$(for user in "${users[@]}"; do echo "\"$user\","; done | sed 's/,$//')]}" \ | |
"https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE_NUMBER/assignees") | |
if [ "$response" -eq 201 ]; then | |
echo "Successfully assigned users to issue #$ISSUE_NUMBER." | |
else | |
echo "Error: Failed to assign users. HTTP response code: $response" | |
fi | |
done |