【发布时间】:2021-09-08 23:43:00
【问题描述】:
有没有办法在运行后执行命令,无论之前的状态是成功还是失败,类似于 post 和 jenkinsfile 中的语法
我试过 continue-on-error: true 但这会使失败的步骤通过
【问题讨论】:
标签: yaml workflow pipeline github-actions
有没有办法在运行后执行命令,无论之前的状态是成功还是失败,类似于 post 和 jenkinsfile 中的语法
我试过 continue-on-error: true 但这会使失败的步骤通过
【问题讨论】:
标签: yaml workflow pipeline github-actions
您可以将Job Status Check Functions 与dependencies between jobs 一起使用。
例如:
jobs:
job1:
continue-on-error: true
# Do your stuff here
job2:
if: ${{ always() }}
# Execute your post run command here
我创建了一个示例工作流,以在此条件下使用 continue-on-error 显示 something similar working here。
您会在该示例中看到,即使在 job2 上出现错误,之后仍会执行 job3。 这个workflow run 返回类似这样的内容(没有工作流失败并且总是在作业 3 上执行运行后命令):
【讨论】: