This repository has been archived by the owner on Jan 3, 2025. It is now read-only.
Auto Assign Users #8
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 Specified Users to Issues | |
on: | |
issues: | |
types: [opened] | |
workflow_dispatch: | |
permissions: | |
issues: write # Ensure the action has write access to issues | |
jobs: | |
auto-assign-team: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Assign specified users to the issue | |
run: | | |
users=("jgomez720" "PapalapticAfterblast") # List your GitHub usernames here | |
for user in "${users[@]}"; do | |
echo "Assigning $user to issue #${{ github.event.issue.number }}..." | |
response=$(curl -s -o /dev/null -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") | |
if [ "$response" -eq 201 ]; then | |
echo "Successfully assigned $user to issue #30." | |
else | |
echo "Error: Failed to assign $user. HTTP response code: $response" | |
fi | |
done |