From 13972a61d446ff10712689e25b4e500a4c90c319 Mon Sep 17 00:00:00 2001 From: Norton_Lin <75243447+Norton-Lin@users.noreply.github.com> Date: Tue, 17 Sep 2024 13:42:59 +0800 Subject: [PATCH] Update pr.yml --- .github/workflows/pr.yml | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index d3bb5d3..449be0a 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1,11 +1,6 @@ -name: Pull Request Checker -on: - pull_request: - branches: - - main +name: Commitlint -permissions: - pull-requests: read +on: [pull_request] jobs: commitlint: @@ -14,17 +9,9 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 with: - node-version: '16' # 更新 Node.js 版本到 16 - - run: npm install - - run: | - npm install --save-dev @commitlint/config-angular @commitlint/cli - echo "module.exports = {extends: ['@commitlint/config-angular']};" > commitlint.config.js - - run: npx commitlint --from=HEAD~1 --to=HEAD --verbose - - name: Check if the PR close an issue in PR body - run: | - if ! echo "${{ github.event.pull_request.body }}" | grep -q "close" ; then - echo "No issue closed in the PR body. Please add a line like 'close #123' to the PR body." - exit 1 - fi + node-version: '16' + - run: npm install -g @commitlint/cli @commitlint/config-conventional + - run: echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js + - run: commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose