Skip to content

Commit d626c59

Browse files
authored
Add GitHub Advisory Check workflow
1 parent 65c292f commit d626c59

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: GitHub Advisory Check
2+
3+
on:
4+
schedule:
5+
- cron: '15 * * * *' # Every hour at :15
6+
workflow_dispatch: # Allow manual triggering
7+
8+
permissions:
9+
security-events: read
10+
11+
jobs:
12+
check:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check GitHub security advisories
16+
env:
17+
GH_TOKEN: ${{ github.token }}
18+
shell: bash
19+
run: |
20+
# Fetch advisories in triage state using GitHub REST API
21+
advisories=$(curl -s -L \
22+
-H "Accept: application/vnd.github+json" \
23+
-H "Authorization: Bearer $GH_TOKEN" \
24+
-H "X-GitHub-Api-Version: 2022-11-28" \
25+
"https://api.github.com/repos/${{ github.repository }}/security-advisories?state=triage")
26+
27+
# Build the sync payload
28+
payload=$(echo "$advisories" | jq '{
29+
advisories: [.[] | {
30+
ghsaId: .ghsa_id,
31+
summary: .summary,
32+
reportedAt: .created_at
33+
}]
34+
}')
35+
36+
count=$(echo "$payload" | jq '.advisories | length')
37+
echo "Found $count advisories in triage"
38+
39+
# Post to EPPlus API
40+
response=$(curl -s -o response.json -w "%{http_code}" \
41+
-X POST "https://epplussoftware.com/api/security/github-advisories/sync" \
42+
-H "X-Api-Key: ${{ secrets.EPPLUS_VULNERABILITY_API_KEY }}" \
43+
-H "Content-Type: application/json" \
44+
-d "$payload")
45+
46+
if [ "$response" != "200" ]; then
47+
echo "::warning::Advisory sync failed with HTTP $response"
48+
cat response.json
49+
else
50+
echo "Advisory sync successful:"
51+
cat response.json
52+
fi

0 commit comments

Comments
 (0)