重复使用github操作工作流程
在这里,我想创建分支部署管道。部署将在每个拉的请求下完成,我们需要获取一个分支名称,以便我们调用该分支名称的工作流程。我试图以下面的方式进行操作,但是它给出了错误。
on:
pull_request:
types: [opened, synchronize, reopened]
env:
WORKFLOW: 'bigelio/todo/.github/workflows/branch-deployment-serverless-deploy.yml@${{ github.head_ref }}'
deploy:
needs: [terraform]
uses: $WORKFLOW
secrets:
TF_API_TOKEN: ${{ secrets.TF_API_TOKEN }}
我在github中遇到的错误是
Invalid workflow file: .github/workflows/branch-deployment-workflow.yml#L198
invalid value workflow reference: no version specified
Here I want to create branch deployment pipeline. Deployment will be done on every pull request and we need to get a branch name, so that we call a workflow with that branch name. I have tried to do it in the following way, But it is giving an error.
on:
pull_request:
types: [opened, synchronize, reopened]
env:
WORKFLOW: 'bigelio/todo/.github/workflows/branch-deployment-serverless-deploy.yml@${{ github.head_ref }}'
deploy:
needs: [terraform]
uses: $WORKFLOW
secrets:
TF_API_TOKEN: ${{ secrets.TF_API_TOKEN }}
The error I am getting in github is this
Invalid workflow file: .github/workflows/branch-deployment-workflow.yml#L198
invalid value workflow reference: no version specified
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它不起作用,因为
env
上下文在跑步者上可用,而use
在安排/创建跑步者之前对进行评估。您可以尝试使用
gh
CLI与以下内容:GH Workflow Run Triage.yml -Ref my-Branch
。另外,您可以查看会适合您的需求。
It doesn't work because
env
context is available on a runner, whileuses
is evaluated outside that context, before runner is scheduled/created.You can try using
gh
cli with something like:gh workflow run triage.yml --ref my-branch
.Alternatively, you could see if Environments would suite your needs.