github - 如何链接 github 操作工作流
问题描述
我是 github 操作的新手,我写了 3 个工作流。我的用例如下。
- Workflow-1 应该在开发人员创建 pr 请求以及每次向 PR 推送提交时运行。
- 当有人在 pr 上评论“/deploy”时,它应该触发整个工作流程-1,并且应该在评论中添加一个反应(无论构建如何)
我不确定如何链接所有这 3 个工作流程以实现上述结果。有人可以帮我吗。
工作流程-1:
name: "Terraform Pull Request Builder"
on: [push,pull_request]
jobs:
validate:
name: Validate terraform configuration
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2
- uses: hashicorp/setup-terraform@v1
with:
terraform_version: 0.12.28
- uses: aws-actions/configure-aws-credentials@v1 #https://github.com/aws-actions/configure-aws-credentials#usage
id: assume
with:
aws-region: us-east-1
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
- name: Terraform fmt
id: fmt
run: terraform fmt -check
continue-on-error: true
.... more code to terraform plan and commenting the output back on the PR
工作流程-2
name: Slash Command Dispatch
on:
issue_comment:
types: [created, deleted]
jobs:
slashCommandDispatch:
runs-on: ubuntu-latest
steps:
- name: Slash Command Dispatch
uses: peter-evans/slash-command-dispatch@v2
id: comment
with:
token: ${{ secrets.PAT }}
reaction-token: ${{ secrets.PAT }}
commands: |
deploy
工作流程-3
name: Reaction
on:
repository_dispatch:
types: [deploy-command]
jobs:
helloWorld:
runs-on: ubuntu-latest
steps:
- name: Add reaction
uses: peter-evans/create-or-update-comment@v1
with:
token: ${{ secrets.PAT }}
issue-number: ${{ github.event.client_payload.github.payload.issue.number }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
reaction-type: hooray
解决方案
推荐阅读
- r - 如何使用 R 通过向量通过迭代或组合构造输入字符串?
- linux-kernel - SMAP/SMEP 是否会阻止用户空间 (kmalloc) 中的分配?
- android - 使用 mActivity = context 在片段 onAttach 中是否存在内存泄漏?
- php - 在 Laravel-8 项目中创建数据不起作用,如何解决?
- docusignapi - 如何使所有自定义字段在docusign中共享?
- python - 为什么后端python编译器不能返回结果?
- python-3.x - 使用 Selenium Python 单击具有相同类名但具有不同 ID 的所有类似按钮,这些按钮都有一个共同词
- mysql - 高版本的mysql备份恢复太慢
- python - (pip)安装后使用pyinstaller时出现无法识别的命令错误
- python - 在python中找不到类变量