Skip to content

Commit d188838

Browse files
committed
test=document_fix
1 parent 23b7d79 commit d188838

File tree

6 files changed

+167
-46
lines changed

6 files changed

+167
-46
lines changed
+30
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 }}
+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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+
block_jobs=$(echo "$jobs_response" | jq -r --arg job_name "$JOB_NAME" \
53+
'.jobs[] | select(.name == $job_name and .conclusion != "success") | .id')
54+
55+
if [ -n "$block_jobs" ]; then
56+
echo "Found block jobs for run_id $run_id: $block_jobs"
57+
58+
for job_id in $block_jobs; do
59+
echo "Rerunning job_id: $job_id"
60+
curl -X POST -H "Accept: application/vnd.github.v3+json" \
61+
-H "Authorization: token $GITHUB_TOKEN" \
62+
"https://api.github.com/repos/$OWNER/$REPO/actions/jobs/$job_id/rerun"
63+
done
64+
else
65+
echo "No block jobs found for run_id $run_id with name $JOB_NAME."
66+
fi
67+
fi
68+
done
69+
else
70+
echo "No matching workflow runs found for commit $COMMIT_SHA."
71+
exit 1
72+
fi

.github/workflows/Re-run.yml

-44
This file was deleted.

.github/workflows/re-run.yml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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') }}
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Rerun all failed jobs
16+
if: ${{ contains(toLower(github.event.comment.body), 'all-failed') }}
17+
uses: ./.github/actions/rerun-workflow
18+
with:
19+
PR_ID: ${{ github.event.issue.number }}
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
OWNER: ${{ github.repository_owner }}
22+
REPO: ${{ github.event.repository.name }}
23+
JOB_NAME: 'all-failed'
24+
25+
- name: Rerun bypass for approval
26+
if: ${{ contains(toLower(github.event.comment.body), 'approval') }}
27+
uses: ./.github/actions/rerun-workflow
28+
with:
29+
PR_ID: ${{ github.event.issue.number }}
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
OWNER: ${{ github.repository_owner }}
32+
REPO: ${{ github.event.repository.name }}
33+
JOB_NAME: 'Check Approvers'
34+
35+
- name: Rerun bypass for codestyle-check
36+
if: ${{ contains(toLower(github.event.comment.body), 'codestyle') }}
37+
uses: ./.github/actions/rerun-workflow
38+
with:
39+
PR_ID: ${{ github.event.issue.number }}
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
OWNER: ${{ github.repository_owner }}
42+
REPO: ${{ github.event.repository.name }}
43+
JOB_NAME: 'Check bypass for codestyle / Check bypass'
44+
45+
- name: Rerun bypass for clone
46+
if: ${{ contains(toLower(github.event.comment.body), 'clone') }}
47+
uses: ./.github/actions/rerun-workflow
48+
with:
49+
PR_ID: ${{ github.event.issue.number }}
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
OWNER: ${{ github.repository_owner }}
52+
REPO: ${{ github.event.repository.name }}
53+
JOB_NAME: 'Clone-linux / Clone Paddle'
54+
55+
- name: Rerun bypass for sot
56+
if: ${{ contains(toLower(github.event.comment.body), 'sot') }}
57+
uses: ./.github/actions/rerun-workflow
58+
with:
59+
PR_ID: ${{ github.event.issue.number }}
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
OWNER: ${{ github.repository_owner }}
62+
REPO: ${{ github.event.repository.name }}
63+
JOB_NAME: 'Check bypass for SOT / Check bypass'

third_party/absl

Submodule absl updated 1019 files

0 commit comments

Comments
 (0)