我正在尝试为GitHub Actions设置自定义操作,目前这是我的代码:
name: 'Install Dependencies'
inputs:
os:
description: 'The OS to fetch the dependencies for'
required: True
runs:
using: "composite"
steps:
- run: echo I am a test
shell: bash
if: startsWith(os, 'Linux')
我想做的是最终拥有一堆不同的 shell 脚本,这些脚本将根据特定的操作系统来完成任务,因此在我的操作中,我希望根据传递进来的
os
参数选择适当的脚本。然而,当我像上面那样调用操作时,会出现
Unexpected value 'if'
的错误。所以我的问题是:如果条件符合,如何只运行执行run
命令?