Skip to content

Commit 6a90988

Browse files
committed
Add Dependabot failure notifications
1 parent 78a5603 commit 6a90988

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Dependabot Alerts
2+
on:
3+
schedule:
4+
- cron: '0 0 * * *' # Daily at midnight
5+
6+
jobs:
7+
check-dependabot:
8+
runs-on: ubuntu-24.04
9+
steps:
10+
- name: Check for Dependabot failures
11+
run: |
12+
# Get yesterday's date
13+
YESTERDAY=$(date -u -d '1 day ago' +%Y-%m-%dT%H:%M:%SZ)
14+
15+
# Query for failed Dependabot runs
16+
FAILURES=$(curl -s \
17+
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
18+
-H "Accept: application/vnd.github+json" \
19+
"https://api.github.com/repos/${{ github.repository }}/actions/runs?actor=dependabot[bot]&status=failure&created=>=$YESTERDAY")
20+
21+
# Parse and alert if failures found
22+
if [ "$(echo $FAILURES | jq '.total_count')" -gt 0 ]; then
23+
echo "Found Dependabot failures!"
24+
echo $FAILURES | jq '.workflow_runs[] | {name, html_url, created_at}'
25+
# Add your alerting logic here (Slack, email, etc.)
26+
fi

0 commit comments

Comments
 (0)