Skip to content

Commit 3f7eafc

Browse files
authored
paddleformers PR check (#11150)
* paddleformers PR check * echo line * -x
1 parent 51787ba commit 3f7eafc

File tree

2 files changed

+98
-0
lines changed

2 files changed

+98
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: PaddleFormers PR Check
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
7+
env:
8+
BRANCH: ${{ github.base_ref }}
9+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10+
PR_ID: ${{ github.event.pull_request.number }}
11+
COMMIT_ID: ${{ github.event.pull_request.head.sha }}
12+
token: ${{ vars.ACTION_GITHUB_TOKEN }}
13+
14+
jobs:
15+
check-approvers:
16+
name: Check approval
17+
runs-on:
18+
group: APPROVAL
19+
steps:
20+
- name: Cleanup
21+
run: |
22+
rm -rf * .[^.]*
23+
- name: Update paddle
24+
run: |
25+
wget -q --no-proxy https://xly-devops.bj.bcebos.com/PaddleTest/PaddleNLP/PaddleNLP-develop.tar.gz --no-check-certificate
26+
tar zxf PaddleNLP-develop.tar.gz --strip-components=1 >/dev/null
27+
rm -rf PaddleNLP-develop.tar.gz >/dev/null
28+
git fetch origin pull/${PR_ID}/head
29+
git checkout -b origin_pr FETCH_HEAD
30+
git remote add upstream https://github.com/PaddlePaddle/PaddleNLP.git
31+
git fetch upstream
32+
git checkout -b test_pr upstream/${BRANCH}
33+
git merge --no-edit origin_pr
34+
git log --pretty=oneline -10
35+
36+
- name: Check bypass
37+
id: check-bypass
38+
uses: ./.github/actions/check-bypass
39+
with:
40+
github-token: ${{ secrets.GITHUB_TOKEN }}
41+
workflow-name: approval
42+
43+
- name: Display Required Approvers
44+
if: steps.check-bypass.outputs.can-skip != 'true'
45+
run: |
46+
cd scripts/ci_approval
47+
bash run_ci_approval_cherry-pick.sh
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
failed_num=0
18+
echo_list=()
19+
approval_line=`curl -H "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/repos/PaddlePaddle/PaddleNLP/pulls/${PR_ID}/reviews?per_page=10000`
20+
21+
function add_failed(){
22+
failed_num=`expr $failed_num + 1`
23+
echo_list="${echo_list[@]}$1"
24+
}
25+
26+
function check_approval(){
27+
person_num=`echo $@|awk '{for (i=2;i<=NF;i++)print $i}'`
28+
echo ${person_num}
29+
APPROVALS=`echo ${approval_line}|python check_pr_approval.py $1 $person_num`
30+
echo ${APPROVALS}
31+
if [[ "${APPROVALS}" == "FALSE" && "${echo_line}" != "" ]]; then
32+
add_failed "${failed_num}. ${echo_line}"
33+
fi
34+
}
35+
36+
echo_line="The PaddleNLP repository will be switched to the PaddleFormers repository soon, so the PR needs to be merged into PaddleFormers first and the PR link should be filled in the current PR description area. Then please contact From00 for approval."
37+
check_approval 1 From00
38+
39+
if [ -n "${echo_list}" ];then
40+
echo "**************************************************************"
41+
echo "Please find RD for approval."
42+
echo -e "${echo_list[@]}"
43+
echo "There are ${failed_num} approved errors."
44+
echo "**************************************************************"
45+
exit 1
46+
else
47+
echo "**************************************************************"
48+
echo "CI APPROVAL PASSED."
49+
echo "**************************************************************"
50+
exit 0
51+
fi

0 commit comments

Comments
 (0)