github-actions - GitHub Workflows 输入参数的下拉列表
问题描述
我想为我的 GitHub 操作输入参数创建一个下拉列表。这应该有助于从下拉列表中选择一个值,就像选择分支的选项一样。
解决方案
使用 时workflow_dispatch
,现在可以有choice
,boolean
和environment
输入,而不仅仅是字符串。choice
是一个下拉列表,boolean
是一个复选框,environment
类似choice
但会自动填充在您的存储库设置中配置的所有环境。
这是使用新类型的示例工作流程:
name: CI
on:
workflow_dispatch:
inputs:
environment:
type: environment
description: Select the environment
boolean:
type: boolean
description: True or False
choice:
type: choice
description: Make a choice
options:
- foo
- bar
- baz
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: greet
run: |
echo "environment is ${{ github.event.inputs.environment }}"
echo "boolean is ${{ github.event.inputs.boolean }}"
echo "choice is ${{ github.event.inputs.choice }}"
推荐阅读
- python - Python 多处理返回以块大小设置的结果
- python - 使用欧几里得算法找到两个数字的 GCD?
- laravel - Laravel 的主管工作人员不起作用
- python - 部分:不允许覆盖给定的关键字参数
- python - 使用变量和字符串通过 posixpath 创建名称
- excel - 尽管有日期值,字符串日期未转换为日期类型
- jsf - Primefaces 8 ajax状态在p:dataTable分页后没有隐藏
- javascript - Dropbox Upload Javascript:TypeError:“在未实现接口 Window 的对象上调用了'fetch'。”
- javascript - JavaScript:仅检测浏览器关闭事件而不是标签关闭和刷新?
- python - Python Sympy 几个波的叠加