ci: Add claude code github action
This will allow maintainers to mention claude in comments on issues and prs to do stuff like review something or try to reproduce a bug or other stuff. Let's give it a try and see whether we like it or not.
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
# Integrates Claude Code as an AI assistant for issues and pull requests.
|
||||
# Mention @claude in any issue comment, PR review comment, or PR review to
|
||||
# interact with it, or assign the "claude" user to an issue. Claude
|
||||
# authenticates via AWS Bedrock using OIDC — no long-lived API keys required.
|
||||
|
||||
name: Claude Code
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
pull_request_review_comment:
|
||||
types: [created]
|
||||
issues:
|
||||
types: [opened, assigned]
|
||||
pull_request_review:
|
||||
types: [submitted]
|
||||
|
||||
jobs:
|
||||
claude:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
if: |
|
||||
github.repository_owner == 'systemd' &&
|
||||
((github.event_name == 'issue_comment' &&
|
||||
contains(github.event.comment.body, '@claude') &&
|
||||
contains(fromJSON('["MEMBER","OWNER","COLLABORATOR"]'), github.event.comment.author_association)) ||
|
||||
(github.event_name == 'pull_request_review_comment' &&
|
||||
contains(github.event.comment.body, '@claude') &&
|
||||
contains(fromJSON('["MEMBER","OWNER","COLLABORATOR"]'), github.event.comment.author_association)) ||
|
||||
(github.event_name == 'pull_request_review' &&
|
||||
contains(github.event.review.body, '@claude') &&
|
||||
contains(fromJSON('["MEMBER","OWNER","COLLABORATOR"]'), github.event.review.author_association)) ||
|
||||
(github.event_name == 'issues' &&
|
||||
github.event.action == 'assigned' &&
|
||||
github.event.assignee.login == 'claude'))
|
||||
|
||||
permissions:
|
||||
contents: read # Read repository contents
|
||||
issues: write # Post comments on issues
|
||||
pull-requests: write # Post comments and reviews on PRs
|
||||
id-token: write # Authenticate with AWS via OIDC
|
||||
actions: read # Access workflow run metadata
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Configure AWS credentials
|
||||
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_ROLE_NAME }}
|
||||
role-session-name: GitHubActions-Claude-${{ github.run_id }}
|
||||
aws-region: us-east-1
|
||||
|
||||
- name: Run Claude Code
|
||||
uses: anthropics/claude-code-action@1fc90f3ed982521116d8ff6d85b948c9b12cae3e
|
||||
with:
|
||||
use_bedrock: "true"
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
claude_args: |
|
||||
--model us.anthropic.claude-opus-4-6-v1
|
||||
Reference in New Issue
Block a user