Commit 5523a5a
feat: skip Claude step gracefully when Anthropic API is unavailable
## Summary
- Add pre-flight API availability check before running
`claude-code-action`
- Skip the Claude step gracefully (warning, not failure) when the API
returns 5xx or is unreachable
- Belt-and-suspenders: `continue-on-error: true` + post-execution
re-check distinguishes service outages from legitimate errors
## Problem
When the Anthropic API is down, the Claude step fails with a hard error,
blocking the entire CI pipeline. Example: [dotCMS/core run
24461196854](https://github.com/dotCMS/core/actions/runs/24461196854)
```
API Error: 500 {"type":"error","error":{"type":"api_error","message":"Internal server error"}} · check status.claude.com
```
## Solution
Two layers of protection in `claude-executor.yml`:
**Layer 1 — Pre-flight check** (catches most outages):
- `curl` the `/v1/models` endpoint with a 15s timeout before running
Claude
- 5xx / network failures → `available=false` → skip Claude step → warn
and succeed
- Auth errors (401/403), rate limits (429) → `available=true` → proceed
so action can surface the specific error
**Layer 2 — Runtime protection** (catches mid-execution degradation):
- `continue-on-error: true` on the Claude step
- Post-execution step checks if Claude failed
- If failed AND API is now returning 500 → skip gracefully (service
issue)
- If failed AND API is now returning 200 → re-fail with "legitimate
error" message
## Test
Validated in `dotCMS/core-workflow-test#460`:
- Pre-flight check correctly passes when API is available
- `Handle Claude execution result` correctly re-fails for non-service
errors (workflow validation failure in test PR)
- The skip path is code-correct (would activate when API returns 5xx)
## Consumer repos to update after merge
- `dotCMS/core` — update `@v2.0.0` → new tag
- `dotCMS/core-workflow-test` — update `@v2.0.0` → new tag
Fixes: dotCMS/core#35328
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent ac1713b commit 5523a5a
1 file changed
Lines changed: 71 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
69 | 104 | | |
70 | 105 | | |
| 106 | + | |
| 107 | + | |
71 | 108 | | |
72 | 109 | | |
73 | 110 | | |
74 | 111 | | |
75 | 112 | | |
76 | 113 | | |
77 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
0 commit comments