-
-
Notifications
You must be signed in to change notification settings - Fork 73
82 lines (69 loc) · 3.23 KB
/
live-api-healthcheck.yml
File metadata and controls
82 lines (69 loc) · 3.23 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
76
77
78
79
80
81
82
name: Live API healthcheck
on:
schedule:
- cron: '0 2 * * 1' # Every Monday at 2 AM UTC
workflow_dispatch:
permissions:
issues: write
jobs:
live-api-healthcheck:
# Workflow logic:
# 1. Run tests against the live API (skip pytest-recording / vcr behavior)
# 2. IF tests pass -> Do nothing
# 3. IF tests fail -> Create issue (if no open issue with same title exists)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.13"
- name: Install dependencies
run: make setup
- name: Run tests against live API
# Streaming endpoints can intermittently hang or time out for many
# minutes. To keep the healthcheck fast and reliable we skip tests
# marked with the `streaming` marker in this workflow and run the
# non-streaming test target instead.
run: make test_live_no_streaming
id: test
continue-on-error: true
- name: Check for existing issue
if: steps.test.outcome != 'success'
id: existing_issue
env:
GH_TOKEN: ${{ github.token }}
run: |
# Search for open issues with the specific title to avoid duplicates
issues=$(gh issue list --search "in:title Live API healthcheck - Test failures detected" --state open --json number)
issue_count=$(echo "$issues" | jq 'length')
if [ "$issue_count" -gt 0 ]; then
issue_number=$(echo "$issues" | jq -r '.[0].number')
echo "exists=true" >> $GITHUB_OUTPUT
echo "Existing issue #${issue_number} found, skipping creation"
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "No existing issue found"
fi
- name: Create issue (tests failed - needs review)
if: steps.test.outcome != 'success' && steps.existing_issue.outputs.exists == 'false'
env:
GH_TOKEN: ${{ github.token }}
run: |
run_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
gh issue create \
--title "Live API healthcheck - Test failures detected" \
--body "## Summary
Test failures detected when running tests against the live API.
## Test Results
The live-run produced failing tests; the exact failure mode may vary (schema change, data mismatch, timeout, auth error, flaky test, etc.).
## Action Required
1. Review test failures in the [workflow run](${run_url})
2. Reproduce locally: \`make test_live_api\`
3. If API changes are confirmed, either:
- Update the code/tests to match the new API
- Re-record affected cassettes manually
4. To re-record cassettes, run locally: \`uv run pytest --record-mode=rewrite\`
5. Run \`make test\` to verify fixes against recorded cassettes before merging
---
**Note**: This issue is automatically created when the live API healthcheck detects possible API changes. Close this issue once the problems are resolved."