【问题标题】:Can I reference input events in the "post-if" condition in GitHub Action?我可以在 GitHub Action 的“post-if”条件中引用输入事件吗?
【发布时间】:2023-01-26 19:31:48
【问题描述】:

我有一个可以通过 GitHub UI(workflow_dispatch)触发的 GitHub Action,它有一个布尔标志作为输入之一。

我想要做的是 - 在 post-if 中设置一个条件,仅当用户提供的标志设置为 true 时,该条件才被评估为 true

我试着这样写,但没有成功:

post-if: "${{ github.event.inputs.cache }}"

我在 CI 中收到以下错误:

无法识别的命名值:“github”。位于表达式中的位置 1:github.event.inputs.cache

这可行吗?还是不能在post-if 中使用事件输入?

【问题讨论】:

    标签: github github-actions building-github-actions


    【解决方案1】:

    是的,看起来这是可行的。

    我只需要删除大括号{{ }}

    post-if: "github.event.inputs.cache"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-10
      • 1970-01-01
      • 2013-06-14
      相关资源
      最近更新 更多