github - Github 工作流不会在推送基于路径的过滤时触发
问题描述
我有一个工作流程,每当有推送到开发分支时,我都需要运行该工作流程。我正在使用基于路径的过滤。这是工作流程的片段
name: Push to XYZ
on:
push:
branches: [ Develop ]
paths:
- '!.github/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Extract commit
run: |
echo "Sending commit $GITHUB_SHA for $GITHUB_REPOSITORY"
curl -XPOST ......
所以这个想法是,在推送到开发(直接或通过拉取请求)时,如果所做的更改位于文件夹或文件.github
夹以外的文件中,则工作流应该运行。此工作流程已被推送到 Develop at .github/workflows/file.yaml
。我从开发中取出一个分支,对不在其中的文件进行更改,.github
然后提出 PR 并将其合并。但是工作流程没有运行
我错过了什么吗?
没有语法或缩进问题,因为我能够手动触发工作流程并且工作正常
解决方案
您需要的是首先添加过滤器以允许某些文件夹,这里就是
name: Push to XYZ
on:
push:
branches: [ main ]
paths:
- '**'
- '!.github/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Extract commit
run: |
echo "Sending commit $GITHUB_SHA for $GITHUB_REPOSITORY"
推荐阅读
- swift - 为什么从 UICollectionView 类调用委托函数时我的 UIViewController 没有更新
- python - Python 过程的顺序(何时将变量放在括号中与将其放在句点之前)
- json - 如何使用 Fluentd 嵌套 json 日志?
- android - Kotlin Android MVVM RecyclerView 不显示任何数据
- javascript - 如何解决布尔诺言
- c# - 如何使用 IsFaulted、IsCanceled 和 IsCompleted 测试用例测试“ToListAsync”
- sql - 32 位 ODBC 驱动程序连接问题
- html - 使用 XPath 将 HTML 中的信息提取/解析到 Google 表格中
- c++ - 如何添加预防措施以绕过未注册的 Microsoft.ACE.OLEDB.12.0?
- jquery - 无法从 Zend Framework 3 向 Ajax 调用发送 JSON 响应