You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rename `github-issue-url` to `github-url` (accepts issue or PR URL). Make
the identity inputs optional with mutual exclusion. Add `wait`,
`wait-timeout-seconds`, and `idempotency-key` inputs. Add chat metadata,
PR metadata, and error outputs populated from the chat object the API
already returns.
* `action.yaml`: rename input, new optional inputs, new outputs (including
the `diff-additions` / `diff-deletions` / `diff-changed-files` triple
derived from `diff_status`).
* `src/schemas.ts`: Zod schemas enforce mutual exclusion, the `wait`
enum, and positive-integer coercion of `wait-timeout-seconds`.
* `src/coder-client.ts`: `CoderChatSchema` parses `diff_status`,
`last_error`, `parent_chat_id`, `root_chat_id`, `last_model_config_id`,
and `archived`.
* `src/action.ts`: `parseGithubURL` accepts issues and pull requests;
`warnUnwiredInputs` notifies callers when they opt into an input not
yet wired; `buildOutputs` renders the new outputs and is shared between
the create and existing-chat-id branches with a graceful fallback when
the post-message `getChat` fetch fails.
* `src/outputs.ts` (new): `OUTPUT_MAP` and `setActionOutputs` extracted
from `index.ts` for unit testing.
* `.github/workflows/ci.yaml`: pin `bun-version: 1.3.13` so `dist/`
stays reproducible across runs.
* `README.md`: updated input and output tables.
* `dist/index.js` rebuilt.
Closes CODAGT-283
🤖 Authored by Coder Agents.
This GitHub action creates a [Coder Agent Chat](https://coder.com/docs/ai-coder) and optionally posts a comment on a GitHub issue. It's designed to be used as part of a wider workflow.
3
+
This GitHub action creates a [Coder Agent Chat](https://coder.com/docs/ai-coder) and optionally posts a comment on a GitHub issue or pull request. It's designed to be used as part of a wider workflow.
4
4
5
5
## Overview
6
6
7
-
- When creating a Coder Agent Chat, you must specify either the GitHub user ID or the Coder username as an input.
8
-
- The action then queries the Coder deployment to find the Coder user associated with the given GitHub user ID.
9
-
- Note that this requires the Coder deployment to be configured with [GitHub OAuth](https://coder.com/docs/admin/external-auth#configure-a-github-oauth-app) and for the Coder user to have linked their GitHub account.
10
-
- If no corresponding Coder user is found, the action will fail.
11
-
- The action will then create a [Coder Agent Chat](https://coder.com/docs/ai-coder) with the given prompt.
12
-
- Unlike Tasks, **Agents does not require specifying a template**. Agents auto-provisions a workspace, or you can pass an existing `workspace-id`.
13
-
- Once the chat has been created successfully, the action will post a comment on the GitHub issue with the chat URL.
14
-
- You can also send a follow-up message to an existing chat by providing `existing-chat-id`.
7
+
- Pass a `chat-prompt` and a `github-url` (issue or PR) and the action creates a Coder Agent Chat associated with that GitHub item.
8
+
- The action resolves the Coder user to run as. Either pass `github-user-id` (the action looks up the Coder user with that linked GitHub identity) or pass `coder-username` directly. The two inputs are mutually exclusive.
9
+
- GitHub-id lookup requires the Coder deployment to be configured with [GitHub OAuth](https://coder.com/docs/admin/external-auth#configure-a-github-oauth-app) and for the Coder user to have linked their GitHub account.
10
+
- Unlike Tasks, **Agents does not require specifying a template**. Agents auto-provisions a workspace, or you can pass an existing `workspace-id`.
11
+
- After creation, the action posts a comment on the linked issue or pull request with the chat URL. Disable with `comment-on-issue: false`.
12
+
- Send a follow-up message to an existing chat by providing `existing-chat-id`.
15
13
16
14
## Requirements
17
15
18
16
- A running Coder deployment with Agents enabled (experimental).
19
17
- A Coder session token with the required permissions to:
20
-
- Read all users in the given organization
21
-
- Create chats
18
+
- Read all users in the given organization.
19
+
- Create chats.
22
20
23
21
## Example Usage
24
22
25
-
The below example will start a Coder Agent Chat when the `coder` label is applied to an issue.
23
+
The example below starts a Coder Agent Chat when the `coder` label is applied to an issue.
26
24
27
25
```yaml
28
26
name: Start Coder Agent Chat
@@ -47,7 +45,7 @@ jobs:
47
45
coder-token: ${{ secrets.CODER_TOKEN }}
48
46
chat-prompt: "Read ${{ github.event.issue.html_url }} using gh CLI and write an appropriate plan for solving the issue to PLAN.md, then wait for feedback."
| chat-prompt | Prompt to send to the agent chat. Templated by the workflow before being passed in. | true | - |
88
+
| coder-token | Coder session token used to authenticate with the Coder API. | true | - |
89
+
| coder-url | Coder deployment URL. | true | - |
90
+
| github-url | GitHub issue or pull request URL to link the chat to. Used for the issue/PR comment and as the human-readable association in the chat label. | true | - |
91
+
| github-token | GitHub token used to post and update issue comments. | true | - |
92
+
| github-user-id | GitHub user ID to resolve to a Coder user. Mutually exclusive with coder-username. | false | - |
93
+
| coder-username | Coder username to use directly. Mutually exclusive with github-user-id; useful for service-account workflows. | false | - |
94
+
| coder-organization | Coder organization name. Reserved; not yet wired through to chat creation, the action emits a warning if set. | false | - |
95
+
| workspace-id | Existing workspace ID to pin the chat to. If unset, Agents auto-provisions a workspace. | false | - |
96
+
| model-config-id | Model configuration ID to use for the chat. | false | - |
97
+
| existing-chat-id | Existing chat ID to send a follow-up message to instead of creating a new chat. | false | - |
98
+
| comment-on-issue | Whether to comment on the GitHub issue or pull request with the chat URL and status. | false | true |
99
+
| wait | Wait mode. Reserved: `complete` is intended to poll until terminal status or wait-timeout-seconds, but is not yet wired; the action emits a warning and returns immediately. | false | none |
100
+
| wait-timeout-seconds | Maximum seconds to wait when wait=complete before failing with a timeout. | false | 600 |
101
+
| idempotency-key | Optional key used to deduplicate chats. Reserved; not yet wired, the action emits a warning if set and always creates a new chat. | false | - |
Copy file name to clipboardExpand all lines: action.yaml
+73-20Lines changed: 73 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -7,70 +7,123 @@ branding:
7
7
color: purple
8
8
9
9
inputs:
10
-
# Required inputs
11
10
chat-prompt:
12
-
description: "Prompt/instructions to send to the agent chat"
11
+
description: "Prompt to send to the agent chat. Templated by the workflow before being passed in."
13
12
required: true
14
13
15
14
coder-token:
16
-
description: "Coder session token for authentication"
15
+
description: "Coder session token used to authenticate with the Coder API."
17
16
required: true
18
17
19
18
coder-url:
20
-
description: "Coder deployment URL"
19
+
description: "Coder deployment URL."
21
20
required: true
22
21
23
-
github-issue-url:
24
-
description: "GitHub issue URL to link this chat to"
22
+
github-url:
23
+
description: "GitHub issue or pull request URL to link the chat to. Used for the issue/PR comment and as the human-readable association in the chat label."
25
24
required: true
26
25
27
26
github-token:
28
-
description: "GitHub token for API operations"
27
+
description: "GitHub token used to post and update issue comments."
29
28
required: true
30
29
31
30
github-user-id:
32
-
description: "GitHub user ID to create chat for. If provided, `coder-username` must not be set."
31
+
description: "GitHub user ID to resolve to a Coder user. Mutually exclusive with coder-username."
33
32
required: false
34
33
35
34
coder-username:
36
-
description: "Coder username to create chat for. If provided, github-user-id must not be set. Useful for automated workflows without a triggering user."
35
+
description: "Coder username to use directly. Mutually exclusive with github-user-id; useful for service-account workflows."
37
36
required: false
38
37
39
-
# Optional inputs
40
38
coder-organization:
41
-
description: "Coder organization name"
39
+
description: "Coder organization name. Reserved; not yet wired through to chat creation, the action emits a warning if set."
42
40
required: false
43
-
default: "default"
44
41
45
42
workspace-id:
46
-
description: "Existing workspace ID to use for the chat. If not provided, Agents will auto-provision a workspace."
43
+
description: "Existing workspace ID to pin the chat to. If unset, Agents auto-provisions a workspace."
47
44
required: false
48
45
49
46
model-config-id:
50
-
description: "Model configuration ID to use for the chat (optional)"
47
+
description: "Model configuration ID to use for the chat."
51
48
required: false
52
49
53
50
existing-chat-id:
54
-
description: "Existing chat ID to send a follow-up message to instead of creating a new chat"
51
+
description: "Existing chat ID to send a follow-up message to instead of creating a new chat."
55
52
required: false
56
53
57
54
comment-on-issue:
58
-
description: "Whether to comment on the GitHub issue"
55
+
description: "Whether to comment on the GitHub issue or pull request with the chat URL and status."
59
56
required: false
60
57
default: "true"
61
58
59
+
wait:
60
+
description: "Wait mode. Reserved: 'complete' is intended to poll until the chat reaches a terminal status or wait-timeout-seconds, but is not yet wired; the action emits a warning and returns immediately."
61
+
required: false
62
+
default: "none"
63
+
64
+
wait-timeout-seconds:
65
+
description: "Maximum seconds to wait when wait=complete before failing with a timeout."
66
+
required: false
67
+
default: "600"
68
+
69
+
idempotency-key:
70
+
description: "Optional key used to deduplicate chats. Reserved; not yet wired, the action emits a warning if set and always creates a new chat."
71
+
required: false
72
+
62
73
outputs:
63
74
coder-username:
64
-
description: "The Coder username resolved from GitHub user"
75
+
description: "The Coder username resolved from the GitHub user."
65
76
66
77
chat-id:
67
-
description: "The chat ID"
78
+
description: "The chat ID."
68
79
69
80
chat-url:
70
-
description: "The URL to view the chat in Coder"
81
+
description: "The URL to view the chat in Coder."
71
82
72
83
chat-created:
73
-
description: "Whether the chat was newly created (true) or a message was sent to an existing chat (false)"
84
+
description: "Whether the chat was newly created (true) or a message was sent to an existing chat (false)."
85
+
86
+
chat-status:
87
+
description: "Current chat status (waiting, pending, running, paused, completed, error)."
88
+
89
+
chat-title:
90
+
description: "The chat title."
91
+
92
+
workspace-id:
93
+
description: "The workspace ID the chat is running in (auto-provisioned or provided)."
94
+
95
+
pull-request-url:
96
+
description: "URL of the pull request or branch page when the chat has tracked changes."
97
+
98
+
pull-request-state:
99
+
description: "Pull request state (open, closed, merged) when available."
100
+
101
+
pull-request-title:
102
+
description: "Title of the pull request when available."
103
+
104
+
pull-request-number:
105
+
description: "Pull request number when available."
106
+
107
+
diff-additions:
108
+
description: "Number of lines added in tracked changes."
109
+
110
+
diff-deletions:
111
+
description: "Number of lines deleted in tracked changes."
112
+
113
+
diff-changed-files:
114
+
description: "Number of files changed in tracked changes."
115
+
116
+
head-branch:
117
+
description: "Head branch name when available."
118
+
119
+
base-branch:
120
+
description: "Base branch name when available."
121
+
122
+
chat-error-kind:
123
+
description: "Machine-readable error kind when the chat fails. Reserved; not yet populated."
124
+
125
+
chat-error-message:
126
+
description: "Human-readable error message when the chat fails."
0 commit comments