summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFrank <[email protected]>2025-07-26 02:49:05 -0400
committerFrank <[email protected]>2025-07-26 02:49:05 -0400
commit670f470eee195a543a63b44f21b55605844199bd (patch)
tree32bd885a6a0c1e2cb1e184b563aeabe286165d63
parentc2b3c52b766a2a2bfe9b9403049eff081b5f5ef7 (diff)
downloadopencode-670f470eee195a543a63b44f21b55605844199bd.tar.gz
opencode-670f470eee195a543a63b44f21b55605844199bd.zip
wip: github actions
-rw-r--r--github/README.md16
-rw-r--r--packages/opencode/src/cli/cmd/github.ts26
-rw-r--r--packages/web/src/content/docs/docs/github.mdx14
3 files changed, 36 insertions, 20 deletions
diff --git a/github/README.md b/github/README.md
index 22ce463da..47213a309 100644
--- a/github/README.md
+++ b/github/README.md
@@ -6,21 +6,27 @@ Mention `/opencode` in your comment, and opencode will execute tasks within your
## Features
-#### Triage and explain issues
+#### Explain an issues
-```bash
+Leave the following comment on a GitHub issue. `opencode` will read the entire thread, including all comments, and reply with a clear explanation.
+
+```
/opencode explain this issue
```
-#### Fix or implement issues - opencode will create a PR with the changes.
+#### Fix an issues
-```bash
+Leave the following comment on a GitHub issue. opencode will create a new branch, implement the changes, and open a PR with the changes.
+
+```
/opencode fix this
```
#### Review PRs and make changes
-```bash
+Leave the following comment on a GitHub PR. opencode will implement the requested change and commit it to the same PR.
+
+```
Delete the attachment from S3 when the note is removed /oc
```
diff --git a/packages/opencode/src/cli/cmd/github.ts b/packages/opencode/src/cli/cmd/github.ts
index b8ce6582d..e6b871c1f 100644
--- a/packages/opencode/src/cli/cmd/github.ts
+++ b/packages/opencode/src/cli/cmd/github.ts
@@ -156,21 +156,23 @@ export const GithubInstallCommand = cmd({
step2 =
"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"
} else {
- const url = `https://github.com/organizations/${app.owner}/settings/secrets/actions`
- const env = providers[provider].env
- const envStr =
- env.length === 1
- ? `\`${env[0]}\` secret`
- : `\`${[env.slice(0, -1).join("\`, \`"), ...env.slice(-1)].join("\` and \`")}\` secrets`
- step2 = `Add ${envStr} for ${providers[provider].name} - ${url}`
+ step2 = [
+ ` 2. Add the following secrets in org or repo (${app.owner}/${app.repo}) settings`,
+ "",
+ ...providers[provider].env.map((e) => ` - ${e}`),
+ ].join("\n")
}
prompts.outro(
[
"Next steps:",
- ` 1. Commit "${WORKFLOW_FILE}" file and push`,
- ` 2. ${step2}`,
- " 3. Learn how to use the GitHub agent - https://docs.opencode.ai/docs/github/getting-started",
+ "",
+ ` 1. Commit the \`${WORKFLOW_FILE}\` file and push`,
+ step2,
+ "",
+ " 3. Go to a GitHub issue and comment `/oc summarize` to see the agent in action",
+ "",
+ " Learn more about the GitHub agent - https://opencode.ai/docs/github/#usage-examples",
].join("\n"),
)
}
@@ -320,6 +322,7 @@ jobs:
contains(github.event.comment.body, '/opencode')
runs-on: ubuntu-latest
permissions:
+ contents: read
id-token: write
steps:
- name: Checkout repository
@@ -457,8 +460,9 @@ export const GithubRunCommand = cmd({
`${response}\n\nCloses #${issueId}${footer({ image: true })}`,
)
await updateComment(`Created PR #${pr}${footer({ image: true })}`)
+ } else {
+ await updateComment(`${response}${footer({ image: true })}`)
}
- await updateComment(`${response}${footer({ image: true })}`)
}
} catch (e: any) {
exitCode = 1
diff --git a/packages/web/src/content/docs/docs/github.mdx b/packages/web/src/content/docs/docs/github.mdx
index 375a2cff3..0a63a3533 100644
--- a/packages/web/src/content/docs/docs/github.mdx
+++ b/packages/web/src/content/docs/docs/github.mdx
@@ -77,18 +77,24 @@ This will walk you through installing the GitHub app, creating the workflow, and
- Explain an issue
- ```bash
+ Leave the following comment on a GitHub issue. `opencode` will read the entire thread, including all comments, and reply with a clear explanation.
+
+ ```
/opencode explain this issue
```
-- Fix an issue - opencode will create a PR with the changes.
+- Fix an issue
+
+ Leave the following comment on a GitHub issue. opencode will create a new branch, implement the changes, and open a PR with the changes.
- ```bash
+ ```
/opencode fix this
```
- Review PRs and make changes
- ```bash
+ Leave the following comment on a GitHub PR. opencode will implement the requested change and commit it to the same PR.
+
+ ```
Delete the attachment from S3 when the note is removed /oc
```