diff --git a/action.yml b/action.yml index 028357c..b9358ab 100644 --- a/action.yml +++ b/action.yml @@ -15,17 +15,39 @@ outputs: runs: using: 'composite' steps: - - name: 顯示資訊 - id: display + - name: 取得專案 + uses: actions/checkout@v6 + - name: 產生 AI 回覆 + id: response + uses: https://gitea.jsc.idv.tw/actions/codex@v0.0.2 + with: + OAUTH: ${{ secrets.CODEX_OAUTH }} + MODEL: gpt-5.4-mini + PROMPT: | + 請根據以下 Gitea issue 資訊,以繁體中文回覆使用者。 + 請只輸出要張貼到 issue 留言中的內容,不要包含額外前言。 + + ## 問題標題 + ${{ github.event.issue.title }} + + ## 問題描述 + ${{ github.event.issue.body }} + + ## 使用者留言 + ${{ github.event.comment.body }} + - name: 留言 AI 回覆 env: GITEA_SERVER_URL: ${{ gitea.server_url }} GITEA_REPOSITORY: ${{ gitea.repository }} - RUNNER_TOKEN: ${{ inputs.runner_token }} - TEXT: ${{ inputs.text }} + ISSUE_NUMBER: ${{ github.event.issue.number }} + RUNNER_TOKEN: ${{ secrets.RUNNER_TOKEN }} run: | - echo "Gitea Server Url: $GITEA_SERVER_URL" - echo "Gitea Repository: $GITEA_REPOSITORY" - echo "Gitea Runner Token: $RUNNER_TOKEN" - echo "Input Text: $TEXT" - echo "text=$TEXT" >> "$GITHUB_OUTPUT" + jq -n --rawfile body response.md '{body: $body}' > comment.json + + curl --fail-with-body \ + -X POST \ + -H "Authorization: token $RUNNER_TOKEN" \ + -H "Content-Type: application/json" \ + --data @comment.json \ + "$GITEA_SERVER_URL/api/v1/repos/$GITEA_REPOSITORY/issues/$ISSUE_NUMBER/comments" shell: bash \ No newline at end of file