fix(docs): locale translations for nav elements and headings

This commit is contained in:
Adam
2026-02-11 18:51:27 -06:00
parent 8eea53a41e
commit aea68c386a
484 changed files with 12718 additions and 11212 deletions

View File

@@ -1,43 +1,43 @@
---
title: GitHub
description: 在 GitHub 問題和拉取請求中使用 opencode。
description: 在 GitHub Issues 和拉取請求中使用 opencode。
---
opencode 與您的 GitHub 工作流程集成。在評論中提及`/opencode` 或`/oc`opencode 將在您的 GitHub Actions 運行器中執行任務。
opencode 與您的 GitHub 工作流程整合。在評論中提及 `/opencode` 或 `/oc`opencode 將在您的 GitHub Actions Runner 中執行任務。
---
## 特徵
## 功能
- **分類問題**:要求 opencode 調查問題並向您解釋。
- **修復和實**:要求 opencode 修復問題或實功能。它將在一個新分支中工作並提交包含所有更的 PR。
- **安全**opencode 在 GitHub 的運行器中運行。
- **修復和實**:要求 opencode 修復問題或實功能。它將在一個新分支中工作並提交包含所有更的 PR。
- **安全**opencode 在 GitHub 的 Runner 中執行。
---
## 安裝
在 GitHub 儲庫中的項目中運行以下令:
在 GitHub 儲庫中的專案中執行以下令:
```bash
opencode github install
```
這將引導您完成安裝 GitHub 應用程式、建工作流程和設置機密
這將引導您完成安裝 GitHub 應用程式、建工作流程和設定 Secrets
---
### 手動設
### 手動設
或者您可以手動設
或者您可以手動設
1. Error 500 (Server Error)!!1500.Thats an error.There was an error. Please try again later.Thats all we know.
1. **安裝 GitHub 應用程式**
前往[**github.com/apps/opencode-agent**](https://github.com/apps/opencode-agent)。確保它已安裝在目標儲庫上。
前往 [**github.com/apps/opencode-agent**](https://github.com/apps/opencode-agent)。確保它已安裝在目標儲庫上。
2. **添加工作流程**
2. **新增工作流程**
將以下工作流程文件添加到存儲庫中的 `.github/workflows/opencode.yml` 中。確保在`model`中設適當的`env`和所需的API鑰。
將以下工作流程檔案新增到儲存庫中的 `.github/workflows/opencode.yml` 中。確保在 `env` 中設適當的 `model` 和所需的 API鑰。
```yml title=".github/workflows/opencode.yml" {24,26}
name: opencode
@@ -73,21 +73,21 @@ opencode github install
# github_token: xxxx
```
3. Error 500 (Server Error)!!1500.Thats an error.There was an error. Please try again later.Thats all we know.
3. **設定 Secrets**
在您的組織或項目的**設置**中,展開左側的**秘密和變量**,然後選擇**操作**。並添加所需的 API 鑰。
在您的組織或專案的 **Settings** 中,展開左側的 **Secrets and variables**,然後選擇 **Actions**。並新增所需的 API 鑰。
---
## 配置
## 設定
- `model`:與 opencode 一起使用的模型。採用`provider/model` 格式。這是**必需的**。
- `agent`: The agent to use.必須是一級代理。如果未找到,則從配置回退到 `default_agent` 或 `"build"`。
- `share`:是否共享opencode會話。對於公共存儲庫,默認為 **true**。
- `prompt`:可選的自定義提示以覆蓋默認行為。使用它來自定義 opencode 處理請求的方式。
- `token`:可選的 GitHub 訪問令牌,用於執行建評論、提交更和打開拉取請求等操作。默認情況下opencode 使用來自 opencode GitHub 應用程式的安裝訪問令牌,因此提交、評論和拉取請求顯示為來自應用程式。
- `model`:與 opencode 一起使用的模型。採用 `provider/model` 格式。這是**必需的**。
- `agent`: 使用的代理。必須是主要代理。如果未找到,則從設定退回到 `default_agent` 或 `"build"`。
- `share`:是否分享 opencode 工作階段。對於公共儲存庫,預設為 **true**。
- `prompt`:可選的自定義提示以覆寫預設行為。使用它來自定義 opencode 處理請求的方式。
- `token`:可選的 GitHub 存取權杖,用於執行建評論、提交更和打開拉取請求等操作。預設情況下opencode 使用來自 opencode GitHub 應用程式的安裝存取權杖,因此提交、評論和拉取請求顯示為來自應用程式。
或者,您可以使用 GitHub Action 運行程序的[內置`GITHUB_TOKEN`](https://docs.github.com/en/actions/tutorials/authenticate-with-github_token),而無需安裝 opencode GitHub 應用程式。只需確保在您的工作流程中授予所需的權限:
或者,您可以使用 GitHub Action Runner 的 [內建 `GITHUB_TOKEN`](https://docs.github.com/en/actions/tutorials/authenticate-with-github_token),而無需安裝 opencode GitHub 應用程式。只需確保在您的工作流程中授予所需的權限:
```yaml
permissions:
@@ -97,26 +97,26 @@ opencode github install
issues: write
```
Error 500 (Server Error)!!1500.Thats an error.There was an error. Please try again later.Thats all we know.
**注意**:使用 `GITHUB_TOKEN` 時opencode 執行的操作(如提交和評論)將不會觸發其他工作流程。
---
## 支持的活動
## 支援的事件
opencode 可以由以下 GitHub 事件觸發:
| 事件類型 | 觸發 | 詳情 |
| ----------------------------- | ------------------------------ | ---------------------------------------------------------------------------------------------------- |
| `issue_comment` | 對問題或 PR 發表評論 | Mention `/opencode` or `/oc` in your comment. opencode 讀取上下文並可以建分支、打開 PR 或回复。 |
| `pull_request_review_comment` | 對 PR 中的特定程式碼行進行評論 | 在檢查程式碼時提及`/opencode` 或`/oc`。 opencode receives file path, line numbers, and diff context. |
| `issues` | 問題已打開或已編輯 | 建或修改問題時自動觸發 opencode。需要 `prompt` 輸入。 |
| `pull_request` | PR 已開啟或已更新 | Automatically trigger opencode when PRs are opened, synchronized, or reopened.對於自動評論很有用。 |
| `schedule` | 基於 Cron 的計劃 | 按計劃運行 opencode。需要 `prompt` 輸入。輸出進入日誌和 PR沒有可評論的問題 |
| `workflow_dispatch` | 從 GitHub UI 手動觸發 | 通過“操作”選項卡按需觸發 opencode。需要 `prompt` 輸入。輸出進入日誌和 PR。 |
| 事件類型 | 觸發條件 | 詳情 |
| ----------------------------- | ------------------------------ | --------------------------------------------------------------------------------------- |
| `issue_comment` | 對問題或 PR 發表評論 | 在評論中提及 `/opencode` `/oc` opencode 讀取上下文並可以建分支、打開 PR 或回覆。 |
| `pull_request_review_comment` | 對 PR 中的特定程式碼行進行評論 | 在檢查程式碼時提及 `/opencode` 或 `/oc`。 opencode 接收檔案路徑、行號和 diff 上下文。 |
| `issues` | 問題已打開或已編輯 | 建或修改問題時自動觸發 opencode。需要 `prompt` 輸入。 |
| `pull_request` | PR 已開啟或已更新 | 當 PR 被開啟、同步或重新開啟時自動觸發 opencode。對於自動評論很有用。 |
| `schedule` | 基於 Cron 的排程 | 按排程執行 opencode。需要 `prompt` 輸入。輸出進入日誌和 PR沒有可評論的問題。 |
| `workflow_dispatch` | 從 GitHub UI 手動觸發 | 透過「Actions」標籤按需觸發 opencode。需要 `prompt` 輸入。輸出進入日誌和 PR。 |
### 時間表示
### 排程範
計劃運行 opencode 以執行自動化任務:
排程執行 opencode 以執行自動化任務:
```yaml title=".github/workflows/opencode-scheduled.yml"
name: Scheduled OpenCode Task
@@ -150,13 +150,13 @@ jobs:
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.計劃工作流在沒有用戶上下文的情況下行以進行權限檢查,因此如果您希望 opencode 建分支或 PR工作流必須授予 `contents: write` 和 `pull-requests: write`。
對於排程事件,`prompt` 輸入是**必需的**,因為沒有註釋可從中提取指令。排程工作流在沒有使用者上下文的情況下行以進行權限檢查,因此如果您希望 opencode 建分支或 PR工作流必須授予 `contents: write` 和 `pull-requests: write`。
---
### 拉取請求
### 拉取請求
打開或更新 PR 時自動審
打開或更新 PR 時自動審
```yaml title=".github/workflows/opencode-review.yml"
name: opencode-review
@@ -191,13 +191,13 @@ jobs:
- Suggest improvements
```
對於 `pull_request` 事件,如果未提供 `prompt`opencode 將默認審核拉取請求。
對於 `pull_request` 事件,如果未提供 `prompt`opencode 將預設審閱拉取請求。
---
### 問題分類
### 問題分類
自動分類新問題。此例過濾超過 30 天的帳以減少垃圾郵件
自動分類新問題。此例過濾超過 30 天的帳以減少垃圾訊息
```yaml title=".github/workflows/opencode-triage.yml"
name: Issue Triage
@@ -246,13 +246,13 @@ jobs:
Otherwise, do not comment.
```
對於 `issues` 事件,`prompt` 輸入是**必需的**,因為沒有註釋可從中提取指令。
對於 `issues` 事件,`prompt` 輸入是**必需的**,因為沒有評論可從中提取指令。
---
## 自定義提示
蓋默認提示,為您的工作流程自定義 opencode 的行為。
寫預設提示,為您的工作流程自定義 opencode 的行為。
```yaml title=".github/workflows/opencode.yml"
- uses: anomalyco/opencode/github@latest
@@ -265,35 +265,35 @@ jobs:
- Suggest improvements
```
這對於執行與您的項目相關的特定審標準、編碼標或重點領域非常有用。
這對於執行與您的專案相關的特定審標準、編碼標或重點領域非常有用。
---
##
##
以下是如何在 GitHub 中使用 opencode 的一些例。
以下是如何在 GitHub 中使用 opencode 的一些例。
- **解釋一個問題**
在 GitHub 問題中添加此評論。
在 GitHub Issue 中添加此評論。
```
/opencode explain this issue
```
opencode 將閱讀整個線程,包括所有評論,並回並提供清晰的解釋。
opencode 將閱讀整個討論串,包括所有評論,並回並提供清晰的解釋。
- **解決問題**
在 GitHub 問題中,說:
在 GitHub Issue 中,說:
```
/opencode fix this
```
opencode 將建一個新分支,實施更改,並使用更打開 PR。
opencode 將建一個新分支,實作變更,並使用更打開 PR。
- **審 PR 並進行更**
- **審 PR 並進行更**
在 GitHub PR 上留下以下評論。
@@ -301,21 +301,21 @@ jobs:
Delete the attachment from S3 when the note is removed /oc
```
Error 500 (Server Error)!!1500.Thats an error.There was an error. Please try again later.Thats all we know.
opencode 將實作請求的變更並將其推送到分支。
- **查看特定程式碼行**
直接在 PR 的“文件”選項卡中的程式碼行上留下評論。 opencode 自動檢測文件、行號和差異上下文以提供精確的應。
直接在 PR 的「Files」標籤中的程式碼行上留下評論。 opencode 自動檢測檔案、行號和 diff 上下文以提供精確的應。
```
[Comment on specific lines in Files tab]
/oc add error handling here
```
Error 500 (Server Error)!!1500.Thats an error.There was an error. Please try again later.Thats all we know.
- 正在審的確切文件
opencode 將查看:
- 正在審的確切檔案
- 具體程式碼行
- 周圍的 diff 上下文
- 行號信息
- 行號資訊
這允許更有針對性的請求,而無需手動指定文件路徑或行號。
這允許更有針對性的請求,而無需手動指定檔案路徑或行號。