仅当推送的文件位于特定文件夹中时如何 运行 GitHub 操作工作流程
How to run GitHub Actions workflow only if the pushed files are in a specific folder
我的文件夹结构看起来像这样。
- folder1
- file1
- *other files*
- folder2
- file1
- *other files*
- .gitignore
- package.json
- *other files*
我想 运行 我的 GitHub 推送操作工作流程,前提是任何 changed/pushed 文件位于 folder1
directory/folder 中。
正常语法涉及a path filter
on:
push:
paths:
- folder1/**
如果这还不够,您还有 GitHub Action Path Filter.
路径过滤器仅在工作流级别起作用。
on:
push:
paths:
- 'sub-project/**'
如果您想在工作级别应用它,请查找 changed-files
如果还想过滤拉取请求运行,您将需要这个
on:
push:
paths:
- 'folder1/**'
pull_request:
paths:
- 'folder1/**'
我的文件夹结构看起来像这样。
- folder1
- file1
- *other files*
- folder2
- file1
- *other files*
- .gitignore
- package.json
- *other files*
我想 运行 我的 GitHub 推送操作工作流程,前提是任何 changed/pushed 文件位于 folder1
directory/folder 中。
正常语法涉及a path filter
on:
push:
paths:
- folder1/**
如果这还不够,您还有 GitHub Action Path Filter.
路径过滤器仅在工作流级别起作用。
on:
push:
paths:
- 'sub-project/**'
如果您想在工作级别应用它,请查找 changed-files
如果还想过滤拉取请求运行,您将需要这个
on:
push:
paths:
- 'folder1/**'
pull_request:
paths:
- 'folder1/**'