从文件创建 Github Actions 选择输入选项
目前,我们正在运行手动工作流程,以便将我们的产品部署到生产环境中。我们只有一项输入,就可以选择需要部署的品牌。
它包括诸如此类的选项
on:
workflow_dispatch:
inputs:
dst:
type: choice
description: Select destination brand
required: true
options:
- A
- B
- C
我
的问题是,是否可以从文件(例如我们项目中的文本文件)读取此选项?我看了看,但没有看到其他人的解决方案。
太感谢了!
Right now, we're running a manual workflow in order to deploy our product to production. We have one input and we can choose our brand which needs to be deployed.
It's including options like
on:
workflow_dispatch:
inputs:
dst:
type: choice
description: Select destination brand
required: true
options:
- A
- B
- C
and so on
My question is, is it possible to read this options from a file (like a text file which is in our project)? I looked at it but I couldn't see a solution from others.
Thank you so much!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不 - 恐怕目前不可能进行动态工作流程配置。
我个人使用的解决方案是使用 workflow_dispatch 事件,具有正确的
输入
选项。您可以使用一个脚本在本地读取包含所有选项的文件并让您在本地选择所需的选项,而不是在网络上手动触发它,然后它将使用所选输入触发
workflow_dispatch
事件。如果您不希望本地解析,另一种选择是将输入作为常规
字符串
,然后在工作流程中添加一个步骤,该步骤将在actions/checkout
之后读取文件并检查它是否是一个有效的选项。No - it's not possible to have dynamic workflow configurations at the moment, I'm afraid.
The solution I personally use is to trigger this type of workflow using workflow_dispatch event with proper
input
options.Instead of triggering it manually on web, you can have a script that locally reads the file with all options and let you pick desired option locally, then it will trigger
workflow_dispatch
event with the selected input.Another alternative if you don't want local parsing will be to make input as regular
string
and then add a step in your workflow that will read a file afteractions/checkout
and check if it's a valid option.一种黑客可能是使用第二个工作流程(wkfl2)来维护workflow_dispatch(wkfl1)选项。类似于以下序列:
One hack could be using a second workflow (wkfl2) to maintain the workflow_dispatch (wkfl1) options. Something like the following sequence: