File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Send Team Members to Webhook
2+
3+ on :
4+ pull_request :
5+ types : [labeled]
6+
7+ jobs :
8+ send_team_members :
9+ runs-on : ubuntu-latest
10+
11+ steps :
12+ - name : Checkout repository
13+ uses : actions/checkout@v3
14+
15+ - name : Fetch team members and send to webhook
16+ run : |
17+ # Configuration
18+ TEAM_SLUG="possession-claim-backend" # Replace with your team slug
19+ ORG_NAME="hmcts" # Replace with your organization name
20+ WEBHOOK_URL="${{ secrets.WEBHOOK_URL }}"
21+
22+ # Fetch team members from GitHub API
23+ MEMBERS=$(curl -sH "Authorization: token ${{ secrets.ORG_ACCESS_TOKEN }}" \
24+ "https://api.github.com/orgs/$ORG_NAME/teams/$TEAM_SLUG/members")
25+
26+ # Extract just the usernames
27+ USERNAMES=$(echo "$MEMBERS" | jq -r '.[].login' | paste -sd "," -)
28+
29+ # Format for webhook (adjust based on your needs)
30+ PAYLOAD=$(jq -n --arg users "$USERNAMES" '{"text": $users}')
31+
32+ # Send to webhook
33+ curl -X POST "$WEBHOOK_URL" \
34+ -H "Content-Type: application/json" \
35+ -d "$PAYLOAD"
36+
37+ echo "Sent team members to webhook successfully!"
You can’t perform that action at this time.
0 commit comments