Merge pull request 'feat(antigravity): 改由 repository variable 讀取模型設定' (#4) from ai-review-resolve/develop-20260627-154808 into develop
Reviewed-on: composite-actions/antigravity#4
This commit was merged in pull request #4.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Antigravity CLI Composite Action
|
||||
|
||||
更新時間:2026/06/27 23:24:37
|
||||
更新時間:2026/06/27 23:35:00
|
||||
|
||||
此 repository 提供一個 Gitea/GitHub Actions composite action,用於安裝 Antigravity CLI、寫入 OAuth token、執行指定提示詞,並將 CLI 輸出寫入 action output。
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
| 專案名稱 | 專案描述 |
|
||||
| --- | --- |
|
||||
| [antigravity](https://gitea.jsc.idv.tw/composite-actions/antigravity/src/branch/ai-review-resolve/develop-20260627-142726) | 提供 Antigravity CLI composite action,讓 workflow 可透過 `oauth`、`model` 與 `prompt` 輸入執行 CLI 並取得文字輸出。 |
|
||||
| [antigravity](https://gitea.jsc.idv.tw/composite-actions/antigravity/src/branch/ai-review-resolve/develop-20260627-142726) | 提供 Antigravity CLI composite action,讓 workflow 可透過 `oauth` 與 `prompt` 輸入執行 CLI,並從 repository variable 讀取模型名稱後取得文字輸出。 |
|
||||
|
||||
### 參考專案
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
### 在 workflow 中呼叫 Antigravity CLI
|
||||
|
||||
以下範例示範在 workflow step 中呼叫此 composite action,傳入 OAuth token、模型名稱與提示詞,並在後續步驟讀取 `text` output。
|
||||
以下範例示範在 workflow step 中呼叫此 composite action,傳入 OAuth token 與提示詞,並在後續步驟讀取 `text` output。模型名稱由 action 直接讀取 `vars.ANTIGRAVITY_MODEL`。
|
||||
|
||||
```yaml
|
||||
- name: 執行 Antigravity CLI
|
||||
@@ -40,7 +40,6 @@
|
||||
uses: https://gitea.jsc.idv.tw/composite-actions/antigravity@v1
|
||||
with:
|
||||
oauth: ${{ secrets.ANTIGRAVITY_OAUTH }}
|
||||
model: ${{ vars.ANTIGRAVITY_MODEL }}
|
||||
prompt: "請自我介紹"
|
||||
|
||||
- name: 使用輸出文字
|
||||
|
||||
+9
-9
@@ -1,5 +1,5 @@
|
||||
# 用途:定義可在 GitHub Actions 中使用的 Antigravity CLI composite action,負責安裝 Antigravity CLI、設定 OAuth token、執行提示詞並輸出文字結果。
|
||||
# 更新日期:2026/06/27 23:21:07
|
||||
# 更新日期:2026/06/27 23:35:00
|
||||
|
||||
# 設定 action 顯示名稱,供 workflow 引用與介面顯示。
|
||||
name: 'Antigravity CLI'
|
||||
@@ -17,12 +17,6 @@ inputs:
|
||||
required: false
|
||||
# 設定 prompt 的預設提示詞。
|
||||
default: "請自我介紹"
|
||||
# 定義 Antigravity CLI 執行時使用的模型輸入。
|
||||
model:
|
||||
# 說明 model 輸入會指定 Antigravity CLI 使用的模型。
|
||||
description: 'Antigravity CLI 使用的模型'
|
||||
# 要求呼叫端必須提供 model。
|
||||
required: true
|
||||
# 定義 base64 編碼後的 OAuth token 檔案內容輸入。
|
||||
oauth:
|
||||
# 說明 oauth 輸入需提供 base64 編碼的 Antigravity OAuth token 檔案內容;不得在註解或日誌中輸出明文。
|
||||
@@ -72,12 +66,18 @@ runs:
|
||||
id: antigravity
|
||||
# 宣告此步驟需要的環境變數。
|
||||
env:
|
||||
# 將呼叫端提供的 model input 放入 MODEL 環境變數。
|
||||
MODEL: ${{ inputs.model }}
|
||||
# 從 repository variable 讀取 Antigravity CLI 使用的模型名稱。
|
||||
MODEL: ${{ vars.ANTIGRAVITY_MODEL }}
|
||||
# 將呼叫端提供的 prompt input 放入 PROMPT 環境變數。
|
||||
PROMPT: ${{ inputs.prompt }}
|
||||
# 執行 Antigravity CLI,列印結果並寫入 GitHub Actions output。
|
||||
run: |
|
||||
# 確認呼叫端 repository 已設定 ANTIGRAVITY_MODEL variable。
|
||||
if [ -z "$MODEL" ]; then
|
||||
echo 'ANTIGRAVITY_MODEL repository variable is required.' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 使用指定提示詞與模型執行 Antigravity CLI,並把標準輸出捕捉到 text 變數。
|
||||
text="$(agy --print "$PROMPT" --model "$MODEL")"
|
||||
# 將 Antigravity CLI 回傳文字輸出到目前步驟日誌。
|
||||
|
||||
Reference in New Issue
Block a user