问题描述
我正在尝试编写一个可在所有平台(包括 Windows)上运行的复合运行步骤操作。
runs:
using: "composite"
steps:
- run: Flutter pub get
working-directory: ${{ inputs.working-dir }}
当我省略 shell 时,我收到错误“必需参数 shell 丢失”。这很奇怪,因为我只想使用操作系统的默认设置。
当我指定 'bash' 时,我在 Windows 运行器上收到错误 file not found 'bash'
,但根据文档“在 Windows 上指定 bash shell 时,使用 Git for Windows 中包含的 bash shell ." https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell
我只想使用默认 shell 在所有平台上通过操作运行 Flutter pub get
。有什么简单的方法可以做到这一点吗?
解决方法
确保包含 bash
可执行文件的文件夹位于运行 GitHub Actions 运行程序的 Windows 用户的 PATH
环境变量中。您引用的文档是关于 GitHub 托管的运行程序。
您收到错误,因为复合运行操作需要 shell
。原因是,除了非常简单的脚本之外,由于它们的巨大差异,您将无法在不同的shell中运行脚本。
另见the docs