Skip to content

chore(maker): update maker version policy for 0.0.21-beta.4 #339

chore(maker): update maker version policy for 0.0.21-beta.4

chore(maker): update maker version policy for 0.0.21-beta.4 #339

Workflow file for this run

name: PR Check
on:
pull_request:
branches:
- main
- beta
- alpha
- next
- '1.x'
# 如果有新的 push,取消之前的运行
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
# 最小权限原则:PR 检查只需要读取代码
permissions:
contents: read
jobs:
# 代码质量检查
lint:
name: Lint & Format Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run ESLint
run: npm run lint
- name: Check code formatting
run: npm run format:check
# 构建检查
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build project
run: npm run build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
retention-days: 7
# 测试
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
continue-on-error: true
# 如果测试失败,继续执行但标记为失败
# Commit 消息检查
commitlint:
name: Check Commit Messages
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # 获取完整历史以检查所有 commits
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'npm'
- name: Reject CI skip directives
run: node scripts/check-no-ci-skip.cjs --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }}
- name: Install dependencies
run: npm ci
- name: Validate PR commits with commitlint
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
# PR 总结
summary:
name: PR Summary
runs-on: ubuntu-latest
needs: [lint, build, test, commitlint]
if: always()
steps:
- name: Check results
run: |
echo "## PR Check Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- Lint: ${{ needs.lint.result }}" >> $GITHUB_STEP_SUMMARY
echo "- Build: ${{ needs.build.result }}" >> $GITHUB_STEP_SUMMARY
echo "- Test: ${{ needs.test.result }}" >> $GITHUB_STEP_SUMMARY
echo "- Commitlint: ${{ needs.commitlint.result }}" >> $GITHUB_STEP_SUMMARY
if [[ "${{ needs.lint.result }}" != "success" ]] || \
[[ "${{ needs.build.result }}" != "success" ]] || \
[[ "${{ needs.test.result }}" != "success" ]] || \
[[ "${{ needs.commitlint.result }}" != "success" ]]; then
echo "" >> $GITHUB_STEP_SUMMARY
echo "❌ Some checks failed. Please fix them before merging." >> $GITHUB_STEP_SUMMARY
exit 1
else
echo "" >> $GITHUB_STEP_SUMMARY
echo "✅ All checks passed! Ready to merge." >> $GITHUB_STEP_SUMMARY
fi