fix(*): 持续集成 - 修复锁文件、格式门禁与生成链路构建失败

This commit is contained in:
ddCat
2026-08-07 12:35:03 +08:00
parent cab0baba56
commit 5cb17acbc6
18 changed files with 289 additions and 238 deletions

View File

@@ -35,13 +35,40 @@ jobs:
working-directory: web
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.9
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Check formatting
run: bun run format:check
env:
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
run: |
changed_files=()
repo_prefix="$(git rev-parse --show-prefix)"
while IFS= read -r -d '' file; do
case "$file" in
*.css|*.html|*.json|*.js|*.jsx|*.md|*.mdx|*.mjs|*.cjs|*.ts|*.tsx|*.yaml|*.yml)
base_path="${repo_prefix}${file}"
if git cat-file -e "$BASE_SHA:$base_path" 2>/dev/null \
&& ! diff -q \
<(git show "$BASE_SHA:$base_path") \
<(git show "$BASE_SHA:$base_path" | bunx prettier --ignore-path /dev/null --stdin-filepath "$file") \
>/dev/null; then
echo "Skipping legacy unformatted file: $file"
continue
fi
changed_files+=("$file")
;;
esac
done < <(git diff --relative --name-only --diff-filter=ACMR -z "$BASE_SHA" "$GITHUB_SHA" -- .)
if (( ${#changed_files[@]} > 0 )); then
bunx prettier --check "${changed_files[@]}"
else
echo "No changed web files require formatting checks."
fi
- name: Typecheck
run: bun run typecheck
- name: Run tests