Skip to content

feat: allow bot actors for automated workflows - #280

Closed
lroolle wants to merge 1 commit into
anthropics:mainfrom
thevibeworks:feat/allow-bot-actor
Closed

lroolle wants to merge 1 commit into
anthropics:mainfrom
thevibeworks:feat/allow-bot-actor

Conversation

@lroolle

@lroolle lroolle commented Jul 16, 2025 •

Copy link
Copy Markdown

Add allow_bot_actor parameter for automated workflows

This PR adds an allow_bot_actor parameter to enable bot actors (including GitHub Apps, github-actions[bot], etc.) to trigger Claude Code Action.

Why This Change?

Currently, only human users can trigger Claude. This prevents legitimate automation scenarios like:

  • Automated documentation updates
  • Scheduled maintenance tasks
  • CI-triggered code reviews
  • Bot-assisted workflows

Implementation Details

1. New Parameter

allow_bot_actor:
  description: "Allow bot actors to trigger the action. Default is false for security reasons."
  required: false
  default: "false"

2. Security Model

  • Opt-in only: Requires explicit allow_bot_actor: true
  • Double validation: Bots must pass BOTH actor check AND write permission verification
  • Write permissions required: Bots without write access are rejected

3. Example Usage

From our claude-code-docs repository:

steps:
  - name: Generate GitHub App token
    id: app-token
    uses: actions/create-github-app-token@v2
    with:
      app-id: ${{ secrets.APP_ID }}
      private-key: ${{ secrets.APP_PRIVATE_KEY }}
      permission-contents: write
      permission-pull-requests: write
      permission-issues: write

  - name: Run Claude Code Review
    uses: thevibeworks/claude-code-action@feat/allow-bot-actor
    with:
      claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
      github_token: ${{ steps.app-token.outputs.token }}  # GitHub App token with write permissions
      model: "claude-sonnet-4-20250514"
      allow_bot_actor: true  # Enable bot actors

Essential configuration for bot actors:

  1. Generate a GitHub App token with write permissions (as shown above)
  2. Set allow_bot_actor: true in your workflow
  3. Pass the GitHub App token to ensure the bot has write permissions
  4. The bot will be validated for write access before being allowed to proceed

What This Enables

  • GitHub Apps can trigger Claude (e.g., for automated doc updates)
  • Workflows using PATs can trigger Claude
  • Even github-actions[bot] can trigger Claude IF it has write permissions

Testing

Comprehensive test coverage added:

  • Actor validation tests for bot scenarios
  • Permission validation tests for various bot configurations
  • Multiple fallback checks for bot write permissions

@lroolle lroolle changed the title Feat: allow bot actor fix: GitHub bot permissions validation security issues Jul 16, 2025
@lroolle lroolle changed the title fix: GitHub bot permissions validation security issues feat: allow bot actors for automated workflows Jul 16, 2025
@lroolle
lroolle force-pushed the feat/allow-bot-actor branch 2 times, most recently from e318b9d to 4178164 Compare July 17, 2025 06:08
@lroolle
lroolle marked this pull request as draft July 17, 2025 07:20
@lroolle
lroolle force-pushed the feat/allow-bot-actor branch from 1a6a377 to 9086e70 Compare July 23, 2025 17:47
@lroolle

lroolle commented Jul 23, 2025 •

Copy link
Copy Markdown
Author

👋 Hey! I found some related PRs that implement similar bot actor functionality:

Related/Duplicate PRs:

Current implementation comparison:

Our approach strikes a good balance - secure by default, simple to configure, explicit opt-in. The security fixes included here also address critical permission validation issues found during review.

Example usage can be seen at https://github.com/thevibeworks/claude-code-docs/blob/main/.github/workflows/claude-code-review.yml

@lroolle
lroolle force-pushed the feat/allow-bot-actor branch 2 times, most recently from 3a56256 to 391081f Compare July 23, 2025 18:12
@lroolle
lroolle marked this pull request as ready for review July 23, 2025 18:21
@lroolle
lroolle force-pushed the feat/allow-bot-actor branch from 391081f to d2e6907 Compare July 23, 2025 18:28
- Add allow_bot_actor parameter to enable GitHub bots to trigger Claude Code Action
- Implement robust bot write permission validation
- Use repo.permissions for comprehensive access checks
- Handle both collaborator and installation permissions
- Add comprehensive test coverage for bot scenarios
- Update documentation with security considerations

This enables automated workflows like documentation updates, CI-triggered
code reviews, and scheduled maintenance while maintaining security through
explicit opt-in and proper permission validation.
@lroolle
lroolle force-pushed the feat/allow-bot-actor branch from d2e6907 to b537806 Compare July 29, 2025 15:54
@4thabang

Copy link
Copy Markdown

Any update on this PR? Currently using a private fork of this repo but we do not have the bandwidth to maintain 1:1 parity with this repo.

Would love if support for bot actors is added, would allow for more meaningful automation scenarios.

@km-anthropic

Copy link
Copy Markdown
Collaborator

@lroolle @4thabang this functionality should now be solved w/ Agent mode (example here). You can setup an agent automation (as a workflow dispatch) and bot actors should be able to trigger it.

@lroolle lroolle closed this Jul 30, 2025
@lroolle

lroolle commented Jul 30, 2025

Copy link
Copy Markdown
Author

@lroolle @4thabang this functionality should now be solved w/ Agent mode (example here). You can setup an agent automation (as a workflow dispatch) and bot actors should be able to trigger it.

thank you

lroolle added a commit to thevibeworks/claude-code-action that referenced this pull request Aug 4, 2025
- Add allow_bot_actor parameter to enable GitHub bots to trigger Claude Code Action
- Implement robust bot write permission validation
- Add test coverage for bot scenarios
- Update documentation with security considerations

This enables automated workflows like documentation updates, CI-triggered
code reviews, and scheduled maintenance while maintaining security through
explicit opt-in and proper permission validation.

Relevant works: anthropics#388 anthropics#280 anthropics#194 anthropics#117
lroolle added a commit to thevibeworks/claude-code-action that referenced this pull request Aug 5, 2025
- Add allow_bot_actor parameter to enable GitHub bots to trigger Claude Code Action
- Implement robust bot write permission validation
- Add test coverage for bot scenarios
- Update documentation with security considerations

This enables automated workflows like documentation updates, CI-triggered
code reviews, and scheduled maintenance while maintaining security through
explicit opt-in and proper permission validation.

Relevant works: anthropics#388 anthropics#280 anthropics#194 anthropics#117
lroolle added a commit to thevibeworks/claude-code-action that referenced this pull request Aug 6, 2025
- Add allow_bot_actor parameter to enable GitHub bots to trigger Claude Code Action
- Implement robust bot write permission validation
- Add test coverage for bot scenarios
- Update documentation with security considerations

This enables automated workflows like documentation updates, CI-triggered
code reviews, and scheduled maintenance while maintaining security through
explicit opt-in and proper permission validation.

Relevant works: anthropics#388 anthropics#280 anthropics#194 anthropics#117
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.

3 participants