Skip to content

Commit c1ddd8f

Browse files
chore: add Chloé notification workflows (#48)
Co-authored-by: chloe-sdkman[bot] <263185818+chloe-sdkman[bot]@users.noreply.github.com>
1 parent 2c15885 commit c1ddd8f

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

.github/workflows/chloe-triage.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Notify Chloé (Issue Triage)
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
issue_comment:
7+
types: [created]
8+
9+
jobs:
10+
notify:
11+
runs-on: ubuntu-latest
12+
if: github.event.sender.type != 'Bot'
13+
steps:
14+
- name: Send to OpenClaw
15+
env:
16+
EVENT_NAME: ${{ github.event_name }}
17+
REPO: ${{ github.repository }}
18+
SENDER: ${{ github.event.sender.login }}
19+
ISSUE_NUMBER: ${{ github.event.issue.number }}
20+
ISSUE_TITLE: ${{ github.event.issue.title }}
21+
ISSUE_URL: ${{ github.event.issue.html_url }}
22+
ISSUE_BODY: ${{ github.event.issue.body }}
23+
COMMENT_BODY: ${{ github.event.comment.body }}
24+
COMMENT_URL: ${{ github.event.comment.html_url }}
25+
HOOK_URL: ${{ secrets.OPENCLAW_HOOK_URL }}
26+
HOOK_TOKEN: ${{ secrets.OPENCLAW_HOOK_TOKEN }}
27+
run: |
28+
if [ "$EVENT_NAME" = "issues" ]; then
29+
MSG="New issue in ${REPO} — #${ISSUE_NUMBER}: ${ISSUE_TITLE}"
30+
MSG+=$'\nAuthor: '"${SENDER}"
31+
MSG+=$'\nURL: '"${ISSUE_URL}"
32+
MSG+=$'\n\n'"${ISSUE_BODY}"
33+
else
34+
MSG="New comment on ${REPO} — #${ISSUE_NUMBER}: ${ISSUE_TITLE}"
35+
MSG+=$'\nFrom: '"${SENDER}"
36+
MSG+=$'\nURL: '"${COMMENT_URL}"
37+
MSG+=$'\n\n'"${COMMENT_BODY}"
38+
fi
39+
PAYLOAD=$(jq -n \
40+
--arg message "$MSG" \
41+
--arg name "GitHub Triage" \
42+
'{message: $message, name: $name, deliver: true, channel: "discord", to: "1474759623209783327"}')
43+
curl -sf -X POST \
44+
-H "Authorization: Bearer ${HOOK_TOKEN}" \
45+
-H "Content-Type: application/json" \
46+
-d "$PAYLOAD" \
47+
"$HOOK_URL"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Notify on Failure
2+
3+
on:
4+
workflow_run:
5+
workflows: ["*"]
6+
branches: [master, main]
7+
types: [completed]
8+
9+
jobs:
10+
notify:
11+
name: "Notify Chloé"
12+
runs-on: ubuntu-latest
13+
if: github.event.workflow_run.conclusion == 'failure'
14+
steps:
15+
- name: Notify Chloé
16+
env:
17+
REPO: ${{ github.repository }}
18+
WORKFLOW: ${{ github.event.workflow_run.name }}
19+
RUN_URL: ${{ github.event.workflow_run.html_url }}
20+
HOOK_URL: ${{ secrets.OPENCLAW_HOOK_URL }}
21+
HOOK_TOKEN: ${{ secrets.OPENCLAW_HOOK_TOKEN }}
22+
run: |
23+
TEXT="❌ ${WORKFLOW} failed: ${REPO}"
24+
TEXT+=$'\nRun: '"${RUN_URL}"
25+
PAYLOAD=$(jq -n --arg text "$TEXT" '{text: $text, mode: "now"}')
26+
WAKE_URL="${HOOK_URL%/agent}/wake"
27+
curl -sf -X POST \
28+
-H "Authorization: Bearer ${HOOK_TOKEN}" \
29+
-H "Content-Type: application/json" \
30+
-d "$PAYLOAD" \
31+
"$WAKE_URL"

0 commit comments

Comments
 (0)