Github动作-完成一个动作后触发另一个动作 [英] Github Actions - trigger another action after one action is completed

查看:158
本文介绍了Github动作-完成一个动作后触发另一个动作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个动作(一个yaml文件)用于将docker映像部署到Google Cloud Run.

I have one action (a yaml file) for deploying a docker image to Google Cloud Run.

我希望收到Slack或Email消息,通知构建和推送结果.

I would like to receive Slack or Email messages informing the build and push results.

构建操作完成后如何触发消息操作?

How could the message action be triggered after build action is completed?

是否可以获得构建操作的结果?

Is it possible to get the result of the build action?

推荐答案

首先,您要在此处混合术语.根据 GitHub Actions文档,单个YAML文件称为工作流程(不是操作),由职位组成.作业包含一个接一个执行的一系列步骤(包括动作).特定的工作流程执行称为运行.记住这一点,就可以解决问题.

First, you are mixing terms here. According to GitHub Actions documentation a single YAML file is called a workflow (not an action) and consists of jobs. Jobs contain a sequence of steps (including actions) that are executed one after another. A particular workflow execution is called a run. Having that in mind lets go the questions.

构建工作流程完成后,如何触发消息工作流程?

How could the message workflow be triggered after build workflow is completed?

您可以使用GitHub API触发名为 workflow_dispatch .在构建工作流程中使用专用的存储库分发操作即可轻松完成此操作. >

You can use GitHub API to trigger a webhook event called repository_dispatch (only for the base branch) or workflow_dispatch. This can be easily done using a dedicated Repository Dispach action in your build workflow.

是否可以获得构建工作流程的结果?

是的,可以使用 GitHub API

但是,如果您只想发送当前执行的工作流的构建结果通知,则无需创建单独的工作流并从父级触发它.您可以使用专用的松弛动作电子邮件操作.

But if you only want to send the build result notification of the currently executed workflow you don't need to create a separate workflow and trigger it from the parent. You can use dedicated Slack actions or e-mail actions.

这篇关于Github动作-完成一个动作后触发另一个动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