Skip to content

Feishu Notification (post-CI) #132

Feishu Notification (post-CI)

Feishu Notification (post-CI) #132

Workflow file for this run

name: Feishu Notification (post-CI)
on:
workflow_run:
workflows: ["CI"]
types: [completed]
jobs:
notify:
name: "Notify (overall)"
runs-on: ubuntu-latest
timeout-minutes: 5
continue-on-error: true
steps:
- name: Checkout scripts
uses: actions/checkout@v4
with:
sparse-checkout: .github/scripts
- name: Resolve PR info
id: pr
env:
GH_TOKEN: ${{ github.token }}
run: |
# workflow_run.pull_requests is empty for fork PRs, so fall back to API lookup by SHA
PR_NUM="${{ github.event.workflow_run.pull_requests[0].number }}"
PR_TITLE=""
if [ -z "$PR_NUM" ]; then
HEAD_SHA="${{ github.event.workflow_run.head_sha }}"
PR_JSON=$(gh api "repos/${{ github.repository }}/commits/${HEAD_SHA}/pulls" \
--jq '.[0] | {number, title}' 2>/dev/null || true)
PR_NUM=$(echo "$PR_JSON" | jq -r '.number // empty' 2>/dev/null || true)
PR_TITLE=$(echo "$PR_JSON" | jq -r '.title // empty' 2>/dev/null || true)
elif [ -n "$PR_NUM" ]; then
PR_TITLE=$(gh api "repos/${{ github.repository }}/pulls/${PR_NUM}" \
--jq '.title // empty' 2>/dev/null || true)
fi
echo "number=${PR_NUM}" >> "$GITHUB_OUTPUT"
echo "title=${PR_TITLE}" >> "$GITHUB_OUTPUT"
- name: Send Feishu notification
env:
FEISHU_APP_ID: ${{ secrets.FEISHU_APP_ID }}
FEISHU_APP_SECRET: ${{ secrets.FEISHU_APP_SECRET }}
FEISHU_CHAT_ID: ${{ secrets.FEISHU_CHAT_ID }}
CI_STATUS: ${{ github.event.workflow_run.conclusion }}
OVERRIDE_WORKFLOW: ${{ github.event.workflow_run.name }}
OVERRIDE_REF: ${{ github.event.workflow_run.head_branch }}
OVERRIDE_SHA: ${{ github.event.workflow_run.head_sha }}
OVERRIDE_RUN_URL: ${{ github.event.workflow_run.html_url }}
PR_NUMBER: ${{ steps.pr.outputs.number }}
PR_TITLE: ${{ steps.pr.outputs.title }}
run: python .github/scripts/notify_feishu.py