Ale*_*per 10 github github-actions
我有一个工作流程,workflow_dispatch输入默认为空字符串。该工作流程使用本地 github 操作,其自定义输入及其各自的默认值:
# .github/workflow/ci.yml
on:
push:
- main
- wip/**
workflow_dispatch:
inputs:
myInput:
description: An input string
type: string
jobs:
myJob:
steps:
- name: My action step
uses: ./.github/actions/my-action
with:
myInput: ${{ github.event.inputs.myInput }}
Run Code Online (Sandbox Code Playgroud)
# .github/actions/my-action/action.yml
name: 'My action'
description: 'An action'
inputs:
myInput:
description: An input
required: false
default: 'My default input'
runs:
steps:
- name: Run
shell: bash
run: echo Input: ${{ inputs.myInput }}
Run Code Online (Sandbox Code Playgroud)
如果工作流程是由推送触发的,或者如果我使用空输入手动启动工作流程,我希望该操作my-action保留其默认输入值My default input而不是空字符串。
您知道这是否可以从工作流程中实现,而无需调整my-action操作吗?
| 归档时间: |
|
| 查看次数: |
6611 次 |
| 最近记录: |