-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrigger-knowledge-ingestion.yml
More file actions
75 lines (65 loc) · 2.45 KB
/
Copy pathtrigger-knowledge-ingestion.yml
File metadata and controls
75 lines (65 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Knowledge Ingestion
on:
pull_request:
branches:
- main
push:
branches:
- main
paths:
- 'knowledge/**'
- 'scraped/**'
workflow_dispatch: # Allow manual trigger
jobs:
health-check:
name: Assistant health check
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Verify assistant API key and endpoint health
run: |
response=$(curl -s -w "\n%{http_code}" -X GET \
"${{ secrets.RUNPOD_ASSISTANT_API_URL }}/api/health?detailed=true" \
-H "Authorization: Bearer ${{ secrets.RUNPOD_ASSISTANT_API_KEY }}")
http_code=$(echo "$response" | tail -n1)
body=$(echo "$response" | sed '$d')
echo "Response: $body (HTTP $http_code)"
if [ "$http_code" -ne 200 ]; then
if [ "$http_code" -eq 401 ]; then
echo "RUNPOD_ASSISTANT_API_KEY secret is missing or invalid"
else
echo "Assistant health check failed (HTTP $http_code)"
fi
exit 1
fi
status=$(echo "$body" | jq -r '.status // empty')
if [ "$status" != "ok" ]; then
echo "Assistant is degraded — status: $status"
echo "$body" | jq .
exit 1
fi
echo "Assistant is healthy — API key valid, ingestion will work on merge"
trigger-ingestion:
name: Trigger ingestion
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Trigger v2 Knowledge Ingestion
run: |
echo "Triggering knowledge ingestion..."
response=$(curl -s -w "\n%{http_code}" -X POST \
"${{ secrets.RUNPOD_ASSISTANT_API_URL }}/api/ingest" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${{ secrets.RUNPOD_ASSISTANT_API_KEY }}" \
-d '{"source": "knowledge"}')
http_code=$(echo "$response" | tail -n1)
body=$(echo "$response" | sed '$d')
echo "Response: $body (HTTP $http_code)"
if [ "$http_code" -eq 200 ]; then
echo "Successfully triggered knowledge ingestion"
elif [ "$http_code" -eq 409 ]; then
echo "Ingestion already running — skipping"
else
echo "Failed to trigger ingestion"
exit 1
fi