Skip to content

zaks-io/claude-code-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Claude Code Reusable Workflows

Reusable GitHub Actions workflows for integrating Claude Code into your repositories.

Workflows

Workflow Description
claude.yml General-purpose Claude Code agent for issue/PR comments
issue-triage.yml Automated issue triage with Linear integration
code-review.yml Code review (manual /review or automatic on PR open)

Prerequisites

Required Secrets

Set these secrets in your repository or organization:

Secret Required Description
CLAUDE_CODE_OAUTH_TOKEN Yes Claude Code OAuth token
LINEAR_API_KEY No Required only if using Linear integration

Note: GITHUB_TOKEN is automatically available in all workflows - no need to pass it.

Repository Access (Private Repos)

If this repository is private, enable access for other repositories:

  1. Go to Settings > Actions > General
  2. Under "Access", select "Accessible from repositories in the organization"
  3. Choose which repositories can access these workflows

Quick Start

Basic Setup

Create .github/workflows/claude.yml in your repository:

name: Claude Code

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

jobs:
  claude:
    uses: zaks-io/claude-code-action/.github/workflows/claude.yml@main
    secrets:
      claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}

With Linear Issue Triage (Repository Dispatch)

Trigger issue triage from Linear webhooks via repository dispatch:

name: Linear Issue Triage

on:
  repository_dispatch:
    types: [linear-triage]

jobs:
  triage:
    uses: zaks-io/claude-code-action/.github/workflows/issue-triage.yml@main
    secrets:
      claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
      linear_api_token: ${{ secrets.LINEAR_API_KEY }}

To trigger, send a POST request to GitHub's repository dispatch API:

curl -X POST \
  -H "Authorization: token $GITHUB_TOKEN" \
  -H "Accept: application/vnd.github.v3+json" \
  https://api.github.com/repos/OWNER/REPO/dispatches \
  -d '{
    "event_type": "linear-triage",
    "client_payload": {
      "issue_id": "PROJ-123",
      "url": "https://linear.app/team/issue/PROJ-123",
      "title": "Issue title"
    }
  }'

With Manual Code Review

Triggered by /review comment on a PR:

name: Claude Code

on:
  issue_comment:
    types: [created]

jobs:
  review:
    if: |
      github.event.issue.pull_request &&
      contains(github.event.comment.body, '/review')
    uses: zaks-io/claude-code-action/.github/workflows/code-review.yml@main
    secrets:
      claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}

With Automatic Code Review

Triggered automatically on PR open/ready (use in CI pipeline):

name: CI

on:
  pull_request:
    types: [opened, ready_for_review]

jobs:
  # ... your other CI jobs ...

  code-review:
    needs: [lint, test, build]
    if: |
      github.event.pull_request.draft == false &&
      github.event.pull_request.auto_merge == null
    uses: zaks-io/claude-code-action/.github/workflows/code-review.yml@main
    with:
      trigger_type: auto
    secrets:
      claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}

Workflow Reference

claude.yml

General-purpose Claude Code agent for responding to comments.

Inputs

Input Type Default Description
allowed_tools string Edit,Write,Read,Glob,Grep,LS,Bash(git:*),Bash(bun:*),Bash(npm:*),Bash(npx:*),Bash(gh:*) Comma-separated list of allowed tools
prompt string '' Custom prompt to append

Secrets

Secret Required Description
claude_code_oauth_token Yes Claude Code OAuth token

Permissions

permissions:
  contents: write
  pull-requests: write
  issues: write
  id-token: write
  actions: read

issue-triage.yml

Automated Linear issue triage via repository dispatch.

Triggers

  • repository_dispatch with type linear-triage
  • workflow_call for reusable workflow usage

Inputs

Input Type Default Description
allowed_tools string Read,Grep,Glob,LS,Bash(gh issue:*),Bash(gh label:*),mcp__linear__* Comma-separated list of tools
prompt string '' Custom prompt (overrides default)

