Skip to content

chore: add PR notifications to triage workflow #22

chore: add PR notifications to triage workflow

chore: add PR notifications to triage workflow #22

Workflow file for this run

name: Notify Chloé (Issue Triage)
on:
issues:
types: [opened]
issue_comment:
types: [created]
pull_request:
types: [opened]
jobs:
notify:
runs-on: ubuntu-latest
if: github.event.sender.type != 'Bot'
steps:
- name: Send to OpenClaw
env:
EVENT_NAME: ${{ github.event_name }}
REPO: ${{ github.repository }}
SENDER: ${{ github.event.sender.login }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
ISSUE_TITLE: ${{ github.event.issue.title }}
ISSUE_URL: ${{ github.event.issue.html_url }}
ISSUE_BODY: ${{ github.event.issue.body }}
COMMENT_BODY: ${{ github.event.comment.body }}
COMMENT_URL: ${{ github.event.comment.html_url }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_URL: ${{ github.event.pull_request.html_url }}
PR_BODY: ${{ github.event.pull_request.body }}
HOOK_URL: ${{ secrets.OPENCLAW_HOOK_URL }}
HOOK_TOKEN: ${{ secrets.OPENCLAW_HOOK_TOKEN }}
run: |
if [ "$EVENT_NAME" = "issues" ]; then
MSG="New issue in ${REPO} — #${ISSUE_NUMBER}: ${ISSUE_TITLE}"
MSG+=$'\nAuthor: '"${SENDER}"
MSG+=$'\nURL: '"${ISSUE_URL}"
MSG+=$'\n\n'"${ISSUE_BODY}"
elif [ "$EVENT_NAME" = "pull_request" ]; then
MSG="New PR in ${REPO} — #${PR_NUMBER}: ${PR_TITLE}"
MSG+=$'\nAuthor: '"${SENDER}"
MSG+=$'\nURL: '"${PR_URL}"
MSG+=$'\n\n'"${PR_BODY}"
else
MSG="New comment on ${REPO} — #${ISSUE_NUMBER}: ${ISSUE_TITLE}"
MSG+=$'\nFrom: '"${SENDER}"
MSG+=$'\nURL: '"${COMMENT_URL}"
MSG+=$'\n\n'"${COMMENT_BODY}"
fi
PAYLOAD=$(jq -n \
--arg message "$MSG" \
--arg name "GitHub Triage" \
'{message: $message, name: $name, deliver: true, channel: "discord", to: "1474759623209783327"}')
curl -sf -X POST \
-H "Authorization: Bearer ${HOOK_TOKEN}" \
-H "Content-Type: application/json" \
-d "$PAYLOAD" \
"$HOOK_URL"