使用 GitHub Actions 匹配提交信息自动关闭非法 PR

我维护的一个项目的仓库经常有误开 PR 的用户,每次都要一个个手动关闭,非常麻烦,遂设计了一个匹配提交信息自动关闭 PR 的工作流

pull.yaml

此工作流会在检测到提交信息为Update main.go时自动关闭 PR。

name: PullLint
on:
  pull_request_target:
    types: [assigned, opened, synchronize, reopened]
jobs:
  # This workflow closes invalid PR
  close-pr:
    name: closepr
    # The type of runner that the job will run on
    runs-on: ubuntu-latest
    permissions: write-all

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      - name: Close PR if commit message is "Update main.go"
        if: github.event.pull_request.title == 'Update main.go'
        uses: superbrothers/close-pull-request@v3
        with:
          # Optional. Post a issue comment just before closing a pull request.
          comment: "Invalid PR."

你可能感兴趣的:(node,github,actions,pull,requset,workflow,工作流,javascript)