【发布时间】:2021-12-02 02:24:10
【问题描述】:
我在运行 GitHub 操作时以这种格式生成工作流日志
${{ github.workflow }}-${{ github.run_id }}-${{ github.run_number }}.log
我想获取我们在其余调用中看到的工作流 ID
"workflow_runs": [
{
"id": 30433642,
"name": "Build",
}
]
在这里查看:https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
有没有一种方法可以在运行 gh action 时获取工作流 ID?
【问题讨论】:
-
是的,您可以从工作流 Github Context 中获取 run_id。这是它将在 PR 上以 JSON 格式返回的示例:gist.github.com/GuillaumeFalourd/…(这里是显示或操作对象的工作流实现:github.com/GuillaumeFalourd/poc-github-actions/blob/main/… 和运行示例:github.com/GuillaumeFalourd/poc-github-actions/runs/…)。让我知道这是否足以解决您的问题:)
标签: github continuous-integration github-actions