File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name : Security Vulnerability Slack Notification
2-
32on :
43 schedule :
54 - cron : ' 0 * * * *' # Runs every hour
1413
1514 - name : Check for Recent Alerts
1615 env :
17-
16+ # Use a PAT instead of the default token
17+ GH_TOKEN : ${{ secrets.DEPENDABOT_PAT }}
1818 SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
1919 run : |
2020 # 1. Calculate time 65 minutes ago
2424
2525 # 2. Fetch alerts using GitHub CLI
2626 # Note: We point to the API endpoint explicitly
27- ALERTS=$(gh api "https:// github.com/mongodb/docs-sample-apps/security/ dependabot" \
27+ ALERTS=$(gh api "/repos/${{ github.repository }}/ dependabot/alerts " \
2828 --jq ".[] | select(.state == \"open\") | select(.created_at > \"$TIME_THRESHOLD\") | select(.security_advisory.severity == \"critical\" or .security_advisory.severity == \"high\")")
29-
29+
30+ echo "Past Alerts step."
3031 # 3. Check if any alerts were found
3132 if [ -z "$ALERTS" ]; then
3233 echo "No new alerts found in the last hour."
You can’t perform that action at this time.
0 commit comments