Claude Code #134
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Claude Code | |
on: | |
issue_comment: | |
types: [created] | |
pull_request_review_comment: | |
types: [created] | |
pull_request_review: | |
types: [submitted] | |
issues: | |
types: [opened, assigned] | |
jobs: | |
claude: | |
# Only run if @claude is mentioned in the triggering content | |
# For issues (opened/assigned), checks the issue body or title | |
# For comments/reviews, checks the comment/review body | |
if: contains(github.event.comment.body || github.event.review.body || github.event.issue.body || github.event.issue.title || '', '@claude') | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pull-requests: read | |
issues: read | |
id-token: write | |
steps: | |
- name: Check team membership | |
id: check-membership | |
uses: actions/github-script@v8 | |
with: | |
script: | | |
try { | |
// Get the user who triggered the event | |
const username = context.payload.sender?.login; | |
if (!username) { | |
core.setFailed('Could not determine username from event'); | |
return; | |
} | |
console.log(`Checking if ${username} is a member of diffplug/spotless`); | |
const { data } = await github.rest.teams.getMembershipForUserInOrg({ | |
org: 'diffplug', | |
team_slug: 'spotless', | |
username: username | |
}); | |
if (data.state !== 'active') { | |
core.setFailed(`User ${username} is not an active team member`); | |
} else { | |
console.log(`✓ ${username} is an active team member`); | |
} | |
} catch (error) { | |
// User is not a team member or API error | |
core.setFailed(`Access denied: ${error.message}`); | |
} | |
- name: Checkout repository | |
uses: actions/checkout@v5 | |
with: | |
fetch-depth: 1 | |
- name: Run Claude Code | |
uses: anthropics/claude-code-action@beta | |
with: | |
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} |