wip: github actions

This commit is contained in:
Frank
2025-07-26 02:49:05 -04:00
parent c2b3c52b76
commit 670f470eee
3 changed files with 36 additions and 20 deletions

View File

@@ -6,21 +6,27 @@ Mention `/opencode` in your comment, and opencode will execute tasks within your
## Features ## 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 /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 /opencode fix this
``` ```
#### Review PRs and make changes #### 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 Delete the attachment from S3 when the note is removed /oc
``` ```

View File

@@ -156,21 +156,23 @@ export const GithubInstallCommand = cmd({
step2 = 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" "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 { } else {
const url = `https://github.com/organizations/${app.owner}/settings/secrets/actions` step2 = [
const env = providers[provider].env ` 2. Add the following secrets in org or repo (${app.owner}/${app.repo}) settings`,
const envStr = "",
env.length === 1 ...providers[provider].env.map((e) => ` - ${e}`),
? `\`${env[0]}\` secret` ].join("\n")
: `\`${[env.slice(0, -1).join("\`, \`"), ...env.slice(-1)].join("\` and \`")}\` secrets`
step2 = `Add ${envStr} for ${providers[provider].name} - ${url}`
} }
prompts.outro( prompts.outro(
[ [
"Next steps:", "Next steps:",
` 1. Commit "${WORKFLOW_FILE}" file and push`, "",
` 2. ${step2}`, ` 1. Commit the \`${WORKFLOW_FILE}\` file and push`,
" 3. Learn how to use the GitHub agent - https://docs.opencode.ai/docs/github/getting-started", 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"), ].join("\n"),
) )
} }
@@ -320,6 +322,7 @@ jobs:
contains(github.event.comment.body, '/opencode') contains(github.event.comment.body, '/opencode')
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: read
id-token: write id-token: write
steps: steps:
- name: Checkout repository - name: Checkout repository
@@ -457,8 +460,9 @@ export const GithubRunCommand = cmd({
`${response}\n\nCloses #${issueId}${footer({ image: true })}`, `${response}\n\nCloses #${issueId}${footer({ image: true })}`,
) )
await updateComment(`Created PR #${pr}${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) { } catch (e: any) {
exitCode = 1 exitCode = 1

View File

@@ -77,18 +77,24 @@ This will walk you through installing the GitHub app, creating the workflow, and
- Explain an issue - 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 /opencode explain this issue
``` ```
- Fix an issue - opencode will create a PR with the changes. - Fix an issue
```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 /opencode fix this
``` ```
- Review PRs and make changes - 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 Delete the attachment from S3 when the note is removed /oc
``` ```