Skip to content

Commit 670f470

Browse files
author
Frank
committed
wip: github actions
1 parent c2b3c52 commit 670f470

3 files changed

Lines changed: 36 additions & 20 deletions

File tree

github/README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,27 @@ Mention `/opencode` in your comment, and opencode will execute tasks within your
66

77
## Features
88

9-
#### Triage and explain issues
9+
#### Explain an issues
1010

11-
```bash
11+
Leave the following comment on a GitHub issue. `opencode` will read the entire thread, including all comments, and reply with a clear explanation.
12+
13+
```
1214
/opencode explain this issue
1315
```
1416

15-
#### Fix or implement issues - opencode will create a PR with the changes.
17+
#### Fix an issues
1618

17-
```bash
19+
Leave the following comment on a GitHub issue. opencode will create a new branch, implement the changes, and open a PR with the changes.
20+
21+
```
1822
/opencode fix this
1923
```
2024

2125
#### Review PRs and make changes
2226

23-
```bash
27+
Leave the following comment on a GitHub PR. opencode will implement the requested change and commit it to the same PR.
28+
29+
```
2430
Delete the attachment from S3 when the note is removed /oc
2531
```
2632

packages/opencode/src/cli/cmd/github.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -156,21 +156,23 @@ export const GithubInstallCommand = cmd({
156156
step2 =
157157
"Configure OIDC in AWS - https://docs.github.com/en/actions/how-tos/security-for-github-actions/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services"
158158
} else {
159-
const url = `https://github.com/organizations/${app.owner}/settings/secrets/actions`
160-
const env = providers[provider].env
161-
const envStr =
162-
env.length === 1
163-
? `\`${env[0]}\` secret`
164-
: `\`${[env.slice(0, -1).join("\`, \`"), ...env.slice(-1)].join("\` and \`")}\` secrets`
165-
step2 = `Add ${envStr} for ${providers[provider].name} - ${url}`
159+
step2 = [
160+
` 2. Add the following secrets in org or repo (${app.owner}/${app.repo}) settings`,
161+
"",
162+
...providers[provider].env.map((e) => ` - ${e}`),
163+
].join("\n")
166164
}
167165

168166
prompts.outro(
169167
[
170168
"Next steps:",
171-
` 1. Commit "${WORKFLOW_FILE}" file and push`,
172-
` 2. ${step2}`,
173-
" 3. Learn how to use the GitHub agent - https://docs.opencode.ai/docs/github/getting-started",
169+
"",
170+
` 1. Commit the \`${WORKFLOW_FILE}\` file and push`,
171+
step2,
172+
"",
173+
" 3. Go to a GitHub issue and comment `/oc summarize` to see the agent in action",
174+
"",
175+
" Learn more about the GitHub agent - https://opencode.ai/docs/github/#usage-examples",
174176
].join("\n"),
175177
)
176178
}
@@ -320,6 +322,7 @@ jobs:
320322
contains(github.event.comment.body, '/opencode')
321323
runs-on: ubuntu-latest
322324
permissions:
325+
contents: read
323326
id-token: write
324327
steps:
325328
- name: Checkout repository
@@ -457,8 +460,9 @@ export const GithubRunCommand = cmd({
457460
`${response}\n\nCloses #${issueId}${footer({ image: true })}`,
458461
)
459462
await updateComment(`Created PR #${pr}${footer({ image: true })}`)
463+
} else {
464+
await updateComment(`${response}${footer({ image: true })}`)
460465
}
461-
await updateComment(`${response}${footer({ image: true })}`)
462466
}
463467
} catch (e: any) {
464468
exitCode = 1

packages/web/src/content/docs/docs/github.mdx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,24 @@ This will walk you through installing the GitHub app, creating the workflow, and
7777

7878
- Explain an issue
7979

80-
```bash
80+
Leave the following comment on a GitHub issue. `opencode` will read the entire thread, including all comments, and reply with a clear explanation.
81+
82+
```
8183
/opencode explain this issue
8284
```
8385

84-
- Fix an issue - opencode will create a PR with the changes.
86+
- Fix an issue
87+
88+
Leave the following comment on a GitHub issue. opencode will create a new branch, implement the changes, and open a PR with the changes.
8589

86-
```bash
90+
```
8791
/opencode fix this
8892
```
8993

9094
- Review PRs and make changes
9195

92-
```bash
96+
Leave the following comment on a GitHub PR. opencode will implement the requested change and commit it to the same PR.
97+
98+
```
9399
Delete the attachment from S3 when the note is removed /oc
94100
```

0 commit comments

Comments
 (0)