Sync actions from atomicqms-style deployment
Actions synced: Synced at: 2025-12-27T16:24:04Z
This commit is contained in:
221
claude-code-gitea-action-slim/action.yml
Normal file
221
claude-code-gitea-action-slim/action.yml
Normal file
@@ -0,0 +1,221 @@
|
||||
name: "Claude Code Action Slim"
|
||||
description: "Simplified Claude agent for Gitea PRs and issues. Runs Claude directly without base-action wrapper."
|
||||
branding:
|
||||
icon: "at-sign"
|
||||
color: "orange"
|
||||
|
||||
inputs:
|
||||
trigger_phrase:
|
||||
description: "The trigger phrase to look for in comments or issue body"
|
||||
required: false
|
||||
default: "@claude"
|
||||
assignee_trigger:
|
||||
description: "The assignee username that triggers the action"
|
||||
required: false
|
||||
label_trigger:
|
||||
description: "The label that triggers the action"
|
||||
required: false
|
||||
default: "claude"
|
||||
branch_prefix:
|
||||
description: "The prefix to use for Claude branches"
|
||||
required: false
|
||||
default: "claude/"
|
||||
mode:
|
||||
description: "Execution mode: 'tag' (default) or 'agent'"
|
||||
required: false
|
||||
default: "tag"
|
||||
base_branch:
|
||||
description: "The branch to use as base when creating new branches"
|
||||
required: false
|
||||
|
||||
# Claude Code configuration
|
||||
model:
|
||||
description: "Model to use"
|
||||
required: false
|
||||
allowed_tools:
|
||||
description: "Additional tools for Claude to use"
|
||||
required: false
|
||||
default: ""
|
||||
disallowed_tools:
|
||||
description: "Tools that Claude should never use"
|
||||
required: false
|
||||
default: ""
|
||||
custom_instructions:
|
||||
description: "Additional custom instructions for Claude"
|
||||
required: false
|
||||
default: ""
|
||||
direct_prompt:
|
||||
description: "Direct instruction for Claude (bypasses trigger detection)"
|
||||
required: false
|
||||
default: ""
|
||||
max_turns:
|
||||
description: "Maximum number of conversation turns"
|
||||
required: false
|
||||
default: ""
|
||||
timeout_minutes:
|
||||
description: "Timeout in minutes for execution"
|
||||
required: false
|
||||
default: "30"
|
||||
|
||||
# Auth configuration
|
||||
anthropic_api_key:
|
||||
description: "Anthropic API key"
|
||||
required: false
|
||||
claude_code_oauth_token:
|
||||
description: "Claude Code OAuth token (alternative to anthropic_api_key)"
|
||||
required: false
|
||||
default: ""
|
||||
gitea_token:
|
||||
description: "Gitea token with repo and pull request permissions"
|
||||
required: false
|
||||
|
||||
# Git configuration
|
||||
claude_git_name:
|
||||
description: "Git user.name for commits made by Claude"
|
||||
required: false
|
||||
default: "Claude"
|
||||
claude_git_email:
|
||||
description: "Git user.email for commits made by Claude"
|
||||
required: false
|
||||
default: "claude@anthropic.com"
|
||||
|
||||
outputs:
|
||||
execution_file:
|
||||
description: "Path to the Claude Code execution output file"
|
||||
value: ${{ steps.run-claude.outputs.execution_file }}
|
||||
conclusion:
|
||||
description: "Execution status ('success' or 'failure')"
|
||||
value: ${{ steps.run-claude.outputs.conclusion }}
|
||||
branch_name:
|
||||
description: "The branch created by Claude Code"
|
||||
value: ${{ steps.prepare.outputs.CLAUDE_BRANCH }}
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
# Step 1: Check if Bun is pre-installed (e.g., in custom container)
|
||||
- name: Check for pre-installed Bun
|
||||
id: check-bun
|
||||
shell: bash
|
||||
run: |
|
||||
if command -v bun &> /dev/null; then
|
||||
echo "bun_installed=true" >> $GITHUB_OUTPUT
|
||||
echo "Bun is already installed: $(bun --version)"
|
||||
else
|
||||
echo "bun_installed=false" >> $GITHUB_OUTPUT
|
||||
echo "Bun not found, will install"
|
||||
fi
|
||||
|
||||
# Step 2: Install Bun only if not present
|
||||
- name: Install Bun
|
||||
if: steps.check-bun.outputs.bun_installed == 'false'
|
||||
uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76
|
||||
with:
|
||||
bun-version: 1.2.11
|
||||
|
||||
# Step 3: Install action dependencies
|
||||
- name: Install Dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
cd ${{ github.action_path }}
|
||||
bun install
|
||||
|
||||
# Step 4: Prepare action (check triggers, create comment, setup branch)
|
||||
- name: Prepare action
|
||||
id: prepare
|
||||
shell: bash
|
||||
run: |
|
||||
bun run ${{ github.action_path }}/src/entrypoints/prepare.ts
|
||||
env:
|
||||
MODE: ${{ inputs.mode }}
|
||||
TRIGGER_PHRASE: ${{ inputs.trigger_phrase }}
|
||||
ASSIGNEE_TRIGGER: ${{ inputs.assignee_trigger }}
|
||||
LABEL_TRIGGER: ${{ inputs.label_trigger }}
|
||||
BASE_BRANCH: ${{ inputs.base_branch }}
|
||||
BRANCH_PREFIX: ${{ inputs.branch_prefix }}
|
||||
ALLOWED_TOOLS: ${{ inputs.allowed_tools }}
|
||||
DISALLOWED_TOOLS: ${{ inputs.disallowed_tools }}
|
||||
CUSTOM_INSTRUCTIONS: ${{ inputs.custom_instructions }}
|
||||
DIRECT_PROMPT: ${{ inputs.direct_prompt }}
|
||||
OVERRIDE_GITHUB_TOKEN: ${{ inputs.gitea_token }}
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
GITHUB_RUN_ID: ${{ github.run_id }}
|
||||
GITEA_API_URL: ${{ env.GITHUB_SERVER_URL }}
|
||||
ANTHROPIC_API_KEY: ${{ inputs.anthropic_api_key }}
|
||||
|
||||
# Step 5: Check if Claude is pre-installed
|
||||
- name: Check for pre-installed Claude
|
||||
id: check-claude
|
||||
if: steps.prepare.outputs.contains_trigger == 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
if command -v claude &> /dev/null; then
|
||||
echo "claude_installed=true" >> $GITHUB_OUTPUT
|
||||
echo "Claude is already installed: $(claude --version)"
|
||||
else
|
||||
echo "claude_installed=false" >> $GITHUB_OUTPUT
|
||||
echo "Claude not found, will install"
|
||||
fi
|
||||
|
||||
# Step 6: Install Claude Code only if not present
|
||||
- name: Install Claude Code
|
||||
if: steps.prepare.outputs.contains_trigger == 'true' && steps.check-claude.outputs.claude_installed == 'false'
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Installing Claude Code..."
|
||||
npm install -g @anthropic-ai/claude-code@latest
|
||||
|
||||
# Step 7: Run Claude Code directly (no base-action wrapper)
|
||||
- name: Run Claude Code
|
||||
id: run-claude
|
||||
if: steps.prepare.outputs.contains_trigger == 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
bun run ${{ github.action_path }}/src/entrypoints/run-claude.ts
|
||||
env:
|
||||
# Prompt configuration
|
||||
PROMPT_FILE: ${{ runner.temp }}/claude-prompts/claude-prompt.txt
|
||||
ALLOWED_TOOLS: ${{ env.ALLOWED_TOOLS }}
|
||||
DISALLOWED_TOOLS: ${{ env.DISALLOWED_TOOLS }}
|
||||
MAX_TURNS: ${{ inputs.max_turns }}
|
||||
TIMEOUT_MINUTES: ${{ inputs.timeout_minutes }}
|
||||
|
||||
# Model configuration
|
||||
ANTHROPIC_MODEL: ${{ inputs.model }}
|
||||
MCP_CONFIG: ${{ steps.prepare.outputs.mcp_config }}
|
||||
|
||||
# Auth
|
||||
ANTHROPIC_API_KEY: ${{ inputs.anthropic_api_key || env.ANTHROPIC_API_KEY }}
|
||||
CLAUDE_CODE_OAUTH_TOKEN: ${{ inputs.claude_code_oauth_token || env.CLAUDE_CODE_OAUTH_TOKEN }}
|
||||
|
||||
# GitHub/Gitea
|
||||
GITHUB_TOKEN: ${{ steps.prepare.outputs.GITHUB_TOKEN }}
|
||||
GITEA_API_URL: ${{ env.GITHUB_SERVER_URL }}
|
||||
|
||||
# Git configuration
|
||||
CLAUDE_GIT_NAME: ${{ inputs.claude_git_name }}
|
||||
CLAUDE_GIT_EMAIL: ${{ inputs.claude_git_email }}
|
||||
|
||||
# Step 8: Update comment with job link
|
||||
- name: Update comment with job link
|
||||
if: steps.prepare.outputs.contains_trigger == 'true' && steps.prepare.outputs.claude_comment_id && always()
|
||||
shell: bash
|
||||
run: |
|
||||
bun run ${{ github.action_path }}/src/entrypoints/update-comment-link.ts
|
||||
env:
|
||||
REPOSITORY: ${{ github.repository }}
|
||||
PR_NUMBER: ${{ github.event.issue.number || github.event.pull_request.number }}
|
||||
CLAUDE_COMMENT_ID: ${{ steps.prepare.outputs.claude_comment_id }}
|
||||
GITHUB_RUN_ID: ${{ github.run_id }}
|
||||
GITHUB_TOKEN: ${{ steps.prepare.outputs.GITHUB_TOKEN }}
|
||||
GITHUB_EVENT_NAME: ${{ github.event_name }}
|
||||
TRIGGER_COMMENT_ID: ${{ github.event.comment.id }}
|
||||
CLAUDE_BRANCH: ${{ steps.prepare.outputs.CLAUDE_BRANCH }}
|
||||
IS_PR: ${{ github.event.issue.pull_request != null || github.event_name == 'pull_request_review_comment' }}
|
||||
BASE_BRANCH: ${{ steps.prepare.outputs.BASE_BRANCH }}
|
||||
CLAUDE_SUCCESS: ${{ steps.run-claude.outputs.conclusion == 'success' }}
|
||||
OUTPUT_FILE: ${{ steps.run-claude.outputs.execution_file || '' }}
|
||||
TRIGGER_USERNAME: ${{ github.event.comment.user.login || github.event.issue.user.login || github.event.pull_request.user.login || github.event.sender.login || github.triggering_actor || github.actor || '' }}
|
||||
PREPARE_SUCCESS: ${{ steps.prepare.outcome == 'success' }}
|
||||
PREPARE_ERROR: ${{ steps.prepare.outputs.prepare_error || '' }}
|
||||
GITEA_API_URL: ${{ env.GITHUB_SERVER_URL }}
|
||||
Reference in New Lab Ticket
Block a user