我在用着workflow_run.conclusion
按照以下方式发送工作流程通知github 文档 https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-based-on-the-conclusion-of-another-workflow.
问题是它随机不匹配success
状态,我不明白发生了什么,或者如何获取有关此问题的更多信息。
让我举一个例子:
有一个构建 API 的工作流程,然后根据其完成情况触发通知作业。这是通知作业的步骤:
steps:
- name: Send slack notification on success
if: ${{ github.event.workflow_run.conclusion == 'success' }}
env:
GIT_BRANCH: ${{ needs.get_envs.outputs.GIT_BRANCH }}
GIT_SHA_SHORT: ${{ needs.get_envs.outputs.GIT_SHA_SHORT }}
GIT_MESSAGE: ${{ needs.get_envs.outputs.GIT_MESSAGE }}
id: success
run: |
slack_message_text="${WORKFLOW_NAME} | ${WORKFLOW_RUN_CONCLUSION}"
[other run actions -- redacted]
now, the build workflow finished successfully
and triggers the notification workflow based on completion:
on:
workflow_run:
workflows:
- Deploy API Backend
types:
- completed
branches:
- master
它运行,但随机(这非常烦人)与触发它的工作流的完成退出状态不匹配。在这种情况下,作业成功完成,并且有一个Successful
状态,但 github 操作不匹配success
并忽略了该步骤:(
这只是随机发生的。它在大多数情况下与成功状态匹配,并且按预期工作:
这可能是一个区分大小写的问题,其他人也得到过这个吗?
有什么解决方法的建议吗?
L.E.看起来像github.event.workflow_run.conclusion
随机返回空字符串,匹配失败。有谁知道为什么会这样?