fix(codex): oauth 改回經 inputs.oauth 傳入
composite action 讀不到 secrets context,改回由呼叫端以 with: oauth:
${{ secrets.CODEX_OAUTH }} 經 inputs.oauth 傳入;action 從 inputs.oauth
讀取並保留空值把關,移除 job 層 CODEX_OAUTH env。
This commit is contained in:
@@ -23,11 +23,10 @@ jobs:
|
|||||||
name: Codex
|
name: Codex
|
||||||
runs-on: ubuntu
|
runs-on: ubuntu
|
||||||
needs: release-tag-version
|
needs: release-tag-version
|
||||||
env:
|
|
||||||
CODEX_OAUTH: ${{ secrets.CODEX_OAUTH }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: 測試工具
|
- name: 測試工具
|
||||||
id: codex
|
id: codex
|
||||||
uses: https://gitea.jsc.idv.tw/composite-actions/codex@v${{ needs.release-tag-version.outputs.version }}
|
uses: https://gitea.jsc.idv.tw/composite-actions/codex@v${{ needs.release-tag-version.outputs.version }}
|
||||||
with:
|
with:
|
||||||
|
oauth: ${{ secrets.CODEX_OAUTH }}
|
||||||
prompt: "請自我介紹"
|
prompt: "請自我介紹"
|
||||||
|
|||||||
+8
-3
@@ -6,6 +6,9 @@ inputs:
|
|||||||
description: '傳給 Codex CLI 的提示詞'
|
description: '傳給 Codex CLI 的提示詞'
|
||||||
required: false
|
required: false
|
||||||
default: "請自我介紹"
|
default: "請自我介紹"
|
||||||
|
oauth:
|
||||||
|
description: 'base64 編碼的 Codex OAuth token 檔案內容'
|
||||||
|
required: true
|
||||||
outputs:
|
outputs:
|
||||||
text:
|
text:
|
||||||
description: '輸出的文字'
|
description: '輸出的文字'
|
||||||
@@ -14,9 +17,11 @@ runs:
|
|||||||
using: 'composite'
|
using: 'composite'
|
||||||
steps:
|
steps:
|
||||||
- name: 安裝工具
|
- name: 安裝工具
|
||||||
|
env:
|
||||||
|
OAUTH: ${{ inputs.oauth }}
|
||||||
run: |
|
run: |
|
||||||
if [ -z "$CODEX_OAUTH" ]; then
|
if [ -z "$OAUTH" ]; then
|
||||||
echo 'CODEX_OAUTH environment variable is required (set it from secrets.CODEX_OAUTH in the caller workflow).' >&2
|
echo 'oauth input (secrets.CODEX_OAUTH) is required and must not be empty.' >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -24,7 +29,7 @@ runs:
|
|||||||
|
|
||||||
oauth_file="$HOME/.codex/auth.json"
|
oauth_file="$HOME/.codex/auth.json"
|
||||||
install -d -m 700 "$(dirname "$oauth_file")"
|
install -d -m 700 "$(dirname "$oauth_file")"
|
||||||
printf '%s' "$CODEX_OAUTH" | base64 -d > "$oauth_file"
|
printf '%s' "$OAUTH" | base64 -d > "$oauth_file"
|
||||||
chmod 600 "$oauth_file"
|
chmod 600 "$oauth_file"
|
||||||
shell: bash
|
shell: bash
|
||||||
- name: 執行工具
|
- name: 執行工具
|
||||||
|
|||||||
Reference in New Issue
Block a user