Skip to content

Commit c3e5ff5

Browse files
Add autosolve actions and workflows for automated issue resolution
Add autosolve/assess and autosolve/implement composite actions that use Claude Code to evaluate and fix issues autonomously. Add reusable workflows for GitHub Issues and Jira integration that compose the actions with ticket comments, label management, and transitions. Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
1 parent 1e86469 commit c3e5ff5

20 files changed

Lines changed: 2158 additions & 1 deletion
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
name: GitHub Issue Autosolve
2+
on:
3+
workflow_call:
4+
inputs:
5+
issue_number:
6+
type: string
7+
required: true
8+
issue_title:
9+
type: string
10+
required: true
11+
issue_body:
12+
type: string
13+
required: true
14+
trigger_label:
15+
type: string
16+
required: false
17+
default: "autosolve"
18+
prompt:
19+
type: string
20+
required: false
21+
default: ""
22+
skill:
23+
type: string
24+
required: false
25+
default: ""
26+
additional_instructions:
27+
type: string
28+
required: false
29+
default: ""
30+
allowed_tools:
31+
type: string
32+
required: false
33+
default: ""
34+
model:
35+
type: string
36+
required: false
37+
default: "claude-opus-4-6"
38+
max_retries:
39+
type: string
40+
required: false
41+
default: "3"
42+
auth_mode:
43+
type: string
44+
required: false
45+
default: "vertex"
46+
vertex_project_id:
47+
type: string
48+
required: false
49+
default: ""
50+
vertex_region:
51+
type: string
52+
required: false
53+
default: "us-east5"
54+
vertex_workload_identity_provider:
55+
type: string
56+
required: false
57+
default: ""
58+
vertex_service_account:
59+
type: string
60+
required: false
61+
default: ""
62+
fork_owner:
63+
type: string
64+
required: true
65+
fork_repo:
66+
type: string
67+
required: true
68+
blocked_paths:
69+
type: string
70+
required: false
71+
default: ".github/workflows/"
72+
git_user_name:
73+
type: string
74+
required: false
75+
default: "autosolve[bot]"
76+
git_user_email:
77+
type: string
78+
required: false
79+
default: "autosolve[bot]@users.noreply.github.com"
80+
secrets:
81+
github_token:
82+
required: true
83+
fork_push_token:
84+
required: true
85+
pr_create_token:
86+
required: true
87+
anthropic_api_key:
88+
required: false
89+
outputs:
90+
status:
91+
value: ${{ jobs.solve.outputs.status }}
92+
pr_url:
93+
value: ${{ jobs.solve.outputs.pr_url }}
94+
95+
concurrency:
96+
group: autosolve-issue-${{ inputs.issue_number }}
97+
cancel-in-progress: false
98+
99+
jobs:
100+
solve:
101+
runs-on: ubuntu-latest
102+
timeout-minutes: 120
103+
permissions:
104+
contents: read
105+
id-token: write
106+
outputs:
107+
status: ${{ steps.final_status.outputs.status }}
108+
pr_url: ${{ steps.implement.outputs.pr_url }}
109+
110+
steps:
111+
- uses: actions/checkout@v4
112+
with:
113+
fetch-depth: 0
114+
115+
- name: Authenticate to Google Cloud (Vertex)
116+
if: inputs.auth_mode == 'vertex' && inputs.vertex_workload_identity_provider != ''
117+
uses: google-github-actions/auth@v3
118+
with:
119+
project_id: ${{ inputs.vertex_project_id }}
120+
service_account: ${{ inputs.vertex_service_account }}
121+
workload_identity_provider: ${{ inputs.vertex_workload_identity_provider }}
122+
123+
- name: Build prompt
124+
id: build_prompt
125+
shell: bash
126+
run: ${{ github.workspace }}/autosolve/run_step.sh github_issues build_github_issue_prompt
127+
env:
128+
INPUT_PROMPT: ${{ inputs.prompt }}
129+
ISSUE_NUMBER: ${{ inputs.issue_number }}
130+
ISSUE_TITLE: ${{ inputs.issue_title }}
131+
ISSUE_BODY: ${{ inputs.issue_body }}
132+
133+
- uses: ./autosolve/assess
134+
id: assess
135+
env:
136+
ANTHROPIC_API_KEY: ${{ inputs.auth_mode == 'api_key' && secrets.anthropic_api_key || '' }}
137+
CLAUDE_CODE_USE_VERTEX: ${{ inputs.auth_mode == 'vertex' && '1' || '' }}
138+
ANTHROPIC_VERTEX_PROJECT_ID: ${{ inputs.auth_mode == 'vertex' && inputs.vertex_project_id || '' }}
139+
CLOUD_ML_REGION: ${{ inputs.auth_mode == 'vertex' && inputs.vertex_region || '' }}
140+
CLAUDE_CODE_USE_BEDROCK: ${{ inputs.auth_mode == 'bedrock' && '1' || '' }}
141+
with:
142+
prompt: ${{ steps.build_prompt.outputs.prompt }}
143+
skill: ${{ inputs.skill }}
144+
additional_instructions: ${{ inputs.additional_instructions }}
145+
model: ${{ inputs.model }}
146+
blocked_paths: ${{ inputs.blocked_paths }}
147+
148+
- name: Comment on issue - Skipped
149+
if: steps.assess.outputs.assessment == 'SKIP'
150+
shell: bash
151+
run: ${{ github.workspace }}/autosolve/run_step.sh github_issues comment_on_issue
152+
env:
153+
GITHUB_TOKEN_INPUT: ${{ secrets.github_token }}
154+
ISSUE_NUMBER: ${{ inputs.issue_number }}
155+
COMMENT_TYPE: "skipped"
156+
SUMMARY: ${{ steps.assess.outputs.summary }}
157+
158+
- uses: ./autosolve/implement
159+
id: implement
160+
if: steps.assess.outputs.assessment == 'PROCEED'
161+
env:
162+
ANTHROPIC_API_KEY: ${{ inputs.auth_mode == 'api_key' && secrets.anthropic_api_key || '' }}
163+
CLAUDE_CODE_USE_VERTEX: ${{ inputs.auth_mode == 'vertex' && '1' || '' }}
164+
ANTHROPIC_VERTEX_PROJECT_ID: ${{ inputs.auth_mode == 'vertex' && inputs.vertex_project_id || '' }}
165+
CLOUD_ML_REGION: ${{ inputs.auth_mode == 'vertex' && inputs.vertex_region || '' }}
166+
CLAUDE_CODE_USE_BEDROCK: ${{ inputs.auth_mode == 'bedrock' && '1' || '' }}
167+
with:
168+
prompt: ${{ steps.build_prompt.outputs.prompt }}
169+
skill: ${{ inputs.skill }}
170+
additional_instructions: ${{ inputs.additional_instructions }}
171+
allowed_tools: ${{ inputs.allowed_tools }}
172+
model: ${{ inputs.model }}
173+
max_retries: ${{ inputs.max_retries }}
174+
fork_owner: ${{ inputs.fork_owner }}
175+
fork_repo: ${{ inputs.fork_repo }}
176+
fork_push_token: ${{ secrets.fork_push_token }}
177+
pr_create_token: ${{ secrets.pr_create_token }}
178+
pr_labels: "autosolve"
179+
branch_suffix: "issue-${{ inputs.issue_number }}"
180+
blocked_paths: ${{ inputs.blocked_paths }}
181+
git_user_name: ${{ inputs.git_user_name }}
182+
git_user_email: ${{ inputs.git_user_email }}
183+
184+
- name: Comment on issue - Success
185+
if: steps.implement.outputs.status == 'SUCCESS'
186+
shell: bash
187+
run: ${{ github.workspace }}/autosolve/run_step.sh github_issues comment_on_issue
188+
env:
189+
GITHUB_TOKEN_INPUT: ${{ secrets.github_token }}
190+
ISSUE_NUMBER: ${{ inputs.issue_number }}
191+
COMMENT_TYPE: "success"
192+
PR_URL: ${{ steps.implement.outputs.pr_url }}
193+
194+
- name: Comment on issue - Failed
195+
if: steps.implement.conclusion == 'failure' || steps.implement.outputs.status == 'FAILED'
196+
shell: bash
197+
run: ${{ github.workspace }}/autosolve/run_step.sh github_issues comment_on_issue
198+
env:
199+
GITHUB_TOKEN_INPUT: ${{ secrets.github_token }}
200+
ISSUE_NUMBER: ${{ inputs.issue_number }}
201+
COMMENT_TYPE: "failed"
202+
203+
- name: Remove label
204+
if: always()
205+
shell: bash
206+
run: ${{ github.workspace }}/autosolve/run_step.sh github_issues remove_label
207+
env:
208+
GITHUB_TOKEN_INPUT: ${{ secrets.github_token }}
209+
ISSUE_NUMBER: ${{ inputs.issue_number }}
210+
TRIGGER_LABEL: ${{ inputs.trigger_label }}
211+
212+
- name: Set final status
213+
id: final_status
214+
if: always()
215+
shell: bash
216+
run: ${{ github.workspace }}/autosolve/run_step.sh github_issues set_final_status
217+
env:
218+
ASSESSMENT: ${{ steps.assess.outputs.assessment }}
219+
IMPL_STATUS: ${{ steps.implement.outputs.status }}

0 commit comments

Comments
 (0)