60 lines
2.5 KiB
Markdown
60 lines
2.5 KiB
Markdown
# Antigravity CLI Composite Action
|
||
|
||
更新時間:2026/06/29 14:21:50
|
||
|
||
此 repository 提供一個 Gitea/GitHub Actions composite action,用於安裝 Antigravity CLI、解碼並寫入 OAuth token、以指定提示詞與模型執行 CLI,並將 CLI 的標準輸出寫入 action output。模型名稱由 action 內部直接讀取 repository variable `vars.ANTIGRAVITY_MODEL`。
|
||
|
||
## 專案列表
|
||
|
||
### 專案描述
|
||
|
||
| 專案名稱 | 專案描述 |
|
||
| --- | --- |
|
||
| [antigravity](https://gitea.jsc.idv.tw/composite-actions/antigravity/src/branch/develop) | 提供 Antigravity CLI composite action:安裝 `agy` CLI、以 base64 解碼寫入 OAuth token,並以呼叫端的 `prompt` 輸入與 repository variable 指定的模型執行 CLI,最後將文字輸出回傳為 `text` output。 |
|
||
|
||
### 參考專案
|
||
|
||
| 專案名稱 | 參考專案列表 |
|
||
| --- | --- |
|
||
| [antigravity](https://gitea.jsc.idv.tw/composite-actions/antigravity/src/branch/develop) | 無 |
|
||
|
||
### NuGet 套件
|
||
|
||
| 專案名稱 | NuGet 套件列表 |
|
||
| --- | --- |
|
||
| [antigravity](https://gitea.jsc.idv.tw/composite-actions/antigravity/src/branch/develop) | 無 |
|
||
|
||
## 功能列表
|
||
|
||
此 repository 為 composite action(YAML + bash)專案,未包含可列入 README 的 public method、public constructor、public extension method 或 public operator。
|
||
|
||
## 使用範例
|
||
|
||
### 在 workflow 中呼叫 Antigravity CLI
|
||
|
||
以下範例示範在 workflow step 中呼叫此 composite action,傳入 OAuth token 與提示詞,並在後續步驟讀取 `text` output。模型名稱由 action 直接讀取 `vars.ANTIGRAVITY_MODEL`,呼叫端不需傳入 model。
|
||
|
||
```yaml
|
||
- name: 執行 Antigravity CLI
|
||
id: antigravity
|
||
uses: https://gitea.jsc.idv.tw/composite-actions/antigravity@v1
|
||
with:
|
||
oauth: ${{ secrets.ANTIGRAVITY_OAUTH }}
|
||
prompt: "請自我介紹"
|
||
|
||
- name: 使用輸出文字
|
||
run: printf '%s\n' '${{ steps.antigravity.outputs.text }}'
|
||
```
|
||
|
||
前置條件:
|
||
|
||
- `secrets.ANTIGRAVITY_OAUTH` 必須是 Antigravity OAuth token 檔案內容的 base64 字串。
|
||
- `vars.ANTIGRAVITY_MODEL` 必須是 Antigravity CLI 可用的模型名稱(未設定時 action 會直接失敗)。
|
||
- runner 必須可連線到 `https://antigravity.google/cli/install.sh` 以下載 CLI。
|
||
|
||
預期結果:
|
||
|
||
- action 會安裝 `agy` CLI。
|
||
- action 會將 OAuth token 寫入 `$HOME/.gemini/antigravity-cli/antigravity-oauth-token` 並設定檔案權限為 `600`。
|
||
- action 會執行 `agy --print "$PROMPT" --model "$MODEL"`,並把 stdout 寫入 `steps.antigravity.outputs.text`。
|