Auto Assign Users #7
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") | |
for user in "${users[@]}"; do | |
echo "Assigning $user to issue #${{ github.event.issue.number }}..." | |
# Make the API request and capture the HTTP status code | |
http_response=$(curl -s -o response.json -w "%{http_code}" -X POST \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Content-Type: application/json" \ | |
-d "{\"assignees\": [\"$user\"]}" \ | |
"https://api.github.com/repos/${{ github.repository }}/issues/30") | |
# Check if the request was successful | |
if [ "$http_response" -eq 201 ]; then | |
echo "Successfully assigned $user." | |
else | |
echo "Error: Failed to assign $user. HTTP response code: $http_response" | |
cat response.json | |
fi | |
done |