github 操作中的 'nonzero return code 128' 是什么意思?

What does 'nonzero return code 128' in github actions mean?

我在 github 操作中遇到以下错误:

[info] welcome to sbt 1.4.2 (Oracle Corporation Java 1.8.0_222)
[info] loading settings for project workspace-build from plugins.sbt ...
[info] loading project definition from /github/workspace/project
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
[info] loading settings for project root from build.sbt,github_action_sbt_settings.sbt ...
fatal: No names found, cannot describe anything.
fatal: No names found, cannot describe anything.
fatal: No names found, cannot describe anything.
fatal: No names found, cannot describe anything.
java.lang.RuntimeException: Nonzero exit value: 128
    at scala.sys.package$.error(package.scala:30)
    at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.slurp(ProcessBuilderImpl.scala:138)
    at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.$bang$bang(ProcessBuilderImpl.scala:108)
    at co.blocke.gfpack.GFPackagerPlugin$.$anonfun$projectSettings(GFPackagerPlugin.scala:60)
    at sbt.internal.util.Init$Value.$anonfun$apply(Settings.scala:922)
    at sbt.internal.util.EvaluateSettings.$anonfun$constant(INode.scala:211)
    at sbt.internal.util.EvaluateSettings$MixedNode.evaluate0(INode.scala:228)
    at sbt.internal.util.EvaluateSettings$INode.evaluate(INode.scala:170)
    at sbt.internal.util.EvaluateSettings.$anonfun$submitEvaluate(INode.scala:87)
    at sbt.internal.util.EvaluateSettings.sbt$internal$util$EvaluateSettings$$run0(INode.scala:99)
    at sbt.internal.util.EvaluateSettings$$anon.run(INode.scala:94)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
[error] Nonzero exit value: 128
[error] Use 'last' for the full log.
[warn] Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? (default: r)

此时我的回购已被检出并且 JDK 13 已配置(尽管我在这里看到它出于某种原因使用 Java 1.8)。

128码是什么意思?

这在本地构建良好。 sbt 像这样在本地启动:

[info] welcome to sbt 1.4.2 (Oracle Corporation Java 13.0.1)
[info] loading global plugins from /Users/wmy965/.sbt/1.0/plugins
[info] loading settings for project scalajack-build from plugins.sbt ...
[info] loading project definition from /Users/wmy965/git/ScalaJack/project
[info] loading settings for project root from build.sbt ...
[info] set current project to scalajack (in build file:/Users/wmy965/git/ScalaJack/)
[info] sbt server started at local:///Users/wmy965/.sbt/1.0/server/84b4cffb6c175e13afb2/sock
sbt:scalajack> exit

怎么了?它在寻找什么“名字”? (有没有办法 运行 'last',就像在命令行上一样,在一个动作中,以便查看它在抱怨什么?)

这是它尝试的工作流 yml 运行:

name: Package Release
# This workflow is triggered on pushes to the repository.
on: 
  push: 
    branches:
      - "master"  # only release on a push to main

jobs:
  build:
    name: Release
    runs-on: ubuntu-latest

    steps:
      - name: Set up JDK 13
        uses: actions/setup-java@v1
        with:
          java-version: '13.0.1'
      - name: Checkout repo
        uses: actions/checkout@v2
      - name: Test and Release
        env:
          BINTRAY_USER: ${{ secrets.BINTRAY_UID }}
          BINTRAY_PASS: ${{ secrets.BINTRAY_PWD }}
          BUILD_VERSION: ${{ github.event.ref }}
        id: release
        uses: lokkju/github-action-sbt@master
        with:
          commands: "test; publish"

您的代码调用 git describe,它使用存储库中的标签为当前提交提供名称。如果没有它可以使用的标签,那么 Git 将以状态代码 128 退出,以便用户可以轻松检测到它失败了。

在您的情况下,您使用的是 actions/checkout 操作的 v2,它执行浅层克隆。因此,您的存储库几乎永远不会包含任何标签(或任何其他历史记录)并且 git describe 将无法工作。

如果你想让git describe在你的项目中工作,那么你需要像这样调整参数:

- name: Checkout repo
  uses: actions/checkout@v2
  with:
    fetch-depth: 0

这将克隆整个存储库,允许您访问标签,但因此,最初克隆会慢得多。作为替代方案,您可以简单地删除代码库中调用 git describe.

的代码