[英]Github actions: read branch changes on workflow_run
I have two workflows: CI (for continuous integration) and CD (for continuous delivery).我有两个工作流程:CI(用于持续集成)和 CD(用于持续交付)。 My goal is if someone makes a changes to branches other than master branches, I want to execute CD as well on that branch我的目标是如果有人对主分支以外的分支进行更改,我也想在该分支上执行 CD
But its taking ref as master in CD但它以 ref 作为 CD 中的主控
ci.yaml ci.yaml
name: CI
on:
push:
branches:
- master
- test
pull_request:
types: [opened, synchronize, ready_for_review]
branches:
- master
cd.yaml cd.yaml
name: CD
on:
workflow_run:
workflows: ["CI"]
types:
- completed
jobs:
deployment:
name: CD
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
When I make changes to test branch, CD is not picking up the changes in test branch, instead working with defaul master config.当我对测试分支进行更改时,CD 不会获取测试分支中的更改,而是使用默认主配置。 How to make workflow_run to pick up branch changes如何使 workflow_run 获取分支更改
If I correctly understood what you are looking for, ie having the name of the original branch whose CI workflow triggered CD, changing如果我正确理解了您要查找的内容,即具有 CI 工作流触发 CD 的原始分支的名称,则更改
github.ref
with:和:
github.event.workflow_run.head_branch
will solve the problem会解决问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.