Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/claude.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Claude Code

on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]

jobs:
check-team-membership:
runs-on: ubuntu-latest
outputs:
is-team-member: ${{ steps.check-membership.outputs.is-member }}
steps:
- name: Check team membership
id: check-membership
uses: actions/github-script@v7
with:
script: |
try {
const { data } = await github.rest.teams.getMembershipForUserInOrg({
org: 'diffplug',
team_slug: 'spotless',
username: github.event.sender.login
});
console.log(`User ${github.event.sender.login} membership status: ${data.state}`);
return data.state === 'active';
} catch (error) {
console.log(`User ${github.event.sender.login} is not a member of the Spotless team`);
return false;
}

claude:
needs: check-team-membership
if: |
needs.check-team-membership.outputs.is-team-member == 'true' &&
(
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
)
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@beta
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}

Loading