From b6d39675180070ca3077357587049ca556d84d66 Mon Sep 17 00:00:00 2001 From: lml2468 Date: Sat, 27 Jun 2026 17:02:58 +0800 Subject: [PATCH] feat(octo-pr-review-feed): add enable_im_notify input + PR_TRIAGE_WEBHOOK_URL secret Mirrors Mininglamp-OSS/.github#80 (which added the same toggle to octo-issue-notify). The PR side of the feed pipeline was previously IM-only; this PR adds the optional triage webhook output so that repos which have moved to an external PR review triage agent can: 1. POST the sanitized PR payload to PR_TRIAGE_WEBHOOK_URL (new optional secret) for downstream fan-out review dispatch. 2. Set enable_im_notify: false to drop the now-redundant IM ping. Per the octo-notify composite action's contract, an empty `im-message` disables IM mode entirely; webhook mode is independent. Backward compat: default enable_im_notify=true and PR_TRIAGE_WEBHOOK_URL optional. Existing callers see no change. Usage example: jobs: notify: uses: Mininglamp-OSS/.github/.github/workflows/octo-pr-review-feed.yml@v1 with: repo_name: ${{ github.event.repository.name }} # ... existing inputs ... enable_im_notify: false secrets: OCTO_BOT_TOKEN: ${{ secrets.OCTO_BOT_TOKEN }} PR_TRIAGE_WEBHOOK_URL: ${{ secrets.PR_TRIAGE_WEBHOOK_URL }} --- .github/workflows/octo-pr-review-feed.yml | 32 +++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/octo-pr-review-feed.yml b/.github/workflows/octo-pr-review-feed.yml index 3aa007f..7a1a483 100644 --- a/.github/workflows/octo-pr-review-feed.yml +++ b/.github/workflows/octo-pr-review-feed.yml @@ -31,9 +31,24 @@ on: type: string required: false default: 'https://im.deepminer.com.cn/api' + enable_im_notify: + type: boolean + required: false + default: true + description: >- + When false, skip the Octo IM push and only fire the PR triage webhook. + Default true preserves existing behavior for all current callers; opt + in by passing `enable_im_notify: false` when a repo has already moved + to an external PR triage agent and no longer wants duplicate IM pings. secrets: OCTO_BOT_TOKEN: required: true + PR_TRIAGE_WEBHOOK_URL: + required: false + description: >- + PR review triage agent webhook URL (capability secret). When provided, + the PR ready_for_review / review_requested event is forwarded to the + agent for fan-out review dispatch. Omit to disable. permissions: {} @@ -112,15 +127,28 @@ jobs: f"\U0001f517 {pr_url}" ) + import json + webhook_payload = json.dumps({ + 'repo': repo_name, + 'number': int(pr_number), + 'title': pr_title, + 'url': pr_url, + 'author': pr_author, + 'action': event_action, + }) + emit('skip', 'false') emit('im_message', message) + emit('webhook_payload', webhook_payload) PYEOF - - name: Send to Octo IM + - name: Send (IM feed + optional triage webhook) if: steps.build.outputs.skip != 'true' uses: Mininglamp-OSS/.github/.github/actions/octo-notify@v1 with: - im-message: ${{ steps.build.outputs.im_message }} + im-message: ${{ inputs.enable_im_notify && steps.build.outputs.im_message || '' }} im-token: ${{ secrets.OCTO_BOT_TOKEN }} im-group-id: ${{ inputs.project_group_id }} im-api-base: ${{ inputs.api_base_url }} + webhook-url: ${{ secrets.PR_TRIAGE_WEBHOOK_URL }} + webhook-payload: ${{ steps.build.outputs.webhook_payload }}