mirror of
https://github.com/anthropics/claude-code.git
synced 2025-10-19 03:17:50 +03:00
Merge pull request #7170 from anthropics/inigo/update-issue-notification-workflow
Update issue notification workflow
This commit is contained in:
58
.github/workflows/issue-notify.yml
vendored
58
.github/workflows/issue-notify.yml
vendored
@@ -6,54 +6,36 @@ on:
|
||||
|
||||
permissions:
|
||||
issues: read
|
||||
actions: write
|
||||
|
||||
jobs:
|
||||
notify:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- name: Send notification
|
||||
- name: Process new issue
|
||||
env:
|
||||
ISSUE_URL: ${{ github.event.issue.html_url }}
|
||||
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
||||
ISSUE_TITLE: ${{ github.event.issue.title }}
|
||||
ISSUE_BODY: ${{ github.event.issue.body }}
|
||||
ISSUE_AUTHOR: ${{ github.event.issue.user.login }}
|
||||
ISSUE_LABELS: ${{ toJSON(github.event.issue.labels) }}
|
||||
ISSUE_URL: ${{ github.event.issue.html_url }}
|
||||
ISSUE_CREATED_AT: ${{ github.event.issue.created_at }}
|
||||
REPOSITORY: ${{ github.repository }}
|
||||
DISPATCH_TOKEN: ${{ secrets.CROSS_REPO_TOKEN_CLAUDE_CODE }}
|
||||
DISPATCH_ENDPOINT: ${{ secrets.DISPATCH_ENDPOINT }}
|
||||
run: |
|
||||
if [ -z "$DISPATCH_TOKEN" ] || [ -z "$DISPATCH_ENDPOINT" ]; then
|
||||
echo "Dispatch configuration not complete, skipping notification"
|
||||
INTERNAL_WORKFLOW: ${{ secrets.ISSUE_NOTIFY_WORKFLOW_NAME }}
|
||||
TARGET_REPO: ${{ secrets.ISSUE_NOTIFY_TARGET_REPO }}
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
# Check if internal processing is configured
|
||||
if [ -z "$INTERNAL_WORKFLOW" ] || [ -z "$TARGET_REPO" ]; then
|
||||
echo "Internal processing not configured"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Prepare payload with issue metadata
|
||||
PAYLOAD=$(cat <<EOF
|
||||
{
|
||||
"event_type": "issue_event",
|
||||
"client_payload": {
|
||||
"source_repo": "$REPOSITORY",
|
||||
"issue_number": "$ISSUE_NUMBER",
|
||||
"issue_title": $(echo "$ISSUE_TITLE" | jq -Rs .),
|
||||
"issue_body": $(echo "$ISSUE_BODY" | jq -Rs .),
|
||||
"issue_author": "$ISSUE_AUTHOR",
|
||||
"issue_labels": $ISSUE_LABELS,
|
||||
"issue_url": "$ISSUE_URL",
|
||||
"issue_created_at": "$ISSUE_CREATED_AT",
|
||||
"timestamp": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
)
|
||||
echo "Processing issue #${ISSUE_NUMBER}"
|
||||
|
||||
# Send notification to configured endpoint
|
||||
curl -X POST \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
-H "Authorization: token $DISPATCH_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
"$DISPATCH_ENDPOINT" \
|
||||
-d "$PAYLOAD" \
|
||||
--fail-with-body || echo "Notification sent"
|
||||
# Trigger internal workflow if configured
|
||||
gh workflow run "$INTERNAL_WORKFLOW" \
|
||||
--repo "$TARGET_REPO" \
|
||||
--field issue_url="$ISSUE_URL" 2>/dev/null || {
|
||||
echo "Issue notification sent"
|
||||
exit 0
|
||||
}
|
||||
|
||||
echo "✅ Issue processed"
|
||||
Reference in New Issue
Block a user