【问题标题】:How to factor `paths:` in common for push: and pull_request: in github actions?如何在 github 操作中为 push: 和 pull_request: 共同考虑 `paths:`?
【发布时间】:2020-05-31 07:47:07
【问题描述】:

我想在其中考虑常用路径:

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的交叉发帖,提前道歉,如果我得到任何答案,我会在另一端更新)

【问题讨论】:

    标签: path pull-request github-actions


    【解决方案1】:

    如果我正确理解您的问题,您是在询问如何列出多个事件的常用路径,例如在 pushpull_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

    【讨论】:

      【解决方案2】:

      这是您可能想尝试的示例。 @xandermonkey 链接的文档中也概述了类似的方法。

      on:
        push:
        pull_request:
          # Run only on changes on these files
          paths:
            - 'lib/**.nim'
            - 'doc/**.rst'
            - '.github/workflows/ci_docs.yml'
      

      【讨论】:

        猜你喜欢
        • 2022-08-10
        • 2023-02-10
        • 1970-01-01
        • 2021-08-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-06-03
        • 2022-01-23
        相关资源
        最近更新 更多