The repository had three script roots with three test entry points. The automation scripts now live in scripts/ci and run through scripts/test.mjs, which gained a quick automation profile and includes them in the ci and release profiles. The workflows keep checking the scripts out from the workflow commit, never from the PR branch. stateKey now returns its fallback explicitly, because the file is inside the empty-catch guard once it sits under scripts/. The review and diagnosis exclude lists also skip the generated frontend wordmark module.
70 lines
2.3 KiB
YAML
70 lines
2.3 KiB
YAML
name: Code Diagnosis
|
|
|
|
# Monday and Thursday at 02:00 Beijing time, scan one area of main for defects.
|
|
on:
|
|
schedule:
|
|
- cron: "0 18 * * 0,3"
|
|
workflow_dispatch:
|
|
inputs:
|
|
publish:
|
|
description: Create issues (otherwise only print them)
|
|
default: false
|
|
type: boolean
|
|
|
|
permissions: {}
|
|
|
|
env:
|
|
# Keep in sync with pr-review.yml.
|
|
OCR_VERSION: v1.14.8
|
|
OCR_SHA256: fd82b5ddc1599fbad0680231a74e5292d4d7158522642e06c9229ed6ef32365f
|
|
|
|
concurrency:
|
|
group: code-diagnosis
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
diagnose:
|
|
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
permissions:
|
|
contents: read
|
|
issues: write
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Cache OpenCodeReview binary
|
|
id: ocr-cache
|
|
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
|
|
with:
|
|
path: ${{ runner.temp }}/ocr-bin
|
|
key: opencodereview-${{ env.OCR_VERSION }}-${{ env.OCR_SHA256 }}
|
|
|
|
- name: Download OpenCodeReview
|
|
if: steps.ocr-cache.outputs.cache-hit != 'true'
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
mkdir -p "$RUNNER_TEMP/ocr-bin"
|
|
curl --fail --location --retry 3 --output "$RUNNER_TEMP/ocr-bin/ocr" "https://github.com/alibaba/open-code-review/releases/download/$OCR_VERSION/opencodereview-linux-amd64"
|
|
|
|
- name: Verify OpenCodeReview
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
echo "$OCR_SHA256 $RUNNER_TEMP/ocr-bin/ocr" | sha256sum --check --strict
|
|
chmod 700 "$RUNNER_TEMP/ocr-bin/ocr"
|
|
|
|
- name: Diagnose code
|
|
env:
|
|
PR_REVIEW_OCR_BIN: ${{ runner.temp }}/ocr-bin/ocr
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
PR_REVIEW_LLM_KEY: ${{ secrets.PR_REVIEW_LLM_KEY }}
|
|
PR_REVIEW_LLM_BASE_URL: ${{ vars.PR_REVIEW_LLM_BASE_URL || 'https://open.bigmodel.cn/api/anthropic' }}
|
|
PR_REVIEW_LLM_MODEL: ${{ vars.PR_REVIEW_LLM_MODEL || 'glm-5.4' }}
|
|
PR_REVIEW_LLM_PROTOCOL: ${{ vars.PR_REVIEW_LLM_PROTOCOL || 'anthropic' }}
|
|
PR_REVIEW_LLM_EXTRA_BODY: ${{ vars.PR_REVIEW_LLM_EXTRA_BODY }}
|
|
run: node scripts/ci/code-diagnosis.mjs
|