Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2216095

Browse files
docs: add GitHub Actions integration for AI agents
Adds comprehensive documentation for the start-workspace-action GitHub Actionthat enables automatic workspace creation from GitHub issues and comments.- Created docs/ai-coder/github-actions.md with usage examples and configuration- Updated manifest.json to include new documentation in navigation- Added GitHub Actions section to ai-coder/index.md for discoverabilityCo-authored-by: kylecarbs <7122116+kylecarbs@users.noreply.github.com>
1 parent78af5e0 commit2216095

File tree

3 files changed

+196
-0
lines changed

3 files changed

+196
-0
lines changed

‎docs/ai-coder/github-actions.md

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
#GitHub Actions Integration
2+
3+
Coder provides a GitHub Action that automatically starts workspaces from GitHub issues and comments, enabling seamless integration between your development workflow and AI coding agents.
4+
5+
##Start Workspace Action
6+
7+
The[start-workspace-action](https://github.com/coder/start-workspace-action) creates Coder workspaces triggered by GitHub events and posts status updates directly to GitHub issues.
8+
9+
###Features
10+
11+
-**Automatic workspace creation** from GitHub issues or comments
12+
-**Real-time status updates** posted as GitHub issue comments
13+
-**User mapping** between GitHub and Coder accounts
14+
-**Configurable triggers** based on your workflow requirements
15+
-**Template parameters** for customizing workspace environments
16+
17+
###Basic Usage
18+
19+
Here's an example workflow that starts a workspace when issues are created or when comments contain "@coder":
20+
21+
```yaml
22+
name:Start Workspace On Issue Creation or Comment
23+
24+
on:
25+
issues:
26+
types:[opened]
27+
issue_comment:
28+
types:[created]
29+
30+
permissions:
31+
issues:write
32+
33+
jobs:
34+
start-workspace:
35+
runs-on:ubuntu-latest
36+
if:>
37+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@coder')) ||
38+
(github.event_name == 'issues' && contains(github.event.issue.body, '@coder'))
39+
environment:coder-production
40+
timeout-minutes:5
41+
steps:
42+
-name:Start Coder workspace
43+
uses:coder/start-workspace-action@v0.1.0
44+
with:
45+
github-token:${{ secrets.GITHUB_TOKEN }}
46+
github-username:>
47+
${{
48+
(github.event_name == 'issue_comment' && github.event.comment.user.login) ||
49+
(github.event_name == 'issues' && github.event.issue.user.login)
50+
}}
51+
coder-url:${{ secrets.CODER_URL }}
52+
coder-token:${{ secrets.CODER_TOKEN }}
53+
template-name:${{ secrets.CODER_TEMPLATE_NAME }}
54+
parameters:|-
55+
Coder Image: codercom/oss-dogfood:latest
56+
Coder Repository Base Directory: "~"
57+
AI Code Prompt: "Use the gh CLI tool to read the details of issue https://github.com/${{ github.repository }}/issues/${{ github.event.issue.number }} and then address it."
58+
Region: us-pittsburgh
59+
```
60+
61+
### Configuration
62+
63+
#### Required Inputs
64+
65+
| Input | Description |
66+
|-------|-------------|
67+
|`coder-url` | Your Coder deployment URL |
68+
| `coder-token` | API token for Coder (requires admin privileges) |
69+
| `template-name` | Name of the Coder template to use |
70+
| `parameters` | YAML-formatted parameters for the workspace |
71+
72+
#### Optional Inputs
73+
74+
| Input | Description | Default |
75+
|-------|-------------|----------|
76+
| `github-token` | GitHub token for posting comments | `${{ github.token }}` |
77+
| `github-issue-number` | Issue number for status comments | Current issue from context |
78+
| `github-username` | GitHub user to map to Coder user | - |
79+
| `coder-username` | Coder username (alternative to github-username) | - |
80+
| `workspace-name` | Name for the new workspace | `issue-{issue_number}` |
81+
82+
### User Mapping
83+
84+
The action supports two methods for mapping users:
85+
86+
1. **GitHub Username Mapping** (Coder 2.21+):Set `github-username` to automatically map GitHub users to Coder users who have logged in with the same GitHub account.
87+
88+
2. **Direct Coder Username**:Set `coder-username` to specify the exact Coder user.
89+
90+
### Security Best Practices
91+
92+
Since this action requires a Coder admin API token, follow these security recommendations:
93+
94+
1. **Use GitHub Environments**:Store sensitive secrets in a GitHub environment (e.g., "coder-production")
95+
2. **Restrict Branch Access**:Limit the environment to specific branches (e.g., main)
96+
3. **Minimal Permissions**:Use the least privileged token possible
97+
98+
```yaml
99+
jobs:
100+
start-workspace:
101+
runs-on: ubuntu-latest
102+
# Restrict access to secrets using environments
103+
environment: coder-production
104+
steps:
105+
- name: Start Coder workspace
106+
uses: coder/start-workspace-action@v0.1.0
107+
with:
108+
coder-token: ${{ secrets.CODER_TOKEN }}
109+
# other inputs...
110+
```
111+
112+
### AI Agent Integration
113+
114+
This action works particularly well with AI coding agents by:
115+
116+
- **Providing context**: Pass issue details to agents via template parameters
117+
- **Automating setup**: Pre-configure workspaces with necessary tools and repositories
118+
- **Enabling collaboration**: Allow agents to work on issues triggered by team members
119+
120+
#### Example AI Agent Prompt
121+
122+
```yaml
123+
parameters: |-
124+
AI Code Prompt: |
125+
You are an AI coding assistant. Your task is to:
126+
1. Read the GitHub issue at https://github.com/${{ github.repository }}/issues/${{ github.event.issue.number }}
127+
2. Analyze the requirements and existing codebase
128+
3. Implement the requested changes
129+
4. Run tests to ensure functionality
130+
5. Create a pull request with your solution
131+
```
132+
133+
### Workflow Examples
134+
135+
#### Issue-Triggered Workspaces
136+
137+
```yaml
138+
on:
139+
issues:
140+
types: [opened, labeled]
141+
142+
jobs:
143+
start-workspace:
144+
if: contains(github.event.issue.labels.*.name, 'ai-assist')
145+
# ... rest of configuration
146+
```
147+
148+
#### Comment-Triggered Workspaces
149+
150+
```yaml
151+
on:
152+
issue_comment:
153+
types: [created]
154+
155+
jobs:
156+
start-workspace:
157+
if: |
158+
github.event.issue.pull_request == null &&
159+
contains(github.event.comment.body, '/coder start')
160+
# ... rest of configuration
161+
```
162+
163+
### Requirements
164+
165+
-Coder deployment with API access
166+
-Coder 2.21+ for GitHub username mapping (earlier versions can use `coder-username`)
167+
-GitHub repository with appropriate secrets configured
168+
-Coder template configured for AI agent workflows
169+
170+
### Troubleshooting
171+
172+
#### Common Issues
173+
174+
- **Authentication failures**: Ensure `CODER_TOKEN` has admin privileges
175+
- **User mapping errors**: Verify GitHub users have logged into Coder with the same account
176+
- **Template not found**: Check that `template-name` exists and is accessible
177+
- **Parameter validation**: Ensure template parameters match expected format
178+
179+
#### GitHub Enterprise
180+
181+
This action supports GitHub Enterprise with the exception of the `github-username` input. Use `coder-username` instead for GitHub Enterprise deployments.
182+
183+
## Next Steps
184+
185+
-[Configure Coder Tasks](./tasks.md) for running AI agents
186+
-[Set up custom agents](./custom-agents.md) in your templates
187+
-[Review security considerations](./security.md) for AI agent deployments

‎docs/ai-coder/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ Coder [integrates with IDEs](../user-guides/workspace-access/index.md) such as C
88

99
These agents work well inside existing Coder workspaces as they can simply be enabled via an extension or are built-into the editor.
1010

11+
##GitHub Actions Integration
12+
13+
Coder provides a[GitHub Action](./github-actions.md) that automatically starts workspaces from GitHub issues and comments, enabling seamless integration between your development workflow and AI coding agents. This is particularly useful for automated code reviews, issue resolution, and collaborative development with AI agents.
14+
1115
##Agents with Coder Tasks (Beta)
1216

1317
In cases where the IDE is secondary, such as protyping or long-running background jobs, agents like Claude Code or Aider are better for the job and new SaaS interfaces like[Devin](https://devin.ai) and[ChatGPT Codex](https://openai.com/index/introducing-codex/) are emerging.

‎docs/manifest.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,11 @@
833833
"description":"Run IDE agents with Coder",
834834
"path":"./ai-coder/ide-agents.md"
835835
},
836+
{
837+
"title":"GitHub Actions",
838+
"description":"Integrate AI agents with GitHub workflows",
839+
"path":"./ai-coder/github-actions.md"
840+
},
836841
{
837842
"title":"Coder Tasks",
838843
"description":"Run Coding Agents on your Own Infrastructure",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp