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

GitHub Pull Request Action配置paths过滤后仍异常触发的问题

解决GitHub Pull Request Action仅指定文件夹变更时触发的问题

配置修正与注意事项

  • 先确认paths规则的写法,建议给路径添加单引号,避免YAML解析异常:
    name: Pull Request
    
    on:
      workflow_dispatch:
      pull_request:
        branches:
          - main
        paths:
          - 'my-config/**'
    
    concurrency:
      group: pr-${{ github.head_ref || github.run_id }}
      cancel-in-progress: true
    
    jobs:
      Run:
        runs-on: ubuntu-latest
        steps:
          - name: Checkout
            uses: actions/checkout@v3
    
  • 关键提醒:如果你的PR中修改了当前Workflow配置文件(即.github/workflows/下的这个yml文件),GitHub会忽略paths规则强制触发Action,这是平台默认机制。只要PR包含Workflow文件的变更,无论其他文件是否在指定文件夹内,Action都会运行。

额外排查步骤

  • 打开PR的「Files changed」标签,确认是否确实没有my-config文件夹下的文件变更
  • 如果需要排除Workflow文件变更的触发,可以添加paths-ignore规则:
    on:
      workflow_dispatch:
      pull_request:
        branches:
          - main
        paths:
          - 'my-config/**'
        paths-ignore:
          - '.github/workflows/*.yml'
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.19 06:45:41