Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Del github api token #42330

Merged
merged 4 commits into from
May 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions paddle/scripts/paddle_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ function check_whl_size() {

whldiffSize=`echo $(($pr_whl_size - $dev_whl_size))`
if [ ${whldiffSize} -gt 10 ]; then
approval_line=`curl -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000`
approval_line=`curl https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000`
APPROVALS=`echo ${approval_line}|python ${PADDLE_ROOT}/tools/check_pr_approval.py 1 22334008 22361972`
echo "current pr ${GIT_PR_ID} got approvals: ${APPROVALS}"
if [ "${APPROVALS}" == "FALSE" ]; then
Expand Down Expand Up @@ -1051,13 +1051,13 @@ function generate_api_spec() {

function check_approvals_of_unittest() {
set +x
if [ "$GITHUB_API_TOKEN" == "" ] || [ "$GIT_PR_ID" == "" ]; then
if [ "$GIT_PR_ID" == "" ]; then
return 0
fi
# approval_user_list: XiaoguangHu01 46782768,luotao1 6836917,phlrain 43953930,lanxianghit 47554610, zhouwei25 52485244, kolinwei 22165420
check_times=$1
if [ $check_times == 1 ]; then
approval_line=`curl -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000`
approval_line=`curl https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000`
if [ "${approval_line}" != "" ]; then
APPROVALS=`echo ${approval_line}|python ${PADDLE_ROOT}/tools/check_pr_approval.py 1 22165420 52485244`
echo "current pr ${GIT_PR_ID} got approvals: ${APPROVALS}"
Expand All @@ -1071,7 +1071,7 @@ function check_approvals_of_unittest() {
elif [ $check_times == 2 ]; then
unittest_spec_diff=`python ${PADDLE_ROOT}/tools/diff_unittest.py ${PADDLE_ROOT}/paddle/fluid/UNITTEST_DEV.spec ${PADDLE_ROOT}/paddle/fluid/UNITTEST_PR.spec`
if [ "$unittest_spec_diff" != "" ]; then
approval_line=`curl -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000`
approval_line=`curl https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000`
APPROVALS=`echo ${approval_line}|python ${PADDLE_ROOT}/tools/check_pr_approval.py 1 22165420 52485244 32428676 45041955`
echo "current pr ${GIT_PR_ID} got approvals: ${APPROVALS}"
if [ "${APPROVALS}" == "FALSE" ]; then
Expand Down Expand Up @@ -1104,7 +1104,7 @@ function check_approvals_of_unittest() {
EOF
if [ `echo "20 < $AllDiffSize"|bc` -eq 1 ] ; then

approval_line=`curl -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000`
approval_line=`curl https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000`
APPROVALS=`echo ${approval_line}|python ${PADDLE_ROOT}/tools/check_pr_approval.py 1 39303645 328693`
echo "current pr ${GIT_PR_ID} got approvals: ${APPROVALS}"
if [ "${APPROVALS}" == "FALSE" ]; then
Expand Down Expand Up @@ -2839,7 +2839,7 @@ function test_op_benchmark() {
# The PR will pass quickly when get approval from specific person.
# Xreki 12538138, luotao1 6836917, ZzSean 32410583
set +x
approval_line=$(curl -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000)
approval_line=$(curl https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000)
if [ "${approval_line}" != "" ]; then
APPROVALS=$(echo ${approval_line} | python ${PADDLE_ROOT}/tools/check_pr_approval.py 1 32410583 12538138 6836917)
echo "current pr ${GIT_PR_ID} got approvals: ${APPROVALS}"
Expand Down Expand Up @@ -2891,11 +2891,11 @@ function summary_check_problems() {

function reuse_so_cache() {
get_html="https://api.github.com/repos/PaddlePaddle/Paddle"
curl -X GET ${get_html}/commits -H "authorization: token ${GITHUB_API_TOKEN}" >tmp.txt
curl -X GET ${get_html}/commits >tmp.txt
merge_commit=`grep "sha" tmp.txt| awk -F \" 'NR==1{print $(NF-1)}'| sed 's# ##g'`
curl -X GET ${get_html}/commits/${merge_commit} -H "authorization: token ${GITHUB_API_TOKEN}" >tmp.txt
curl -X GET ${get_html}/commits/${merge_commit} >tmp.txt
merge_pr=`grep -oP -m 1 '(#[0-9]*)' tmp.txt| sed 's/#//g'`
curl -X GET ${get_html}/pulls/${merge_pr}/commits -H "authorization: token ${GITHUB_API_TOKEN}" >tmp.txt
curl -X GET ${get_html}/pulls/${merge_pr}/commits >tmp.txt
pr_commit=`grep "sha" tmp.txt |tail -3|head -1|awk -F : '{print $NF}'|sed 's#"##g'|sed 's#,##g'| sed 's# ##g'`
set +e
wget -q https://xly-devops.bj.bcebos.com/PR/Paddle/${merge_pr}/${pr_commit}/workspace/Paddle/build/proto_so.tar.gz
Expand Down Expand Up @@ -2989,7 +2989,7 @@ function check_coverage_build() {

set +x
if [ ${diff_coverage_build_size} -gt 3 ]; then
approval_line=`curl -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000`
approval_line=`curl https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000`
APPROVALS=`echo ${approval_line}|python ${PADDLE_ROOT}/tools/check_pr_approval.py 1 29832297 6836917 43953930`
echo "current pr ${GIT_PR_ID} got approvals: ${APPROVALS}"
if [ "${APPROVALS}" == "FALSE" ]; then
Expand Down
2 changes: 1 addition & 1 deletion tools/check_api_approvals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if [ -z ${BRANCH} ]; then
fi

PADDLE_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}")/../" && pwd )"
approval_line=`curl -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000`
approval_line=`curl https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000`
failed_num=0
echo_list=()

Expand Down
2 changes: 1 addition & 1 deletion tools/check_file_diff_approvals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ API_FILES=("CMakeLists.txt"
"paddle/fluid/eager/backward.h"
)

approval_line=`curl -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000`
approval_line=`curl https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000`
git_files=`git diff --numstat upstream/$BRANCH| wc -l`
git_count=`git diff --numstat upstream/$BRANCH| awk '{sum+=$1}END{print sum}'`
failed_num=0
Expand Down
2 changes: 1 addition & 1 deletion tools/check_ut.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PRChecker(object):
""" PR Checker. """

def __init__(self):
self.github = Github(os.getenv('GITHUB_API_TOKEN'), timeout=60)
self.github = Github(timeout=60)
self.repo = None

def check(self, filename, msg):
Expand Down
2 changes: 1 addition & 1 deletion tools/ci_op_benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ function gpu_op_benchmark {
# The PR will pass quickly when get approval from specific person.
# Xreki 12538138, luotao1 6836917, ZzSean 32410583
set +x
approval_line=$(curl -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000)
approval_line=$(curl https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000)
if [ -n "${approval_line}" ]; then
APPROVALS=$(echo ${approval_line} | python ${PADDLE_ROOT}/tools/check_pr_approval.py 1 32410583 12538138 6836917)
LOG "[INFO] current pr ${GIT_PR_ID} got approvals: ${APPROVALS}"
Expand Down
3 changes: 1 addition & 2 deletions tools/coverage/cuda_clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ def get_pull(pull_id):
Returns:
github.PullRequest.PullRequest: The pull request.
"""
token = os.getenv('GITHUB_API_TOKEN')
github = Github(token, timeout=60)
github = Github(timeout=60)
repo = github.get_repo('PaddlePaddle/Paddle')
pull = repo.get_pull(pull_id)

Expand Down
3 changes: 1 addition & 2 deletions tools/coverage/gcda_clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ def get_pull(pull_id):
Returns:
github.PullRequest.PullRequest
"""
token = os.getenv('GITHUB_API_TOKEN')
github = Github(token, timeout=60)
github = Github(timeout=60)
idx = 1
while idx < 4:
try:
Expand Down
4 changes: 1 addition & 3 deletions tools/coverage/pull_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

from github import Github

token = os.getenv('GITHUB_API_TOKEN')


def get_pull(pull_id):
"""
Expand All @@ -35,7 +33,7 @@ def get_pull(pull_id):
Returns:
github.PullRequest.PullRequest
"""
github = Github(token, timeout=60)
github = Github(timeout=60)
repo = github.get_repo('PaddlePaddle/Paddle')
pull = repo.get_pull(pull_id)

Expand Down
2 changes: 1 addition & 1 deletion tools/get_pr_ut.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class PRChecker(object):
""" PR Checker. """

def __init__(self):
self.github = Github(os.getenv('GITHUB_API_TOKEN'), timeout=60)
self.github = Github(timeout=60)
self.repo = self.github.get_repo('PaddlePaddle/Paddle')
self.py_prog_oneline = re.compile('\d+\|\s*#.*')
self.py_prog_multiline_a = re.compile('\d+\|\s*r?""".*?"""', re.DOTALL)
Expand Down
2 changes: 1 addition & 1 deletion tools/test_ci_op_benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ function gpu_op_benchmark {
# The PR will pass quickly when get approval from specific person.
# Xreki 12538138, luotao1 6836917, ZzSean 32410583
set +x
approval_line=$(curl -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000)
approval_line=$(curl https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000)
if [ -n "${approval_line}" ]; then
APPROVALS=$(echo ${approval_line} | python ${PADDLE_ROOT}/tools/check_pr_approval.py 1 32410583 12538138 6836917)
LOG "[INFO] current pr ${GIT_PR_ID} got approvals: ${APPROVALS}"
Expand Down
5 changes: 2 additions & 3 deletions tools/windows/check_change_of_unittest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@
set -e
set +x
export PADDLE_ROOT="$(cd "$PWD/../" && pwd )"
GITHUB_API_TOKEN=$GITHUB_API_TOKEN
GIT_PR_ID=$AGILE_PULL_ID
BRANCH=$BRANCH
if [ "${GITHUB_API_TOKEN}" == "" ] || [ "${GIT_PR_ID}" == "" ];then
if [ "${GIT_PR_ID}" == "" ];then
exit 0
fi

unittest_spec_diff=$(cat $PADDLE_ROOT/deleted_ut | sed 's/^/ - /g')
if [ "$unittest_spec_diff" != "" ]; then
approval_line=`curl -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000`
approval_line=`curl https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000`
APPROVALS=`echo ${approval_line}|python ${PADDLE_ROOT}/tools/check_pr_approval.py 1 22165420 52485244 32428676 45041955`
echo "current pr ${GIT_PR_ID} got approvals: ${APPROVALS}"
if [ "${APPROVALS}" == "FALSE" ]; then
Expand Down