Skip to content

Commit f0e9695

Browse files
Update send-team-memebrs.yml
1 parent a12c7ad commit f0e9695

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

.github/workflows/send-team-memebrs.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,30 @@ jobs:
1616
echo "Fetching GitHub-Slack user mappings..."
1717
MAPPINGS=$(curl -s https://raw.githubusercontent.com/hmcts/github-slack-user-mappings/master/slack.json)
1818
19-
echo "Mappings fetched:"
20-
echo "$MAPPINGS" | jq '.'
19+
echo "=== Full mappings JSON ==="
20+
echo "$MAPPINGS"
21+
echo "========================="
2122
2223
GITHUB_REVIEWERS=$(echo '${{ toJson(github.event.pull_request.requested_reviewers) }}' | jq -r '.[].login')
2324
25+
echo "GitHub reviewers to lookup: $GITHUB_REVIEWERS"
26+
2427
SLACK_IDS=""
2528
for github_user in $GITHUB_REVIEWERS; do
29+
echo "Looking up: $github_user"
30+
31+
echo "$MAPPINGS" | jq --arg user "$github_user" '.[] | select(.github == $user)'
32+
2633
slack_id=$(echo "$MAPPINGS" | jq -r --arg user "$github_user" '.[] | select(.github == $user) | .slack')
34+
35+
echo "Found slack_id: '$slack_id'"
36+
2737
if [ -n "$slack_id" ]; then
2838
SLACK_IDS="$SLACK_IDS<@$slack_id> "
29-
echo "Mapped $github_user -> $slack_id"
39+
echo "Mapped $github_user -> $slack_id"
3040
else
3141
SLACK_IDS="$SLACK_IDS@$github_user "
32-
echo "No mapping found for $github_user, using GitHub username"
42+
echo "No mapping found for $github_user"
3343
fi
3444
done
3545
@@ -39,10 +49,7 @@ jobs:
3949
PR_URL="${{ github.event.pull_request.html_url }}"
4050
PR_AUTHOR="${{ github.event.pull_request.user.login }}"
4151
42-
MESSAGE="New PR review requested: '$PR_TITLE' by @$PR_AUTHOR\nReviewers: $SLACK_IDS${TEAM_REVIEWERS:+Team: $TEAM_REVIEWERS}\n$PR_URL"
43-
44-
echo "Final message:"
45-
echo "$MESSAGE"
52+
MESSAGE="New PR review requested: '$PR_TITLE' by @$PR_AUTHOR - Reviewers: $SLACK_IDS${TEAM_REVIEWERS:+Team: $TEAM_REVIEWERS} - $PR_URL"
4653
4754
PAYLOAD=$(jq -n --arg text "$MESSAGE" '{"text": $text}')
4855

0 commit comments

Comments
 (0)