name: AI on: pull_request: branches-ignore: - master types: [opened, synchronize] jobs: detect-bot-commit: name: 偵測自動提交 runs-on: ubuntu outputs: skip: ${{ steps.detect.outputs.skip }} steps: - name: 檢查 head commit marker id: detect env: GITEA_API_URL: ${{ github.api_url }} GITEA_REPOSITORY: ${{ github.repository }} GITEA_SHA: ${{ github.sha }} GITEA_TOKEN: ${{ github.token }} run: | set -e commit_json="$(curl -fsSL -H "Authorization: token ${GITEA_TOKEN}" "${GITEA_API_URL}/repos/${GITEA_REPOSITORY}/git/commits/${GITEA_SHA}")" || { echo "skip=false" >> "$GITHUB_OUTPUT" exit 0 } if printf '%s' "$commit_json" | grep -q '\[ai-review-bot\]'; then echo "skip=true" >> "$GITHUB_OUTPUT" echo "偵測到 AI Review Bot commit,跳過 review workflow" else echo "skip=false" >> "$GITHUB_OUTPUT" fi version: name: 計算版本號 runs-on: ubuntu needs: [detect-bot-commit] if: needs.detect-bot-commit.outputs.skip != 'true' outputs: version: ${{ steps.version.outputs.version }} steps: - name: 計算版本號 id: version uses: https://gitea.jsc.idv.tw/actions/calculate-version@${{ vars.ACTION_CALCULATE_VERSION }} with: IS_BETA: true - name: 標註版本號 uses: akkuman/gitea-release-action@${{ vars.ACTION_RELEASE_VERSION }} with: name: code-review v${{ steps.version.outputs.version }} tag_name: v${{ steps.version.outputs.version }} target_commitish: ${{ github.head_ref }} code-review: name: Code Review runs-on: ubuntu needs: [detect-bot-commit, version] if: needs.detect-bot-commit.outputs.skip != 'true' steps: - name: AI Code Review uses: https://gitea.jsc.idv.tw/actions/code-review@v${{ needs.version.outputs.version }} with: GITEA_TOKEN: ${{ secrets.RUNNER_TOKEN }} GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }},${{ secrets.GEMINI_API_KEY_1 }},${{ secrets.GEMINI_API_KEY_2 }},${{ secrets.GEMINI_API_KEY_3 }},${{ secrets.GEMINI_API_KEY_4 }},${{ secrets.GEMINI_API_KEY_5 }},${{ secrets.GEMINI_API_KEY_6 }},${{ secrets.GEMINI_API_KEY_7 }},${{ secrets.GEMINI_API_KEY_8 }},${{ secrets.GEMINI_API_KEY_9 }},${{ secrets.GEMINI_API_KEY_10 }},${{ secrets.GEMINI_API_KEY_11 }},${{ secrets.GEMINI_API_KEY_12 }},${{ secrets.GEMINI_API_KEY_13 }},${{ secrets.GEMINI_API_KEY_14 }},${{ secrets.GEMINI_API_KEY_15 }},${{ secrets.GEMINI_API_KEY_16 }},${{ secrets.GEMINI_API_KEY_17 }},${{ secrets.GEMINI_API_KEY_18 }},${{ secrets.GEMINI_API_KEY_19 }} GEMINI_BASE_URL: https://generativelanguage.googleapis.com/v1beta GEMINI_MODEL: ${{ vars.GEMINI_MODEL }} permissions: contents: write pull-requests: write issues: write