Repository Dispatch Payload

Field Required Description
issue_id Yes Linear issue ID (e.g., PROJ-123)
url Yes Linear issue URL
title Yes Linear issue title
prompt No Custom prompt override

Secrets

Secret Required Description
claude_code_oauth_token Yes Claude Code OAuth token
linear_api_token Yes Linear API token

Permissions

permissions:
  contents: read
  pull-requests: read
  issues: write
  id-token: write

Default Behavior

When no custom prompt is provided, the workflow:

  1. Fetches full issue details from Linear via MCP
  2. Researches related code in the repository
  3. Updates the Linear ticket with analysis (files involved, complexity, implementation suggestions)
  4. Moves the ticket from Triage to the appropriate status

code-review.yml

Code review workflow supporting both manual (/review comment) and automatic (PR open) triggers.

Inputs

Input Type Default Description
trigger_type string comment comment for /review command, auto for PR open/ready
allowed_tools string mcp__github_inline_comment__create_inline_comment,Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr comment:*) Comma-separated list of allowed tools
prompt string '' Custom prompt (overrides default)

Secrets

Secret Required Description
claude_code_oauth_token Yes Claude Code OAuth token

Permissions

permissions:
  contents: read
  pull-requests: write
  checks: write
  id-token: write
  actions: read

Default Behavior

When no custom prompt is provided, the review is diff-focused and flags only:

  • Bugs and logic errors
  • Security issues (injection, auth, secrets, unsafe input handling)
  • Broken or missing error handling
  • Test gaps for the changed code

Comments are posted inline on specific lines via mcp__github_inline_comment__create_inline_comment, with a single top-level summary. Nitpicks, style, and praise are skipped.

When trigger_type: comment (default):

  • Creates a "Code Review" check run
  • Reacts with πŸ‘€ emoji on start
  • Gathers PR context (workflow runs, check runs)
  • Reacts with πŸš€ (success) or πŸ˜• (failure)

When trigger_type: auto:

  • Runs a streamlined review without comment reactions or check runs

Complete Example

A full workflow using all three reusable workflows:

name: Claude Code

on:
  issue_comment:
    types: [created]
  pull_request_review_comment:
    types: [created]
  pull_request_review:
    types: [submitted]
  repository_dispatch:
    types: [linear-triage]

jobs:
  # General Claude agent for comments
  claude:
    if: |
      github.event_name != 'repository_dispatch' &&
      !contains(github.event.comment.body, '/review')
    uses: zaks-io/claude-code-action/.github/workflows/claude.yml@main
    secrets:
      claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}

  # Issue triage via repository dispatch (triggered by Linear webhook)
  triage:
    if: github.event_name == 'repository_dispatch'
    uses: zaks-io/claude-code-action/.github/workflows/issue-triage.yml@main
    secrets:
      claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
      linear_api_token: ${{ secrets.LINEAR_API_KEY }}

  # Manual code review via /review comment
  review:
    if: |
      github.event_name == 'issue_comment' &&
      github.event.issue.pull_request &&
      contains(github.event.comment.body, '/review')
    uses: zaks-io/claude-code-action/.github/workflows/code-review.yml@main
    secrets:
      claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}

Custom Prompts

All workflows support custom prompts to override default behavior:

jobs:
  triage:
    uses: zaks-io/claude-code-action/.github/workflows/issue-triage.yml@main
    with:
      prompt: |
        You are a helpful assistant. Analyze this issue and:
        1. Categorize it as bug, feature, or question
        2. Suggest relevant labels
        3. Estimate complexity (S/M/L)
    secrets:
      claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
      linear_api_token: ${{ secrets.LINEAR_API_KEY }}

Development

Setup

Install pre-commit hooks:

pip install pre-commit
pre-commit install

Formatting

Format files manually:

npx prettier --write "**/*.{yml,yaml,md}"

Linting

Run actionlint locally:

actionlint

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors