Skip to content

Commit ae4ab38

Browse files
test: Resolve ci-check failures in long-running CI tests (#11295)
Signed-off-by: vmudadla <[email protected]>
1 parent a0d313e commit ae4ab38

File tree

2 files changed

+37
-17
lines changed

2 files changed

+37
-17
lines changed

.github/workflows/add-ci-passed-label.yml

+13-13
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,7 @@ jobs:
5656
event_action=$(cat ./event_action)
5757
echo "pr_number=${pr_number}" >> $GITHUB_OUTPUT
5858
echo "event_action=${event_action}" >> $GITHUB_OUTPUT
59-
60-
add_ci_passed_label:
61-
name: Add 'ci-passed' label
62-
runs-on: ubuntu-latest
63-
needs: fetch_data
64-
steps:
65-
- name: Add 'ci-passed' label
66-
run: |
67-
echo "Adding 'ci-passed' label to PR #${{ needs.fetch_data.outputs.pr_number }}"
68-
gh pr edit ${{ needs.fetch_data.outputs.pr_number }} --add-label "ci-passed" --repo $GITHUB_REPOSITORY
69-
env:
70-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71-
59+
7260
reset_ci_passed_label:
7361
name: Reset 'ci-passed' label on PR Synchronization
7462
runs-on: ubuntu-latest
@@ -82,3 +70,15 @@ jobs:
8270
fi
8371
env:
8472
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
74+
add_ci_passed_label:
75+
name: Add 'ci-passed' label
76+
runs-on: ubuntu-latest
77+
needs: fetch_data
78+
steps:
79+
- name: Add 'ci-passed' label
80+
run: |
81+
echo "Adding 'ci-passed' label to PR #${{ needs.fetch_data.outputs.pr_number }}"
82+
gh pr edit ${{ needs.fetch_data.outputs.pr_number }} --add-label "ci-passed" --repo $GITHUB_REPOSITORY
83+
env:
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ci-checks.yml

+24-4
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,42 @@
1-
# This workflow checks if all CI checks have passed by polling every 5 minutes for a total of 7 attempts.
1+
# This workflow checks if all CI checks have passed by polling every 5 minutes for a total of 8 attempts.
22
name: CI Check
33

44
on:
55
pull_request:
6-
types: [opened, synchronize, reopened]
6+
types: [opened, synchronize, reopened, labeled]
77

88
jobs:
99
check_ci_status:
1010
runs-on: ubuntu-latest
1111
permissions:
1212
checks: read
1313
pull-requests: write
14-
steps:
14+
steps:
15+
- name: Check out the repository
16+
uses: actions/checkout@v3
17+
18+
- name: Check for 'needs-ok-to-test' and 'ok-to-test' labels
19+
id: label_check
20+
run: |
21+
LABELS=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
22+
if echo "$LABELS" | grep -q 'needs-ok-to-test'; then
23+
echo "Label 'needs-ok-to-test' found. Skipping the workflow."
24+
exit 0
25+
fi
26+
if echo "$LABELS" | grep -q 'ok-to-test'; then
27+
echo "Label 'ok-to-test' found. Continuing the workflow."
28+
else
29+
echo "Label 'ok-to-test' not found. Skipping the workflow."
30+
exit 0
31+
fi
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
1535
- name: Check if all CI checks passed
1636
uses: wechuli/allcheckspassed@0b68b3b7d92e595bcbdea0c860d05605720cf479
1737
with:
1838
delay: '5'
19-
retries: '7'
39+
retries: '8'
2040
polling_interval: '5'
2141
env:
2242
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)