Skip to content

Commit 9700eb1

Browse files
committed
[ci]: Add retry tests in workflow release chart
Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
1 parent bd0581d commit 9700eb1

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

.github/workflows/helm-chart-release.yml

+34
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ on:
2929
permissions: write-all
3030

3131
env:
32+
GH_CLI_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
GH_CLI_TOKEN_PR: ${{ secrets.SELENIUM_CI_TOKEN || secrets.GITHUB_TOKEN }}
34+
RUN_ID: ${{ github.run_id }}
35+
RERUN_FAILED_ONLY: ${{ github.event.inputs.rerunFailedOnly || true }}
36+
RUN_ATTEMPT: ${{ github.run_attempt }}
3237
FORCE_RELEASE: ${{ github.event.inputs.release == 'true' }}
3338

3439
jobs:
@@ -124,3 +129,32 @@ jobs:
124129
with:
125130
github_token: ${{ secrets.SELENIUM_CI_TOKEN || secrets.GITHUB_TOKEN }}
126131
branch: trunk
132+
133+
rerun-workflow-when-failure:
134+
name: Rerun workflow when failure
135+
needs:
136+
- helm-chart-test
137+
if: failure() && ( github.run_attempt < 3 )
138+
runs-on: ubuntu-24.04
139+
steps:
140+
- name: Checkout code
141+
uses: actions/checkout@main
142+
- name: Install GitHub CLI
143+
run: |
144+
sudo apt update
145+
sudo apt install gh
146+
- name: Authenticate GitHub CLI for PR
147+
if: github.event_name == 'pull_request'
148+
run: |
149+
echo "$GH_CLI_TOKEN_PR" | gh auth login --with-token
150+
- name: Authenticate GitHub CLI
151+
if: github.event_name != 'pull_request'
152+
run: |
153+
echo "$GH_CLI_TOKEN" | gh auth login --with-token
154+
- name: Rerun workflow when failure
155+
run: |
156+
echo "Rerun workflow ID $RUN_ID in attempt #$(($RUN_ATTEMPT + 1))"
157+
gh workflow run rerun-failed.yml \
158+
--repo $GITHUB_REPOSITORY \
159+
--raw-field runId=$RUN_ID \
160+
--raw-field rerunFailedOnly=$RERUN_FAILED_ONLY

0 commit comments

Comments
 (0)