@@ -29,6 +29,170 @@ permissions:
2929 contents: write
3030` ` `
3131
32+ # ## autosolve
33+
34+ Uses Claude Code to autonomously assess and implement solutions for tasks.
35+ Organized as two composite actions that can be used independently or together,
36+ plus reusable workflows for common integrations.
37+
38+ # ### Actions
39+
40+ **`autosolve/assess`** — Runs Claude in read-only mode to evaluate whether a
41+ task is suitable for automated resolution.
42+
43+ ` ` ` yaml
44+ - uses: cockroachdb/actions/autosolve/assess@v1
45+ id: assess
46+ with:
47+ prompt: "Fix the login bug described in issue #42"
48+ ` ` `
49+
50+ | Input | Default | Description |
51+ |---|---|---|
52+ | `prompt` | | Task description for Claude to assess |
53+ | `skill` | | Path to a skill/prompt file relative to the repo root |
54+ | `additional_instructions` | | Extra context appended after the task prompt |
55+ | `assessment_criteria` | *(built-in)* | Custom criteria for PROCEED/SKIP decision |
56+ | `model` | `claude-opus-4-6` | Claude model ID |
57+ | `blocked_paths` | `.github/workflows/` | Comma-separated path prefixes that cannot be modified |
58+
59+ | Output | Description |
60+ |---|---|
61+ | `assessment` | `PROCEED` or `SKIP` |
62+ | `summary` | Human-readable assessment reasoning |
63+ | `result` | Full Claude result text |
64+
65+ **`autosolve/implement`** — Runs Claude to implement a solution, validates
66+ changes against blocked paths, pushes to a fork, and creates a PR.
67+
68+ ` ` ` yaml
69+ - uses: cockroachdb/actions/autosolve/implement@v1
70+ if: steps.assess.outputs.assessment == 'PROCEED'
71+ with:
72+ prompt: "Fix the login bug described in issue #42"
73+ fork_owner: my-bot
74+ fork_repo: my-repo
75+ fork_push_token: ${{ secrets.FORK_PUSH_TOKEN }}
76+ pr_create_token: ${{ secrets.PR_CREATE_TOKEN }}
77+ ` ` `
78+
79+ | Input | Default | Description |
80+ |---|---|---|
81+ | `prompt` | | Task description for Claude to implement |
82+ | `skill` | | Path to a skill/prompt file relative to the repo root |
83+ | `additional_instructions` | | Extra instructions appended after the task prompt |
84+ | `allowed_tools` | *(read/write/git tools)* | Claude `--allowedTools` string |
85+ | `model` | `claude-opus-4-6` | Claude model ID |
86+ | `max_retries` | `3` | Maximum implementation attempts |
87+ | `timeout_minutes` | `60` | Maximum wall-clock time |
88+ | `create_pr` | `true` | Whether to create a PR from the changes |
89+ | `pr_base_branch` | *(repo default)* | Base branch for the PR |
90+ | `pr_labels` | `autosolve` | Comma-separated labels to apply |
91+ | `pr_draft` | `true` | Whether to create as a draft PR |
92+ | `pr_title` | *(from commit)* | PR title |
93+ | `pr_body_template` | *(built-in)* | Template with `{{SUMMARY}}`, `{{STATS}}`, `{{BRANCH}}` placeholders |
94+ | `fork_owner` | | GitHub user/org that owns the fork |
95+ | `fork_repo` | | Fork repository name |
96+ | `fork_push_token` | | PAT with push access to the fork |
97+ | `pr_create_token` | | PAT with PR create access on upstream |
98+ | `blocked_paths` | `.github/workflows/` | Comma-separated blocked path prefixes |
99+ | `git_user_name` | `autosolve[bot]` | Git author/committer name |
100+ | `git_user_email` | `autosolve[bot]@users.noreply.github.com` | Git author/committer email |
101+ | `branch_suffix` | *(timestamp)* | Suffix for branch name (`autosolve/<suffix>`) |
102+
103+ | Output | Description |
104+ |---|---|
105+ | `status` | `SUCCESS` or `FAILED` |
106+ | `pr_url` | URL of the created PR |
107+ | `summary` | Human-readable summary |
108+ | `result` | Full Claude result text |
109+ | `branch_name` | Branch pushed to the fork |
110+
111+ # ### Reusable Workflows
112+
113+ **Jira Autosolve** — Composes assess + implement with Jira comments and ticket
114+ transitions. Triggered via `workflow_call`.
115+
116+ ` ` ` yaml
117+ jobs:
118+ solve:
119+ uses: cockroachdb/actions/.github/workflows/jira-autosolve.yml@v1
120+ with:
121+ ticket_id: PROJ-123
122+ title: ${{ needs.parse.outputs.title }}
123+ description: ${{ needs.parse.outputs.description }}
124+ jira_base_url: https://yourcompany.atlassian.net
125+ fork_owner: my-bot
126+ fork_repo: my-repo
127+ secrets:
128+ jira_token: ${{ secrets.JIRA_TOKEN }}
129+ fork_push_token: ${{ secrets.FORK_PUSH_TOKEN }}
130+ pr_create_token: ${{ secrets.PR_CREATE_TOKEN }}
131+ ` ` `
132+
133+ **GitHub Issue Autosolve** — Composes assess + implement with GitHub issue
134+ comments and label management. Triggered via `workflow_call`.
135+
136+ ` ` ` yaml
137+ jobs:
138+ solve:
139+ uses: cockroachdb/actions/.github/workflows/github-issue-autosolve.yml@v1
140+ with:
141+ issue_number: ${{ github.event.issue.number }}
142+ issue_title: ${{ github.event.issue.title }}
143+ issue_body: ${{ github.event.issue.body }}
144+ fork_owner: my-bot
145+ fork_repo: my-repo
146+ secrets:
147+ fork_push_token: ${{ secrets.FORK_PUSH_TOKEN }}
148+ pr_create_token: ${{ secrets.PR_CREATE_TOKEN }}
149+ ` ` `
150+
151+ # ### Authentication
152+
153+ **Reusable workflows** accept `auth_mode` as an input (`vertex`, `bedrock`, or
154+ omit for API key) and handle env var setup internally.
155+
156+ **Direct composite action usage** requires the caller to set up auth and pass
157+ the env vars on each action step :
158+
159+ ` ` ` yaml
160+ # Example: Vertex AI auth for direct action usage
161+ - uses: google-github-actions/auth@v3
162+ with:
163+ project_id: my-project
164+ service_account: [email protected] 165+ workload_identity_provider: projects/.../providers/...
166+
167+ - uses: cockroachdb/actions/autosolve/assess@v1
168+ env:
169+ CLAUDE_CODE_USE_VERTEX: "1"
170+ ANTHROPIC_VERTEX_PROJECT_ID: my-project
171+ CLOUD_ML_REGION: us-east5
172+ with:
173+ prompt: "Fix the bug"
174+ ` ` `
175+
176+ Alternatively, set `ANTHROPIC_API_KEY` in the environment for direct API
177+ access, or configure Bedrock with `CLAUDE_CODE_USE_BEDROCK=1` and `AWS_REGION`.
178+
179+ # ### Caller checkout
180+
181+ When using `workflow_dispatch`, `actions/checkout` defaults to the branch that
182+ triggered the workflow. This can include unrelated commits from that branch in
183+ the autosolve PR. Always check out the PR base branch explicitly :
184+
185+ ` ` ` yaml
186+ - uses: actions/checkout@v5
187+ with:
188+ ref: main # checkout the PR base branch, not the trigger ref
189+ fetch-depth: 0
190+ persist-credentials: false # prevent checkout's credential helper from interfering with fork push
191+ ` ` `
192+
193+ The `issues : [labeled]` trigger doesn't have this problem since it always runs
194+ on the default branch.
195+
32196# # Development
33197
34198Run all tests locally :
0 commit comments