Skip to content
This repository has been archived by the owner on Jan 3, 2025. It is now read-only.

Auto Assign Users

Auto Assign Users #3

Workflow file for this run

name: Auto Assign Team to Issues
on:
issues:
types: [opened]
workflow_dispatch:
jobs:
auto-assign-team:
runs-on: ubuntu-latest
steps:
- name: Install jq
run: sudo apt-get install -y jq
- name: Get team members using GitHub API
id: team-members
run: |
response=$(curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/KittyCAD/teams/support/members)
echo "API Response:"
echo "$response" | jq '.' # Debug to see the structure
# Extract the member logins
echo "$response" | jq -r '.[].login' > team_members.txt
- name: Assign team members to the issue
run: |
while IFS= read -r member; do
curl -s -X POST \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/json" \
-d "{\"assignees\": [\"$member\"]}" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}"
done < team_members.txt