代码之家  ›  专栏  ›  技术社区  ›  Alex Cohen

如何在github操作中重试pipline作业?

  •  -1
  • Alex Cohen  · 技术社区  · 4 年前

    我正在构建github操作管道,我想在我的作业中添加一个类似于 the retry keyword works in gitlab ,如果出现故障,将再次运行完整步骤。github操作中是否有允许这样做的内容?

    以下是我正在使用的一个示例工作:

    jobs:
      env-check:
        runs-on: ubuntu-latest
        container:
          image: myimage
        steps:
          - uses: actions/checkout@v2
          - name: env-check
            run: |
              echo "foobar"
    
    0 回复  |  直到 4 年前
        1
  •  7
  •   VonC    4 年前

    GitHub Action语法中似乎没有重试,这就是为什么你会发现互补的GitHub Actions,比如:

    • Retry Step :在失败或超时时重试操作步骤。目前,这是为了取代moody命令的运行步骤。
    • Retry Action :失败时重试Github操作步骤或命令。

    示例:

    uses: nick-fields/retry@v2
    with:
      timeout_minutes: 10
      max_attempts: 3
      command: npm run some-typically-slow-script
    
    推荐文章