diff --git a/.github/workflows/pr-checker.yml b/.github/workflows/pr-checker.yml index 8d408ba246..2fd266cdb7 100644 --- a/.github/workflows/pr-checker.yml +++ b/.github/workflows/pr-checker.yml @@ -9,27 +9,8 @@ jobs: runs-on: ubuntu-latest steps: - - name: 检查 PR 是否已合并 - id: pr_status - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const { data: pr } = await github.rest.pulls.get({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.payload.pull_request.number - }); - - if (pr.merged) { - console.log("PR(${context.payload.inputs.pr_number}) 已合并"); - } else { - console.log("PR(${context.payload.inputs.pr_number}) 未合并"); - } - core.setOutput("pr_merged", pr.merged); - - - name: Check Commit Message - if: ${{ steps.pr_status.outputs.pr_merged == 'False' }} + - name: Check Commits + if: github.event_name == 'pull_request' uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} @@ -46,6 +27,6 @@ jobs: console.log(`check ${commits.length} commit(s)`); if (invalidCommits.length > 0) { - const invalidCommitMessages = invalidCommits.map(commit => commit.commit.message); - core.setFailed(`Invalid commit message found: ${invalidCommitMessages.join(", ")}`); + const invalidCommitNames = invalidCommits.map(commit => commit.commit.message); + core.setFailed(`Invalid commit names found: ${invalidCommitNames.join(", ")}`); }