Skip to content

Commit 73c9fde

Browse files
Create send-team-memebrs.yml
1 parent a0f0368 commit 73c9fde

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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!"

0 commit comments

Comments
 (0)