Skip to content

Commit 0304bc4

Browse files
fix(workflows): allow dependabot PRs and handle missing secrets gracefully
1. dev-to-main.yml: - Allow dependabot PRs to bypass source branch validation - Dependabot PRs can merge directly to main for dependency updates - Regular PRs still require dev → main flow 2. claude-code-review.yml: - Skip entirely for dependabot PRs (no AI review needed for deps) - Check if CLAUDE_CODE_OAUTH_TOKEN is configured before running - Skip gracefully with warning if secret is missing - Prevents workflow failures when secret is not configured This fixes failing PR checks for dependabot PRs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 1c34058 commit 0304bc4

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

.github/workflows/claude-code-review.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ on:
1212

1313
jobs:
1414
claude-review:
15+
# Skip for dependabot PRs (no need for AI review of dependency updates)
16+
if: github.actor != 'dependabot[bot]'
17+
1518
# Optional: Filter by PR author
16-
# if: |
19+
# Additional filters can be added:
1720
# github.event.pull_request.user.login == 'external-contributor' ||
1821
# github.event.pull_request.user.login == 'new-developer' ||
1922
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
@@ -26,12 +29,27 @@ jobs:
2629
id-token: write
2730

2831
steps:
32+
- name: Check if Claude Code OAuth token is configured
33+
id: check-token
34+
run: |
35+
if [ -z "${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}" ]; then
36+
echo "⚠️ CLAUDE_CODE_OAUTH_TOKEN secret is not configured"
37+
echo " Skipping Claude Code Review"
38+
echo " To enable: Add CLAUDE_CODE_OAUTH_TOKEN to repository secrets"
39+
echo "skip=true" >> $GITHUB_OUTPUT
40+
else
41+
echo "✅ CLAUDE_CODE_OAUTH_TOKEN is configured"
42+
echo "skip=false" >> $GITHUB_OUTPUT
43+
fi
44+
2945
- name: Checkout repository
46+
if: steps.check-token.outputs.skip != 'true'
3047
uses: actions/checkout@v4
3148
with:
3249
fetch-depth: 1
3350

3451
- name: Run Claude Code Review
52+
if: steps.check-token.outputs.skip != 'true'
3553
id: claude-review
3654
uses: anthropics/claude-code-action@v1
3755
with:

.github/workflows/dev-to-main.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,15 @@ jobs:
4747
- name: Validate source is dev branch
4848
run: |
4949
SOURCE_BRANCH="${{ github.head_ref }}"
50-
echo "🔍 Validating source branch: $SOURCE_BRANCH"
50+
ACTOR="${{ github.actor }}"
51+
echo "🔍 Validating source branch: $SOURCE_BRANCH (Actor: $ACTOR)"
52+
53+
# Allow dependabot PRs to bypass dev branch requirement
54+
if [[ "$ACTOR" == "dependabot[bot]" ]] || [[ "$SOURCE_BRANCH" == dependabot/* ]]; then
55+
echo "✅ Dependabot PR - skipping source branch validation"
56+
echo " Dependabot PRs are allowed to merge directly to main"
57+
exit 0
58+
fi
5159
5260
if [[ "$SOURCE_BRANCH" != "dev" ]]; then
5361
echo "❌ Invalid source branch: $SOURCE_BRANCH"

0 commit comments

Comments
 (0)