GitHub Actions工作流程workflow_dispatch手动运行工作流程-大多数标签被禁用

huangapple go评论57阅读模式
英文:

github actions workflow workflow_dispatch running a workflow manually - most of the Tags are disabled

问题

我正在使用GitHub Actions工作流进行代码部署。其中一个流程是手动触发,使用workflow_dispatch。我能够选择主分支或任何特性分支,但当我选择标签时,大多数标签都被禁用,并显示以下错误消息:

“工作流不存在或在此标签中没有workflow_dispatch触发器。
了解更多关于手动工作流的信息”

如果我创建一个新的Git标签,我就能够部署。请帮我分享相关的逻辑和原因。谢谢。

英文:

I am using github actions workflow for code deployment. One of the flow is manual using workflow_dispatch. I am able to select main or any feature branch but when i select tags - most of them are disabled and gives you below error message:

"Workflow does not exist or does not have a workflow_dispatch trigger in this tag.
Learn more about manual workflows"

If I create a new git tag, i am able to deploy. Please help me by sharing the logic and reasoning. Thanks,

答案1

得分: 0

如果在创建标签时工作流程不存在,该标签就不可用。分支也是同样的情况。

修复的方法是要么在那里挑选工作流程并移动标签,要么将标签重新基于master分支设置。

还要记住,如果你在master分支上修改了工作流程,但是在其他分支上有不同版本的工作流程 - 它会使用分支/标签的版本。

如果你想在所有标签中保持一个版本 - 你应该将tag作为输入变量传递,并在master分支上运行它,而不是在该标签上运行工作流程。然后,你只需要修改你的checkout-action来检出传递的标签,而不是将其保留在默认值上。

英文:

If workflow didn't exist when the tag was created, it's not available. The same goes for branches.

The way to fix it is to either cherry-pick workflow there and move a tag or re-base the tag on top of the master branch.

Also keep in mind if you modify workflow on your master branch, but you have a different version in branches - it will use the branch / tag version.

If you want to keep 1 version across all tags - you should pass a tag as an input variable and run it on master branch instead of running workflow on this tag. Then you just have to modify your checkout-action to checkout the passed tag, not leaving it with defaults.

huangapple
  • 本文由 发表于 2023年2月10日 05:53:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/75404816.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定