[Question] OAuth/setup-token policy for scheduled CI/CD automation (GitHub Actions, GitLab CI)
Context
I'm planning to use Claude Code CLI in GitHub Actions and GitLab CI/CD for scheduled tasks such as code review, document review, and research/data collection. These would be non-interactive, cron-scheduled workflows (e.g., monthly runs).
Before implementing this, I'd like to confirm whether this use case is supported under current terms.
Question
With the recent OAuth policy changes for Claude Code, I'd like to clarify whether the following use case is permitted:
Intended Use Case
- Authentication:
CLAUDE_CODE_OAUTH_TOKEN(generated viaclaude setup-token) stored as a CI/CD secret - Subscription: Claude Max
- Execution:
claude -p "$PROMPT" --output-format textin non-interactive mode - Schedule: Monthly cron — approximately 1 run per month
- Purpose: Code/document review and research analysis
- CI Platforms: GitHub Actions, GitLab CI/CD
Concerns
- Is scheduled/cron-based execution of Claude Code CLI via
CLAUDE_CODE_OAUTH_TOKENallowed under Max subscription terms? Or is it restricted to interactive/human-triggered use only?
- Does the
setup-tokenmechanism support long-running CI/CD use cases, or is it intended only for short-lived headless sessions?
- Are there rate limits or fair-use policies that would apply to scheduled automation, even if infrequent (monthly)?
- Is there any difference in policy between using
CLAUDE_CODE_OAUTH_TOKEN(subscription-based, no per-token cost) vsANTHROPIC_API_KEY(pay-per-use) for CI/CD automation?
- GitHub Actions vs GitLab CI/CD — any platform-specific restrictions?
Comparison with Other Tools
For reference, OpenAI Codex CLI documents non-interactive mode explicitly for CI/CD use. Gemini CLI supports --non-interactive flag with API key auth for headless environments. I'd like to understand Claude Code's equivalent positioning.
Why This Matters
If OAuth-based scheduled automation is not supported, I would need to fall back to ANTHROPIC_API_KEY (API billing) instead. Clarity on this would help the community design CI/CD integrations appropriately.
Environment
- Claude Code version: latest (npm)
- Subscription: Max
- Platform: GitHub Actions (ubuntu-latest), GitLab CI/CD (planned)
- Frequency: Monthly scheduled runs
Thank you for any guidance!
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