diff --git a/.github/workflows/bazel.yml b/.github/workflows/bazel.yml index af674592bb9..73a49aa6a64 100644 --- a/.github/workflows/bazel.yml +++ b/.github/workflows/bazel.yml @@ -7,6 +7,7 @@ on: - master - develop - bazel + jobs: build: name: "bazel-compile (${{ matrix.os }})" @@ -19,4 +20,13 @@ jobs: - name: Build run: bazel build --config=remote //... - name: Run Tests - run: bazel test --config=remote //... \ No newline at end of file + run: bazel test --config=remote //... + - name: Retry if failed + # if it failed , retry 2 times at most + if: failure() && fromJSON(github.run_attempt) < 3 + env: + GH_REPO: ${{ github.repository }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo "Attempting to retry workflow..." + gh workflow run rerun-workflow.yml -F run_id=${{ github.run_id }} \ No newline at end of file diff --git a/.github/workflows/maven.yaml b/.github/workflows/maven.yaml index 06db86e0157..3291d993ea0 100644 --- a/.github/workflows/maven.yaml +++ b/.github/workflows/maven.yaml @@ -31,4 +31,13 @@ jobs: with: name: jvm-crash-logs path: /Users/runner/work/rocketmq/rocketmq/auth/hs_err_pid*.log - retention-days: 1 \ No newline at end of file + retention-days: 1 + - name: Retry if failed + # if it failed , retry 2 times at most + if: failure() && fromJSON(github.run_attempt) < 3 + env: + GH_REPO: ${{ github.repository }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo "Attempting to retry workflow..." + gh workflow run rerun-workflow.yml -F run_id=${{ github.run_id }} \ No newline at end of file diff --git a/.github/workflows/rerun-workflow.yml b/.github/workflows/rerun-workflow.yml new file mode 100644 index 00000000000..2f3258c1f6e --- /dev/null +++ b/.github/workflows/rerun-workflow.yml @@ -0,0 +1,18 @@ +name: Rerun workflow +on: + workflow_dispatch: + inputs: + run_id: + required: true + +jobs: + rerun: + runs-on: ubuntu-latest + steps: + - name: rerun ${{ inputs.run_id }} + env: + GH_REPO: ${{ github.repository }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh run watch ${{ inputs.run_id }} > /dev/null 2>&1 + gh run rerun ${{ inputs.run_id }} --failed \ No newline at end of file