diff --git a/.github/workflows/chloe-triage.yml b/.github/workflows/chloe-triage.yml index 2902f56..1384831 100644 --- a/.github/workflows/chloe-triage.yml +++ b/.github/workflows/chloe-triage.yml @@ -10,50 +10,5 @@ on: 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: | - INSTRUCTION="Brief notification only. Provide: repo + number + title + author + one sentence summary + link. No assessment, no suggestions, no follow-up questions unless asked." - if [ "$EVENT_NAME" = "issues" ]; then - MSG="${INSTRUCTION}"$'\n\n'"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="${INSTRUCTION}"$'\n\n'"New PR in ${REPO} — #${PR_NUMBER}: ${PR_TITLE}" - MSG+=$'\nAuthor: '"${SENDER}" - MSG+=$'\nURL: '"${PR_URL}" - MSG+=$'\n\n'"${PR_BODY}" - else - MSG="${INSTRUCTION}"$'\n\n'"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" + uses: sdkman/.github/.github/workflows/reusable-triage.yml@main + secrets: inherit diff --git a/.github/workflows/notify-on-failure.yml b/.github/workflows/notify-on-failure.yml index f9366ae..6df60fc 100644 --- a/.github/workflows/notify-on-failure.yml +++ b/.github/workflows/notify-on-failure.yml @@ -8,24 +8,5 @@ on: jobs: notify: - name: "Notify Chloé" - runs-on: ubuntu-latest - if: github.event.workflow_run.conclusion == 'failure' - steps: - - name: Notify Chloé - env: - REPO: ${{ github.repository }} - WORKFLOW: ${{ github.event.workflow_run.name }} - RUN_URL: ${{ github.event.workflow_run.html_url }} - HOOK_URL: ${{ secrets.OPENCLAW_HOOK_URL }} - HOOK_TOKEN: ${{ secrets.OPENCLAW_HOOK_TOKEN }} - run: | - TEXT="❌ ${WORKFLOW} failed: ${REPO}" - TEXT+=$'\nRun: '"${RUN_URL}" - PAYLOAD=$(jq -n --arg text "$TEXT" '{text: $text, mode: "now"}') - WAKE_URL="${HOOK_URL%/agent}/wake" - curl -sf -X POST \ - -H "Authorization: Bearer ${HOOK_TOKEN}" \ - -H "Content-Type: application/json" \ - -d "$PAYLOAD" \ - "$WAKE_URL" + uses: sdkman/.github/.github/workflows/reusable-notify-on-failure.yml@main + secrets: inherit