-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (121 loc) · 5 KB
/
claude-orchestrator.yml
File metadata and controls
124 lines (121 loc) · 5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
---
# Claude Orchestrator Workflow (Reusable)
#
# PURPOSE: This workflow orchestrates Claude AI interactions by providing
# a simple, reliable interface to the claude-executor. Consumer repositories
# handle their own webhook triggers and call this workflow.
#
# WHY: The original orchestrator design was flawed because workflow_call
# loses the original event context. This version is a lightweight wrapper
# that works reliably as a reusable workflow.
#
# ARCHITECTURE: Consumer repositories handle webhook events and conditional
# logic, then call this workflow with the appropriate trigger mode and configuration.
#
# USAGE: This is a reusable workflow that can be called from any repository
# with repository-specific configurations.
name: Claude Orchestrator (Reusable)
on:
workflow_call:
inputs:
trigger_mode:
description: 'Trigger mode: interactive or automatic'
required: true
type: string
prompt:
description: 'Direct prompt for automatic mode'
required: false
type: string
claude_args:
description: 'Claude CLI arguments (e.g. --allowedTools "Bash(git status),Bash(git diff)")'
required: false
type: string
default: '--allowedTools "Bash(git status),Bash(git diff)"'
timeout_minutes:
description: 'Timeout in minutes for Claude execution'
required: false
type: number
default: 15
runner:
description: 'GitHub runner to use'
required: false
type: string
default: 'ubuntu-latest'
enable_mention_detection:
description: 'Enable automatic @claude mention detection for interactive mode'
required: false
type: boolean
default: true
skip_automatic_when_mentioned:
description: 'Skip automatic mode when PR title/body contains @claude mention'
required: false
type: boolean
default: true
custom_trigger_condition:
description: 'Custom condition to override default mention detection (optional)'
required: false
type: string
secrets:
ANTHROPIC_API_KEY:
required: true
jobs:
claude-execution:
# Only run if custom condition is provided OR default mention detection is enabled and mentions are found
if: |
inputs.custom_trigger_condition != '' || (
inputs.enable_mention_detection == true && inputs.trigger_mode == 'interactive' && (
(github.event_name == 'issue_comment' && (
contains(github.event.comment.body, '@claude') ||
contains(github.event.comment.body, '@Claude') ||
contains(github.event.comment.body, '@CLAUDE')
)) ||
(github.event_name == 'pull_request_review_comment' && (
contains(github.event.comment.body, '@claude') ||
contains(github.event.comment.body, '@Claude') ||
contains(github.event.comment.body, '@CLAUDE')
)) ||
(github.event_name == 'pull_request_review' && (
contains(github.event.review.body, '@claude') ||
contains(github.event.review.body, '@Claude') ||
contains(github.event.review.body, '@CLAUDE')
)) ||
(github.event_name == 'issues' && (
contains(github.event.issue.body, '@claude') ||
contains(github.event.issue.body, '@Claude') ||
contains(github.event.issue.body, '@CLAUDE') ||
contains(github.event.issue.title, '@claude') ||
contains(github.event.issue.title, '@Claude') ||
contains(github.event.issue.title, '@CLAUDE')
)) ||
(github.event_name == 'pull_request' && (
contains(github.event.pull_request.title, '@claude') ||
contains(github.event.pull_request.title, '@Claude') ||
contains(github.event.pull_request.title, '@CLAUDE') ||
contains(github.event.pull_request.body, '@claude') ||
contains(github.event.pull_request.body, '@Claude') ||
contains(github.event.pull_request.body, '@CLAUDE')
))
)
) || (
inputs.trigger_mode == 'automatic' && (
inputs.skip_automatic_when_mentioned == false || (
github.event_name != 'pull_request' || (
!contains(github.event.pull_request.title, '@claude') &&
!contains(github.event.pull_request.title, '@Claude') &&
!contains(github.event.pull_request.title, '@CLAUDE') &&
!contains(github.event.pull_request.body, '@claude') &&
!contains(github.event.pull_request.body, '@Claude') &&
!contains(github.event.pull_request.body, '@CLAUDE')
)
)
)
)
uses: ./.github/workflows/claude-executor.yml
with:
trigger_mode: ${{ inputs.trigger_mode }}
prompt: ${{ inputs.prompt }}
claude_args: ${{ inputs.claude_args }}
timeout_minutes: ${{ inputs.timeout_minutes }}
runner: ${{ inputs.runner }}
secrets:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}