Skip to repository content87 lines · 3.1 KB · yaml
tenant.openagents/omega
No repository description is available.
OpenAgents Git authority 2026-07-28T02:52:36.952Z Public web read
NIP-34 coordinate
30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omegaMaintainersHidden in public view
References2 branches · 1 tag
Read-only clone
git clone https://openagents.com/git/tenant.openagents/omega.gitBrowse files
slack_notify_label_created.yml
1name: New label created, notify slack
2
3on:
4 label:
5 types: [created]
6
7permissions:
8 contents: read
9
10jobs:
11 notify-slack:
12 if: >-
13 github.repository_owner == 'zed-industries'
14 && (startsWith(github.event.label.name, 'area:')
15 || startsWith(github.event.label.name, 'platform:'))
16 runs-on: namespace-profile-2x4-ubuntu-2404
17
18 steps:
19 - name: Build Slack message payload
20 env:
21 LABEL_NAME: ${{ github.event.label.name }}
22 LABEL_COLOR: ${{ github.event.label.color }}
23 LABEL_DESCRIPTION: ${{ github.event.label.description }}
24 CREATED_BY: ${{ github.event.sender.login }}
25 REPO_URL: ${{ github.event.repository.html_url }}
26 DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
27 run: |
28 LABELS_PAGE_URL="${REPO_URL}/labels"
29 MAPPING_FILE_URL="${REPO_URL}/blob/${DEFAULT_BRANCH}/script/community-pr-track-mapping.json"
30
31 jq -n \
32 --arg label_name "$LABEL_NAME" \
33 --arg label_color "#$LABEL_COLOR" \
34 --arg label_description "${LABEL_DESCRIPTION:-(none)}" \
35 --arg created_by "$CREATED_BY" \
36 --arg labels_url "$LABELS_PAGE_URL" \
37 --arg mapping_file_url "$MAPPING_FILE_URL" \
38 '{
39 "blocks": [
40 {
41 "type": "section",
42 "text": {
43 "type": "mrkdwn",
44 "text": "New label created: *\($label_name)*\nPlease choose a Track for it <\($mapping_file_url)|community-pr-track-mapping.json>."
45 }
46 },
47 {
48 "type": "section",
49 "fields": [
50 { "type": "mrkdwn", "text": "*Created by:*\n\($created_by)" },
51 { "type": "mrkdwn", "text": "*Color:*\n\($label_color)" },
52 { "type": "mrkdwn", "text": "*Description:*\n\($label_description)" },
53 { "type": "mrkdwn", "text": "*Labels page:*\n<\($labels_url)|View all labels>" }
54 ]
55 }
56 ]
57 }' > payload.json
58
59 echo "Payload built successfully:"
60 cat payload.json
61
62 - name: Send Slack notification
63 env:
64 SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_LABEL_CREATED }}
65 run: |
66 if [ -z "$SLACK_WEBHOOK_URL" ]; then
67 echo "::error::SLACK_WEBHOOK_LABEL_CREATED secret is not set"
68 exit 1
69 fi
70
71 HTTP_RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "$SLACK_WEBHOOK_URL" \
72 -H "Content-Type: application/json" \
73 -d @payload.json)
74
75 HTTP_BODY=$(echo "$HTTP_RESPONSE" | sed '$d')
76 HTTP_STATUS=$(echo "$HTTP_RESPONSE" | tail -n 1)
77
78 echo "Slack API response status: $HTTP_STATUS"
79 echo "Slack API response body: $HTTP_BODY"
80
81 if [ "$HTTP_STATUS" -ne 200 ]; then
82 echo "::error::Slack notification failed with status $HTTP_STATUS: $HTTP_BODY"
83 exit 1
84 fi
85
86 echo "Slack notification sent successfully"
87