Skip to content

feat(ci): configure automated provider fallback for PR reviews - #18

Merged
menil merged 1 commit into
mainfrom
feat/auto-provider-pr-review
Nov 1, 2026
Merged

menil merged 1 commit into
mainfrom
feat/auto-provider-pr-review

Conversation

@menil

@menil menil commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Summary

Configures provider: 'auto' in both the repository's own PR code review workflow and the template workflow rendered for downstream Copier projects.

With menil/pr-code-review-action@main now natively supporting automated provider candidate evaluation and fallback, setting provider: 'auto' allows the action to:

  1. Prioritize Claude (trying CLAUDE_CODE_OAUTH_TOKEN first, then ANTHROPIC_API_KEY if configured).
  2. Automatically fall back to OPENROUTER_API_KEY upon encountering token/authentication errors, Anthropic credit exhaustion (HTTP 400 credit balance), or 5xx server outages.
  3. Replace the legacy static ternary expression (provider: ${{ ... && 'anthropic' || 'openrouter' }}), which previously forced provider: 'anthropic' whenever an Anthropic credential was set and prevented runtime fallback to OpenRouter.

Changes

  • Workflow Configurations: Updated .github/workflows/pr-review.yml and template/.github/workflows/pr-review.yml to set provider: 'auto' with explanatory comments.
  • Documentation: Updated README.md and template/README.md.jinja to describe the automated fallback functionality and updated secret definitions.
  • Scaffolding Script: Updated scripts/create-project.sh completion message to mention ANTHROPIC_API_KEY (or CLAUDE_CODE_OAUTH_TOKEN) and/or OPENROUTER_API_KEY.

Verification

  • Pre-commit hooks executed just validate via nix-shell verifying:
    • Agent ignore synchronization (.claude/settings.json sync with .agentignore).
    • Copier template generation and verification (dry-run scaffolding).
    • Commit message format and line-length constraints.

AI-Reasoning: https://github.com/menil/project-template/blob/ai-reasoning/feat-auto-provider-pr-review.md

Update workflow configurations in .github/workflows/pr-review.yml
and template/.github/workflows/pr-review.yml to use provider: 'auto'.
This leverages menil/pr-code-review-action's native support for
automated fallback from Claude (OAuth token or API key) to OpenRouter
on token errors, credit balance depletion, or 5xx server outages.

Update README.md, template/README.md.jinja, and create-project.sh
to document automated fallback and secrets configuration.

AI-Reasoning: https://github.com/menil/project-template/blob/ai-reasoning/feat-auto-provider-pr-review.md

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Needs Attention (0 issues)

No critical issues found.

Suggestions (1 items)

  1. [Dependency] Pin Action Version (LOW impact, LOW effort) - .github/workflows/pr-review.yml:20
    Using @main for the action version can lead to unstable builds if the action author pushes a breaking change. Consider pinning to a specific commit SHA or semantic version.

All Clear

Correctness, Static Analysis, Security, Quality, Performance, and PII Detection passed.

Verdict: Ready to Merge

The changes simplify the provider selection logic and update the documentation accordingly.

@menil
menil merged commit ecf367b into main Nov 1, 2026
4 checks passed
@menil
menil deleted the feat/auto-provider-pr-review branch November 1, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant