ci(swe-bench): fix invalid job-level secrets gate#145
Merged
Conversation
The `if: ${{ secrets.ANTHROPIC_API_KEY != '' }}` at job level was
invalid — the `secrets` context isn't available in job-level `if:`
expressions, only inside step `run:`/`uses:`/`with:` blocks. GitHub
Actions therefore rejected the file on every push event, surfacing a
0-second "workflow file issue" failure even though the workflow is
`workflow_dispatch` only.
Fix:
- Drop the job-level `if:`.
- Add a first-step guard that exits 1 with a clear ::error:: message
if ANTHROPIC_API_KEY is empty at runtime, so manual triggers without
the secret configured fail loud at the gate instead of mid-evaluation.
- Quote `$GITHUB_STEP_SUMMARY` in the report step (SC2086).
Closes #143
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #143 — `swe-bench.yml` was failing in 0s on every push to every branch because of a job-level `if:` referencing the `secrets` context:
```yaml
Gate on API key availability
if: ${{ secrets.ANTHROPIC_API_KEY != '' }}
```
The `secrets` context isn't available in job-level `if:` expressions — only inside step `run:`/`uses:`/`with:` blocks. So GitHub Actions rejected the file on every event (not just `workflow_dispatch`), surfacing as a noisy failed run that masked real CI failures from readers scanning the workflows list.
Fix
if:referencing secrets #143).Verification
Closes #143
🤖 Generated with Claude Code