Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

feat: npm audit claude webhook

mogery3de6414801d7
diff --git a/.github/workflows/npm-audit-claude-remediation.yml b/.github/workflows/npm-audit-claude-remediation.yml
index 1eb13963d..4e5f7a1ea 100644
--- a/.github/workflows/npm-audit-claude-remediation.yml
+++ b/.github/workflows/npm-audit-claude-remediation.yml
@@ -23,6 +23,8 @@ jobs:
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'failure' }}
runs-on: blacksmith-2vcpu-ubuntu-2404
timeout-minutes: 60
+ env:
+ NPM_AUDIT_CLAUDE_SLACK_WEBHOOK_URL: ${{ secrets.NPM_AUDIT_CLAUDE_SLACK_WEBHOOK_URL }}
steps:
- name: Checkout default branch
@@ -61,6 +63,7 @@ jobs:
--allowedTools "Read,Edit,MultiEdit,Write,Glob,Grep,LS,WebFetch,WebSearch,TodoWrite,Bash(pnpm:*),Bash(npm:*),Bash(node:*),Bash(git:*),Bash(gh:*),Bash(jq:*),Bash(rg:*),Bash(curl:*),Bash(date:*)"
- name: Ensure remediation PR marker
+ id: remediation_pr
if: ${{ steps.scan.outputs.has_uncovered == 'true' && steps.claude.outputs.branch_name != '' }}
env:
GH_TOKEN: ${{ github.token }}
@@ -75,6 +78,13 @@ jobs:
exit 0
fi
+ PR_URL="$(gh pr view "$PR_NUMBER" --json url --jq '.url')"
+ PR_TITLE="$(gh pr view "$PR_NUMBER" --json title --jq '.title')"
+ PR_SUMMARY="$(node -e 'const title = process.argv[1] || ""; console.log(title.replace(/^[A-Za-z]+(?:\([^)]+\))?!?:\s*/, ""));' "$PR_TITLE")"
+
+ echo "pr_url=${PR_URL}" >> "$GITHUB_OUTPUT"
+ echo "summary=${PR_SUMMARY}" >> "$GITHUB_OUTPUT"
+
gh label create audit-ci-remediation \
--description "Automated audit-ci vulnerability remediation" \
--color "B60205" \
@@ -104,3 +114,22 @@ jobs:
NODE
gh pr edit "$PR_NUMBER" --body-file "$UPDATED_BODY_FILE"
+
+ - name: Notify Slack about remediation PR
+ if: ${{ steps.remediation_pr.outputs.pr_url != '' && env.NPM_AUDIT_CLAUDE_SLACK_WEBHOOK_URL != '' }}
+ env:
+ SLACK_WEBHOOK_URL: ${{ env.NPM_AUDIT_CLAUDE_SLACK_WEBHOOK_URL }}
+ PR_URL: ${{ steps.remediation_pr.outputs.pr_url }}
+ SUMMARY: ${{ steps.remediation_pr.outputs.summary }}
+ run: |
+ set -euo pipefail
+
+ jq -n \
+ --arg pr_url "$PR_URL" \
+ --arg summary "$SUMMARY" \
+ '{pr_url: $pr_url, summary: $summary}' \
+ | curl --fail-with-body --show-error --silent \
+ --request POST \
+ --header "Content-Type: application/json" \
+ --data @- \
+ "$SLACK_WEBHOOK_URL"