【问题标题】:Is there any way we can get workflow step trigger types in the followed step to put a condition? [github actions]有什么方法可以在后续步骤中获取工作流步骤触发器类型以设置条件? [github动作]
【发布时间】:2021-04-24 14:21:55
【问题描述】:

我在: 拉取请求: 类型:[打开,同步,重新打开,编辑]

工作: 拉取请求: 脚步: - 名称:第 1 步 // - 名称:第 2 步 // - 名称:第 3 步 // 当工作流类型定义为“打开、同步、重新打开、编辑”时触发工作流

我想根据触发工作流的类型跳过一些步骤 基本上添加一个条件,如果 TYPE = synchronize 则运行步骤 1 并在 TYPE 打开时运行步骤 2 让我知道它是否可能或我们可以实施的任何解决方法

【问题讨论】:

    标签: github-actions


    【解决方案1】:

    您可以使用github.event_name,它为您提供The name of the event that triggered the workflow run

    然后使用类似的条件

    if: github.event_name == 'pull_request' && github.event.action == 'opened'
    

    【讨论】:

    • 谢谢!需要github.event.action == 'opened'
    • 如果我的回复解决了您的问题,您能否考虑将其标记为答案?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-19
    • 1970-01-01
    • 2020-03-03
    • 2015-01-20
    • 2020-01-01
    相关资源
    最近更新 更多