Skip to content

Commit 5832cc4

Browse files
committed
update
2 parents 8200040 + acd3317 commit 5832cc4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+5963
-1270
lines changed

.github/rerun-workflow/action.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: 'Rerun Workflow'
2+
description: 'Re-run GitHub Actions workflow for a given Pull Request'
3+
inputs:
4+
GITHUB_TOKEN:
5+
description: 'GitHub token with repo scope'
6+
required: true
7+
OWNER:
8+
description: 'Repository owner'
9+
required: true
10+
REPO:
11+
description: 'Repository name'
12+
required: true
13+
PR_ID:
14+
description: 'Pull Request ID'
15+
required: true
16+
JOB_NAME:
17+
description: 'Job name to rerun'
18+
required: true
19+
20+
runs:
21+
using: 'composite'
22+
steps:
23+
- run: bash ./.github/actions/rerun-workflow/rerun.sh
24+
shell: bash
25+
env:
26+
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
27+
OWNER: ${{ inputs.OWNER }}
28+
REPO: ${{ inputs.REPO }}
29+
PR_ID: ${{ inputs.PR_ID }}
30+
JOB_NAME: ${{ inputs.JOB_NAME }}

.github/rerun-workflow/rerun.sh

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
set -e
16+
17+
COMMIT_SHA=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
18+
"https://api.github.com/repos/$OWNER/$REPO/pulls/$PR_ID" | jq -r '.head.sha')
19+
20+
echo "Commit SHA: $COMMIT_SHA"
21+
22+
response=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
23+
"https://api.github.com/repos/$OWNER/$REPO/actions/runs?head_sha=$COMMIT_SHA&per_page=100")
24+
25+
echo "Response: $response"
26+
27+
run_ids=$(echo "$response" | jq -r '.workflow_runs[].id')
28+
29+
if [ -n "$run_ids" ]; then
30+
echo "Found run_ids for commit $COMMIT_SHA: $run_ids"
31+
32+
for run_id in $run_ids; do
33+
if [ "$JOB_NAME" = "all-failed" ]; then
34+
echo "Rerunning all failed jobs for run_id: $run_id"
35+
36+
rerun_response=$(curl -X POST -s -w "%{http_code}" -o /dev/null \
37+
-H "Accept: application/vnd.github.v3+json" \
38+
-H "Authorization: Bearer $GITHUB_TOKEN" \
39+
"https://api.github.com/repos/$OWNER/$REPO/actions/runs/$run_id/rerun-failed-jobs")
40+
if [ "$rerun_response" -eq 201 ]; then
41+
echo "Successfully requested rerun for all blocked jobs in run_id: $run_id"
42+
else
43+
echo "Failed to request rerun for run_id: $run_id with status code $rerun_response"
44+
fi
45+
46+
else
47+
jobs_response=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
48+
"https://api.github.com/repos/$OWNER/$REPO/actions/runs/$run_id/jobs")
49+
50+
echo "Jobs Response for run_id $run_id: $jobs_response"
51+
52+
# if [[ "$JOB_NAME" == *"bypass"* ]]; then
53+
block_jobs=$(echo "$jobs_response" | jq -r --arg job_name "$JOB_NAME" \
54+
'.jobs[] | select(.name == $job_name) | .id')
55+
# else
56+
# block_jobs=$(echo "$jobs_response" | jq -r --arg job_name "$JOB_NAME" \
57+
# '.jobs[] | select(.name == $job_name and .conclusion != "success") | .id')
58+
# fi
59+
60+
if [ -n "$block_jobs" ]; then
61+
echo "Found block jobs for run_id $run_id: $block_jobs"
62+
63+
for job_id in $block_jobs; do
64+
echo "Rerunning job_id: $job_id"
65+
curl -X POST -H "Accept: application/vnd.github.v3+json" \
66+
-H "Authorization: token $GITHUB_TOKEN" \
67+
"https://api.github.com/repos/$OWNER/$REPO/actions/jobs/$job_id/rerun"
68+
done
69+
else
70+
echo "No block jobs found for run_id $run_id with name $JOB_NAME."
71+
fi
72+
fi
73+
done
74+
else
75+
echo "No matching workflow runs found for commit $COMMIT_SHA."
76+
exit 1
77+
fi

