Skip to content

Commit b509fd8

Browse files
committed
chore: automated sync of local changes
1 parent deff030 commit b509fd8

1 file changed

Lines changed: 80 additions & 0 deletions

File tree

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
2+
# Intake pipeline for cross-repo Hypatia/Gitbot dispatch events.
3+
name: Hypatia Dispatch Intake
4+
5+
on:
6+
repository_dispatch:
7+
types:
8+
- hypatia-security-alert
9+
- hypatia-secret-alert
10+
- secret-scanner-alert
11+
- hypatia-general-findings
12+
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
intake:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout gitbot-fleet
21+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Record dispatch event
26+
env:
27+
EVENT_JSON: ${{ toJson(github.event) }}
28+
EVENT_TYPE: ${{ github.event.action }}
29+
RUN_ID: ${{ github.run_id }}
30+
run: |
31+
set -euo pipefail
32+
33+
git checkout findings-submissions 2>/dev/null || git checkout -b findings-submissions
34+
35+
TS="$(date -u +%Y%m%d-%H%M%S)"
36+
EVENTS_DIR="shared-context/dispatch/events"
37+
mkdir -p "$EVENTS_DIR"
38+
39+
EVENT_FILE="${EVENTS_DIR}/${TS}-${RUN_ID}-${EVENT_TYPE}.json"
40+
printf '%s\n' "$EVENT_JSON" > "$EVENT_FILE"
41+
42+
SOURCE_REPO="$(jq -r '.client_payload.source_repo // "unknown"' "$EVENT_FILE")"
43+
SOURCE_SHA="$(jq -r '.client_payload.sha // "unknown"' "$EVENT_FILE")"
44+
FINDINGS_COUNT="$(jq -r '.client_payload.findings_count // .client_payload.incident_count // "n/a"' "$EVENT_FILE")"
45+
46+
jq -n \
47+
--arg ts "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
48+
--arg event_type "$EVENT_TYPE" \
49+
--arg source_repo "$SOURCE_REPO" \
50+
--arg source_sha "$SOURCE_SHA" \
51+
--arg findings_count "$FINDINGS_COUNT" \
52+
--arg event_file "$EVENT_FILE" \
53+
'{
54+
received_at: $ts,
55+
event_type: $event_type,
56+
source_repo: $source_repo,
57+
source_sha: $source_sha,
58+
findings_count: $findings_count,
59+
event_file: $event_file
60+
}' >> shared-context/dispatch/events.jsonl
61+
62+
git add "$EVENT_FILE" shared-context/dispatch/events.jsonl
63+
git config user.name "Hypatia Dispatch Intake"
64+
git config user.email "hypatia-dispatch@reposystem.dev"
65+
66+
if git diff --cached --quiet; then
67+
echo "No dispatch intake changes to commit."
68+
exit 0
69+
fi
70+
71+
git commit -m "dispatch-intake: ${EVENT_TYPE} from ${SOURCE_REPO}"
72+
git push origin findings-submissions
73+
74+
- name: Trigger fleet processing for incidents
75+
if: contains(github.event.action, 'security') || contains(github.event.action, 'secret')
76+
run: |
77+
set -euo pipefail
78+
echo "Incident event received: ${{ github.event.action }}"
79+
echo "Source repo: ${{ github.event.client_payload.source_repo }}"
80+
echo "Findings: ${{ github.event.client_payload.findings_count || github.event.client_payload.incident_count }}"

0 commit comments

Comments
 (0)