Skip to content

Commit

Permalink
Enable retry mechanism when submitting PR
Browse files Browse the repository at this point in the history
  • Loading branch information
chi3316 committed Sep 24, 2024
1 parent 525f877 commit b80252a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 37 deletions.
15 changes: 1 addition & 14 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ on:
- develop
- bazel

permissions:
actions: write

jobs:
build:
name: "bazel-compile (${{ matrix.os }})"
Expand All @@ -23,14 +20,4 @@ jobs:
- name: Build
run: bazel build --config=remote //...
- name: Run Tests
run: bazel test --config=remote //...
- name: Retry if failed
# if it failed , retry 2 times at most
if: failure() && fromJSON(github.run_attempt) < 3
continue-on-error: true
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 }}
run: bazel test --config=remote //...
16 changes: 1 addition & 15 deletions .github/workflows/maven.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ on:
push:
branches: [master, develop, bazel]

permissions:
actions: write

jobs:
java_build:
name: "maven-compile (${{ matrix.os }}, JDK-${{ matrix.jdk }})"
Expand Down Expand Up @@ -44,15 +41,4 @@ jobs:
with:
name: jvm-crash-logs
path: /Users/runner/work/rocketmq/rocketmq/broker/hs_err_pid*.log
retention-days: 1

- name: Retry if failed
# if it failed , retry 2 times at most
if: failure() && fromJSON(github.run_attempt) < 3
continue-on-error: true
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 }}
retention-days: 1
17 changes: 9 additions & 8 deletions .github/workflows/rerun-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
name: Rerun workflow
on:
workflow_dispatch:
inputs:
run_id:
required: true
workflow_run:
workflows: ["Build and Run Tests by Maven", "Build and Run Tests by Bazel"]
types:
- completed

permissions:
actions: write

jobs:
rerun:
if: github.event.workflow_run.conclusion == 'failure' && fromJSON(github.event.workflow_run.run_attempt) < 3
runs-on: ubuntu-latest
steps:
- name: rerun ${{ inputs.run_id }}
- name: rerun ${{ github.event.workflow_run.id }}
env:
GH_REPO: ${{ github.repository }}
GH_REPO: ${{ github.event.workflow_run.id }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh run watch ${{ inputs.run_id }} > /dev/null 2>&1
gh run rerun ${{ inputs.run_id }} --failed
gh run watch ${{ github.event.workflow_run.id }} > /dev/null 2>&1
gh run rerun ${{ github.event.workflow_run.id }} --failed

0 comments on commit b80252a

Please sign in to comment.