diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 373af0d..6b8066b 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -30,6 +30,6 @@ jobs: with: oauth: ${{ secrets.CODEX_OAUTH }} prompt: "請自我介紹" - - name: 檢查登入帳號 - if: ${{ steps.codex.outputs.email != vars.CODEX_EMAIL }} + - name: 檢查登入 + if: ${{ steps.codex.outputs.text == '' }} run: exit 1 diff --git a/action.yml b/action.yml index b18fc6d..78beab2 100644 --- a/action.yml +++ b/action.yml @@ -13,9 +13,6 @@ outputs: text: description: '輸出的文字' value: ${{ steps.codex.outputs.text }} - email: - description: '目前登入帳號的電子郵件(取自 OAuth id_token)' - value: ${{ steps.codex.outputs.email }} runs: using: 'composite' steps: @@ -43,21 +40,9 @@ runs: text="$(codex exec --skip-git-repo-check -s danger-full-access --model "$MODEL" "$PROMPT")" printf '%s\n' "$text" - - # 從 OAuth id_token(JWT)解出目前登入帳號的 email;正規表示式對冒號後空白容錯 - auth_file="$HOME/.codex/auth.json" - id_token="$(grep -oE -m1 '"id_token"[[:space:]]*:[[:space:]]*"[^"]*"' "$auth_file" | sed -E 's/.*:[[:space:]]*"//; s/"$//' || true)" - payload="$(printf '%s' "$id_token" | cut -d. -f2 | tr '_-' '/+')" - case $((${#payload} % 4)) in - 2) payload="${payload}==" ;; - 3) payload="${payload}=" ;; - esac - email="$(printf '%s' "$payload" | base64 -d 2>/dev/null | grep -oE -m1 '"email"[[:space:]]*:[[:space:]]*"[^"]*"' | sed -E 's/.*:[[:space:]]*"//; s/"$//' || true)" - { echo 'text<> "$GITHUB_OUTPUT" shell: bash