.github/workflows/rerun.yml

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
name: Re-run
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
jobs:
8+
re-run:
9+
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/re-run') && github.event.comment.user.login == github.event.issue.user.login }}
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Cleanup
13+
run: |
14+
rm -rf * .[^.]*
15+
16+
- name: Checkout code
17+
uses: actions/checkout@v5
18+
19+
- name: Rerun all failed jobs
20+
if: ${{ contains(github.event.comment.body, 'all-failed') }}
21+
uses: ./.github/actions/rerun-workflow
22+
with:
23+
PR_ID: ${{ github.event.issue.number }}
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
OWNER: ${{ github.repository_owner }}
26+
REPO: ${{ github.event.repository.name }}
27+
JOB_NAME: 'all-failed'
28+
29+
- name: Rerun Approval
30+
if: ${{ contains(github.event.comment.body, 'approval') }}
31+
uses: ./.github/actions/rerun-workflow
32+
with:
33+
PR_ID: ${{ github.event.issue.number }}
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
OWNER: ${{ github.repository_owner }}
36+
REPO: ${{ github.event.repository.name }}
37+
JOB_NAME: 'Approval'
38+
39+
- name: Rerun CI_ILUVATAR
40+
if: ${{ contains(github.event.comment.body, 'ci_iluvatar') }}
41+
uses: ./.github/actions/rerun-workflow
42+
with:
43+
PR_ID: ${{ github.event.issue.number }}
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
OWNER: ${{ github.repository_owner }}
46+
REPO: ${{ github.event.repository.name }}
47+
JOB_NAME: 'CI_ILUVATAR'
48+
49+
- name: Rerun CI_XPU
50+
if: ${{ contains(github.event.comment.body, 'ci_xpu') }}
51+
uses: ./.github/actions/rerun-workflow
52+
with:
53+
PR_ID: ${{ github.event.issue.number }}
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
OWNER: ${{ github.repository_owner }}
56+
REPO: ${{ github.event.repository.name }}
57+
JOB_NAME: 'CI_XPU'
58+
59+
- name: Rerun Codestyle-check
60+
if: ${{ contains(github.event.comment.body, 'codestyle') || contains(github.event.comment.body, 'pre_commit') }}
61+
uses: ./.github/actions/rerun-workflow
62+
with:
63+
PR_ID: ${{ github.event.issue.number }}
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
OWNER: ${{ github.repository_owner }}
66+
REPO: ${{ github.event.repository.name }}
67+
JOB_NAME: 'Pre Commit'
68+
69+
- name: Rerun Clone
70+
if: ${{ contains(github.event.comment.body, 'clone') }}
71+
uses: ./.github/actions/rerun-workflow
72+
with:
73+
PR_ID: ${{ github.event.issue.number }}
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
OWNER: ${{ github.repository_owner }}
76+
REPO: ${{ github.event.repository.name }}
77+
JOB_NAME: 'FD-Clone-Linux / code-clone'
78+
79+
- name: Rerun Build
80+
if: ${{ contains(github.event.comment.body, 'build') }}
81+
uses: ./.github/actions/rerun-workflow
82+
with:
83+
PR_ID: ${{ github.event.issue.number }}
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
OWNER: ${{ github.repository_owner }}
86+
REPO: ${{ github.event.repository.name }}
87+
JOB_NAME: 'FD-Build-Linux / fd-build'
88+
89+
- name: Rerun run_ce_cases
90+
if: ${{ contains(github.event.comment.body, 'run_ce_cases') }}
91+
uses: ./.github/actions/rerun-workflow
92+
with:
93+
PR_ID: ${{ github.event.issue.number }}
94+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95+
OWNER: ${{ github.repository_owner }}
96+
REPO: ${{ github.event.repository.name }}
97+
JOB_NAME: 'Extracted partial CE model tasks to run in CI. / run_ce_cases'
98+
99+
- name: Rerun accuracy_tests
100+
if: ${{ contains(github.event.comment.body, 'accuracy_tests') }}
101+
uses: ./.github/actions/rerun-workflow
102+
with:
103+
PR_ID: ${{ github.event.issue.number }}
104+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105+
OWNER: ${{ github.repository_owner }}
106+
REPO: ${{ github.event.repository.name }}
107+
JOB_NAME: 'Run Accuracy Tests / accuracy_tests'
108+
109+
- name: Rerun base_tests
110+
if: ${{ contains(github.event.comment.body, 'base_tests') }}
111+
uses: ./.github/actions/rerun-workflow
112+
with:
113+
PR_ID: ${{ github.event.issue.number }}
114+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
115+
OWNER: ${{ github.repository_owner }}
116+
REPO: ${{ github.event.repository.name }}
117+
JOB_NAME: 'Run Base Tests / base_tests'
118+
119+
- name: Rerun run_tests_logprob
120+
if: ${{ contains(github.event.comment.body, 'run_tests_logprob') }}
121+
uses: ./.github/actions/rerun-workflow
122+
with:
123+
PR_ID: ${{ github.event.issue.number }}
124+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125+
OWNER: ${{ github.repository_owner }}
126+
REPO: ${{ github.event.repository.name }}
127+
JOB_NAME: 'Run FastDeploy LogProb Tests / run_tests_logprob'
128+
129+
- name: Rerun run_tests_with_coverage
130+
if: ${{ contains(github.event.comment.body, 'run_tests_with_coverage') }}
131+
uses: ./.github/actions/rerun-workflow
132+
with:
133+
PR_ID: ${{ github.event.issue.number }}
134+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
135+
OWNER: ${{ github.repository_owner }}
136+
REPO: ${{ github.event.repository.name }}
137+
JOB_NAME: 'Run FastDeploy Unit Tests and Coverage / run_tests_with_coverage'
138+
139+
- name: Rerun diff_coverage_report
140+
if: ${{ contains(github.event.comment.body, 'diff_coverage_report') }}
141+
uses: ./.github/actions/rerun-workflow
142+
with:
143+
PR_ID: ${{ github.event.issue.number }}
144+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
145+
OWNER: ${{ github.repository_owner }}
146+
REPO: ${{ github.event.repository.name }}
147+
JOB_NAME: 'Run FastDeploy Unit Tests and Coverage / diff_coverage_report'
148+
149+
- name: Rerun stable_tests
150+
if: ${{ contains(github.event.comment.body, 'stable_tests') }}
151+
uses: ./.github/actions/rerun-workflow
152+
with:
153+
PR_ID: ${{ github.event.issue.number }}
154+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
155+
OWNER: ${{ github.repository_owner }}
156+
REPO: ${{ github.event.repository.name }}
157+
JOB_NAME: 'Run Stable Tests / stable_tests'

0 commit comments

Comments
 (0)