mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-11 17:00:22 +00:00
* ci: hide only risky download links in issue comments Stop deleting comments that merely mention an archive or executable name. Match http(s) URLs whose path contains a risky extension, skip the issue author as well as maintainers and bots, and minimize matches as spam instead of deleting them. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> * ci: relay edited issue comments with truncated bodies Forward issue_comment edited events and include comment identity, association, timestamps, and bodies clipped to 4000 characters. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com>
73 lines
2.4 KiB
YAML
73 lines
2.4 KiB
YAML
name: Forward issue events to Grok Bot
|
|
|
|
on:
|
|
issues:
|
|
types: [opened, reopened, edited]
|
|
issue_comment:
|
|
types: [created, edited]
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
forward:
|
|
# PR comments are handled elsewhere; only forward real issues.
|
|
if: github.event_name == 'issues' || github.event.issue.pull_request == null
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 2
|
|
steps:
|
|
- name: Forward minimal event to Grok Bot webhook
|
|
env:
|
|
WEBHOOK_URL: ${{ secrets.GROKBOT_WEBHOOK_URL }}
|
|
WEBHOOK_KEY: ${{ secrets.GROKBOT_WEBHOOK_KEY }}
|
|
run: |
|
|
if [ -z "$WEBHOOK_URL" ] || [ -z "$WEBHOOK_KEY" ]; then
|
|
echo "Grok Bot webhook secrets not set; skipping."
|
|
exit 0
|
|
fi
|
|
jq --arg event "$GITHUB_EVENT_NAME" '
|
|
def clip:
|
|
if type == "string" then .[0:4000] else . end;
|
|
{
|
|
event: $event,
|
|
action: .action,
|
|
repository: .repository.full_name,
|
|
sender: .sender.login,
|
|
issue: (
|
|
{
|
|
number: .issue.number,
|
|
title: .issue.title,
|
|
author: .issue.user.login,
|
|
url: .issue.html_url
|
|
} + (
|
|
if $event == "issues" then {
|
|
author_association: .issue.author_association,
|
|
body: (.issue.body | clip)
|
|
} else {} end
|
|
)
|
|
),
|
|
comment: (
|
|
if .comment then
|
|
{
|
|
id: .comment.id,
|
|
author: .comment.user.login,
|
|
url: .comment.html_url,
|
|
node_id: .comment.node_id,
|
|
author_association: .comment.author_association,
|
|
user_type: .comment.user.type,
|
|
created_at: .comment.created_at,
|
|
updated_at: .comment.updated_at,
|
|
body: (.comment.body | clip)
|
|
} + (
|
|
if .action == "edited" then {
|
|
previous_body: (.changes.body.from | clip)
|
|
} else {} end
|
|
)
|
|
else null end
|
|
)
|
|
}
|
|
' "$GITHUB_EVENT_PATH" \
|
|
| curl -fsS --max-time 20 -X POST \
|
|
-H "Authorization: Bearer $WEBHOOK_KEY" \
|
|
-H "Content-Type: application/json" \
|
|
--data @- "$WEBHOOK_URL"
|