You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何创建带条件的GitHub Pull Request模板?排除指定用户应用

特定用户跳过PR模板的实现方案

GitHub原生不支持直接指定用户跳过PR模板,不过可以通过GitHub Actions实现这个需求,具体步骤如下:

  • 在仓库的.github/workflows目录下新建一个工作流文件,比如skip-pr-template.yml
  • 写入以下工作流代码,替换其中的your-username为你自己的GitHub用户名:
name: Skip PR Template for Specific User

on:
  pull_request:
    types: [opened]

jobs:
  clear-pr-template:
    runs-on: ubuntu-latest
    if: github.event.pull_request.user.login == 'your-username'
    steps:
      - name: Override PR Description
        uses: peter-evans/create-or-update-comment@v3
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          issue-number: ${{ github.event.pull_request.number }}
          body: ""
          edit-mode: replace
  • 提交这个文件到仓库即可

这个方案的原理是,当你创建PR时,工作流会自动触发,清空PR的描述内容,相当于跳过了模板。目前没有更原生的方式能直接在PR创建时不加载模板,这是最可行的替代方法。

内容的提问来源于stack exchange,提问作者Passaro

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.14 20:50:06