vik*_*nag 43 github-api github-actions building-github-actions
我想为我的 GitHub 操作输入参数创建一个下拉列表。这应该有助于从下拉列表中选择一个值,就像选项如何选择分支一样。
Jon*_*ldt 92
使用 时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 }} / ${{ inputs.environment }}"
echo "boolean is ${{ github.event.inputs.boolean }}" / ${{ inputs.boolean }}
echo "choice is ${{ github.event.inputs.choice }}" / ${{ inputs.choice }}
Run Code Online (Sandbox Code Playgroud)
请注意,现在可以使用context直接访问inputs输入,而不是使用github.event.inputs.
| 归档时间: |
|
| 查看次数: |
45580 次 |
| 最近记录: |