如何使用 GithubActions 工作流程调用 PowerShell 脚本?

how to call PowerShell script with a GithubActions workflow?

我正在呼叫 .\build.ps1,它似乎挂了:

https://github.com/nblockchain/ZXing.Net.Xamarin/runs/232358091

我需要一些特别的东西吗?在 AzureDevOps 中,这是开箱即用的。

如评论中所同意,此问题的解决方案是在您的 Action 文件中将 shell 指定为 运行。在您的情况下,您必须更改为:

    - name: Build
      run: |
        .\build.ps1

至:

    - name: Build
      shell: pwsh
      run: |
        .\build.ps1

有关 shell 参数可用值的更多详细信息,请参阅 documentation