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

如何配置仅触发指定base和head分支的Pull Request工作流?

GitHub Actions 工作流触发规则配置方案

你需要在 pull_request 事件中添加分支限定条件,修改后的工作流文件如下:

name: WorkflowTest

on:
  pull_request:
    branches: [main]
    head_ref: [xyx]

配置说明

  • branches: [main]:限定仅当 Pull Request 的目标分支(base)为 main 时触发工作流
  • head_ref: [xyx]:限定仅当 Pull Request 的源分支(head)为 xyx 时触发工作流

这样配置后,只有从 xyx 分支向 main 分支发起 Pull Request 时,该工作流才会被触发。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.07 14:12:13