diff options
| author | Matt Silverlock <[email protected]> | 2025-12-21 09:46:54 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-12-21 08:46:54 -0600 |
| commit | 10375263ef03740d530cbc626ee775914fbffacc (patch) | |
| tree | 6f0c99a39b2d3961e6b224064f458339fb44bbf2 /packages/web/src | |
| parent | ae00001aa010de5e05f79b5653f4473d7350feba (diff) | |
| download | opencode-10375263ef03740d530cbc626ee775914fbffacc.tar.gz opencode-10375263ef03740d530cbc626ee775914fbffacc.zip | |
github: support schedule events (#5810)
Diffstat (limited to 'packages/web/src')
| -rw-r--r-- | packages/web/src/content/docs/github.mdx | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/packages/web/src/content/docs/github.mdx b/packages/web/src/content/docs/github.mdx index 1d6078840..bd792f92f 100644 --- a/packages/web/src/content/docs/github.mdx +++ b/packages/web/src/content/docs/github.mdx @@ -100,6 +100,56 @@ Or you can set it up manually. --- +## Supported Events + +OpenCode can be triggered by the following GitHub events: + +| Event Type | Triggered By | Details | +| ----------------------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `issue_comment` | Comment on an issue or PR | Mention `/opencode` or `/oc` in your comment. OpenCode reads the issue/PR context and can create branches, open PRs, or reply with explanations. | +| `pull_request_review_comment` | Comment on specific code lines in a PR | Mention `/opencode` or `/oc` while reviewing code. OpenCode receives file path, line numbers, and diff context for precise responses. | +| `schedule` | Cron-based schedule | Run OpenCode on a schedule using the `prompt` input. Useful for automated code reviews, reports, or maintenance tasks. OpenCode can create issues or PRs as needed. | + +### Schedule Example + +Run OpenCode on a schedule to perform automated tasks: + +```yaml title=".github/workflows/opencode-scheduled.yml" +name: Scheduled OpenCode Task + +on: + schedule: + - cron: "0 9 * * 1" # Every Monday at 9am UTC + +jobs: + opencode: + runs-on: ubuntu-latest + permissions: + id-token: write + contents: write + pull-requests: write + issues: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Run OpenCode + uses: sst/opencode/github@latest + env: + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} + with: + model: anthropic/claude-sonnet-4-20250514 + prompt: | + Review the codebase for any TODO comments and create a summary. + If you find issues worth addressing, open an issue to track them. +``` + +For scheduled events, the `prompt` input is **required** since there's no comment to extract instructions from. + +> **Note:** Scheduled workflows run without a user context to permission-check, so the workflow must grant `contents: write` and `pull-requests: write` if you expect OpenCode to create branches or PRs during a scheduled run. + +--- + ## Custom prompts Override the default prompt to customize OpenCode's behavior for your workflow. |
