Skip to content

Commit a05f873

Browse files
haasonsaasclaude
andcommitted
fix: skip DiffScope self-review when API key not configured
Instead of failing the workflow, emit a notice and skip the review and comment-posting steps when OPENAI_API_KEY is not set. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 27490eb commit a05f873

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

.github/workflows/diffscope.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,26 @@ jobs:
2727
git fetch origin ${{ github.base_ref }} --depth=1
2828
git diff origin/${{ github.base_ref }}...HEAD > pr.diff
2929
30+
- name: Check API key
31+
id: check_key
32+
run: |
33+
if [ -z "${{ secrets.OPENAI_API_KEY }}" ]; then
34+
echo "skip=true" >> "$GITHUB_OUTPUT"
35+
echo "::notice::DiffScope review skipped — OPENAI_API_KEY secret not configured"
36+
else
37+
echo "skip=false" >> "$GITHUB_OUTPUT"
38+
fi
39+
3040
- name: Run DiffScope
41+
if: steps.check_key.outputs.skip != 'true'
3142
uses: docker://ghcr.io/haasonsaas/diffscope:latest
3243
env:
3344
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
3445
with:
3546
args: review --diff pr.diff --output-format json --output comments.json
36-
47+
3748
- name: Post comments
49+
if: steps.check_key.outputs.skip != 'true'
3850
uses: actions/github-script@v7
3951
with:
4052
script: |

0 commit comments

Comments
 (0)