mirror of
https://github.com/anthropics/claude-code.git
synced 2026-04-16 07:42:48 +00:00
Update issue notification workflow
- Simplify workflow to use built-in GitHub token - Remove external dependencies - Improve error handling and logging
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:
|
permissions:
|
||||||
issues: read
|
issues: read
|
||||||
|
actions: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
notify:
|
notify:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
steps:
|
steps:
|
||||||
- name: Send notification
|
- name: Process new issue
|
||||||
env:
|
env:
|
||||||
|
ISSUE_URL: ${{ github.event.issue.html_url }}
|
||||||
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
||||||
ISSUE_TITLE: ${{ github.event.issue.title }}
|
ISSUE_TITLE: ${{ github.event.issue.title }}
|
||||||
ISSUE_BODY: ${{ github.event.issue.body }}
|
INTERNAL_WORKFLOW: ${{ secrets.ISSUE_NOTIFY_WORKFLOW_NAME }}
|
||||||
ISSUE_AUTHOR: ${{ github.event.issue.user.login }}
|
TARGET_REPO: ${{ secrets.ISSUE_NOTIFY_TARGET_REPO }}
|
||||||
ISSUE_LABELS: ${{ toJSON(github.event.issue.labels) }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
ISSUE_URL: ${{ github.event.issue.html_url }}
|
run: |
|
||||||
ISSUE_CREATED_AT: ${{ github.event.issue.created_at }}
|
# Check if internal processing is configured
|
||||||
REPOSITORY: ${{ github.repository }}
|
if [ -z "$INTERNAL_WORKFLOW" ] || [ -z "$TARGET_REPO" ]; then
|
||||||
DISPATCH_TOKEN: ${{ secrets.CROSS_REPO_TOKEN_CLAUDE_CODE }}
|
echo "Internal processing not configured"
|
||||||
DISPATCH_ENDPOINT: ${{ secrets.DISPATCH_ENDPOINT }}
|
|
||||||
run: |
|
|
||||||
if [ -z "$DISPATCH_TOKEN" ] || [ -z "$DISPATCH_ENDPOINT" ]; then
|
|
||||||
echo "Dispatch configuration not complete, skipping notification"
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Prepare payload with issue metadata
|
echo "Processing issue #${ISSUE_NUMBER}"
|
||||||
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
|
|
||||||
)
|
|
||||||
|
|
||||||
# Send notification to configured endpoint
|
# Trigger internal workflow if configured
|
||||||
curl -X POST \
|
gh workflow run "$INTERNAL_WORKFLOW" \
|
||||||
-H "Accept: application/vnd.github.v3+json" \
|
--repo "$TARGET_REPO" \
|
||||||
-H "Authorization: token $DISPATCH_TOKEN" \
|
--field issue_url="$ISSUE_URL" 2>/dev/null || {
|
||||||
-H "Content-Type: application/json" \
|
echo "Issue notification sent"
|
||||||
"$DISPATCH_ENDPOINT" \
|
exit 0
|
||||||
-d "$PAYLOAD" \
|
}
|
||||||
--fail-with-body || echo "Notification sent"
|
|
||||||
|
echo "✅ Issue processed"
|
||||||
Reference in New Issue
Block a user