简体   繁体   English

在 CircleCI 工作流或作业之后触发 Github 动作

[英]Trigger Github Action after CircleCI workflow or job

I would like to set up github actions in order to perform security scans on docker images.我想设置 github 操作,以便对 docker 图像执行安全扫描。 However, the build and push of the image I would like to scan is made by CircleCI.但是,我要扫描的图像的构建和推送是由 CircleCI 完成的。 Hence I need to make sure that the images have been properly built and pushed on my repo before performing the security scan.因此,在执行安全扫描之前,我需要确保图像已正确构建并推送到我的存储库中。

I know there exists an action to trigger a CircleCI job, but is there any way to trigger the execution of my Github action from Circle CI?我知道存在触发 CircleCI 作业的操作,但是有什么方法可以触发 Circle CI 执行我的 Github 操作?

Thank you for the answers or any workaround you could provide:)感谢您的回答或您可以提供的任何解决方法:)

You could use a repository dispatch event from you CircleCI pipeline to start a repository workflow (through CURL or through a script).您可以使用 CircleCI 管道中的存储库调度事件来启动存储库工作流(通过 CURL 或通过脚本)。

In that case, your Github repository workflow file will need a repository_dispatch event to trigger it, to perform your security scan job.在这种情况下,您的 Github 存储库工作流文件将需要一个repository_dispatch事件来触发它,以执行您的安全扫描作业。

Dispatch Request Example调度请求示例

curl \
 -X POST \
 -H "Accept: application/vnd.github.v3+json" \
 https://api.github.com/repos/<USERNAME>/<REPOSITORY-NAME>/dispatches \
 -d '{"event_type":"event_type"}'

Workflow Trigger Example工作流触发器示例

on: [repository_dispatch]

jobs:
  scan:
   runs-on: ubuntu-latest
   steps:
     - name: security scan
       run:|
        ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM