我想考虑一下常见的路径:
on:
push:
# Run only on changes on these files
paths:
- 'lib/**.nim'
- 'doc/**.rst'
- 'doc/nimdoc.css'
- '.github/workflows/ci_docs.yml'
pull_request:
# Run only on changes on these files
paths:
- 'lib/**.nim'
- 'doc/**.rst'
- '.github/workflows/ci_docs.yml'
GitHub 上的文档提到了[push, pull_request]
但如果我们有路径节点,它就不起作用。避免代码重复的语法是什么?
(提前为与 https://github.community/t/how-to-factor-paths-in-common-for-push-and-pull-request/115967 交叉发布道歉,如果我得到任何答案,我会在另一端更新(
如果我正确理解了您的问题,那么您是在问如何列出多个事件的常见路径,例如在push
和pull_request
运行文件路径lib/**.nim', 'doc/**.rst', '.github/workflows/ci_docs.yml'
目前是不可能的。
恭敬地,在两个地方都有列表并不是很多重复,而且出于GitHub方面的一些实现细节原因,很可能是这样。
官方文档,如果您想了解更多阅读:https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestpaths
下面是一个您可能想尝试的示例。@xandermonkey链接的文档中也概述了类似的方法。
on:
push:
pull_request:
# Run only on changes on these files
paths:
- 'lib/**.nim'
- 'doc/**.rst'
- '.github/workflows/ci_docs.yml'