【发布时间】:2021-08-05 14:18:36
【问题描述】:
我目前正在this repository 上测试 Github Actions 工作流程。
上下文
我正在尝试使用this workflow (1st):
on:
workflow_dispatch:
jobs:
job:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
date > report.txt
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git commit -m "generate or update report.txt file"
git push
触发this workflow (2nd):
on:
push:
paths:
- '**/report.txt'
pull_request:
paths:
- '**/report.txt'
jobs:
job:
runs-on: ubuntu-latest
steps:
- run: echo "Report .txt file has been updated"
我尝试了什么
我按照Github Action Documentation 使用Filter Pattern 实现2nd 工作流程。
当我在本地更新 report.txt 文件,然后提交并将代码推送到存储库时,2nd 工作流将触发。
但是,我不明白为什么1st 工作流完成后2nd 工作流不会触发,即使report.txt 文件在默认分支上更新。
编辑: 我知道我可以使用其他触发事件类型(例如:repository_dispatch 或workflow_run)触发2nd 工作流。但我正在尝试通过另一个工作流程上的git push 命令来实现。
问题
我是否错过了1st 工作流中的某些内容以使其触发2nd,或者我是否应该在2nd 工作流中添加某些内容以使其由1st 触发?
【问题讨论】:
-
感谢您的 cmets 解决了这个问题,所以我想我会说谢谢
-
没问题!我很高兴它有所帮助:D
标签: github-actions