工作流文件应位于哪个分支上,以便GitHub Action执行它们? [英] Which branch should workflow files be located on for GitHub Actions to execute them?

查看:71
本文介绍了工作流文件应位于哪个分支上,以便GitHub Action执行它们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在主分支上创建了

on:  
  push:
      branches: [ test ]

我注意到,尽管我可以手动触发它,并且它可以工作,但是如果我按 test ,它实际上不会触发.为此,我需要在 test 上创建相同的操作文件.现在,看来我什至不需要在 main 分支上执行操作,对吗?

I have noticed, that while I can trigger it manually, and it will work, it will not actually trigger if I push to test. For that, I needed to create that same action file on test. Now, it seems like I don't even need to have the action on the main branch, is that correct?

那么,为什么即使该选项也指定了应该触发的分支呢?无论如何,它仅在文件存在的分支上触发.就是说,我感到很沮丧,我必须将一个文件从main合并到我的测试分支,即使我没有在 test 上使用它,也有一种方法可以在推送时自动触发操作分支,仅在 main 上?

So why does even the option so specify the branch that it should trigger on exist? It only triggers on the branches the file exists anyway. That said, I found it frustrating that I have to merge my one file from main to my test branch, is there a way to trigger the action automatically on push even if I do not have it on my test branch, only on main?

推荐答案

否,这是不可能的.

在存储库中的 .github/workflows 目录中,在关联的提交SHA或Git引用中搜索工作流文件.必须将工作流文件存在于该提交SHA或Git引用中.

The .github/workflows directory in your repository is searched for workflow files at the associated commit SHA or Git ref. The workflow files must be present in that commit SHA or Git ref to be considered.

例如,如果事件发生在特定的存储库分支上,则工作流文件必须存在于该分支上的存储库中.

For example, if the event occurred on a particular repository branch, then the workflow files must be present in the repository on that branch.

这篇关于工作流文件应位于哪个分支上,以便GitHub Action执行它们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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