From 53d4e9e429d4a9d45398a8ef463fb37119256f91 Mon Sep 17 00:00:00 2001 From: gouzil <66515297+gouzil@users.noreply.github.com> Date: Fri, 19 May 2023 14:58:54 +0800 Subject: [PATCH] [tools] add PADDLE_API check file diff approvals (#53956) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [tools] add PADDLE_API check file diff approvals * [tools] fix determine * [tools] fix determine * [tools] Change to full character matching Co-authored-by: 张春乔 <83450930+Liyulingyue@users.noreply.github.com> * [tools] Update echo_line Co-authored-by: 张春乔 <83450930+Liyulingyue@users.noreply.github.com> * [tools] Update check_approval Co-authored-by: 张春乔 <83450930+Liyulingyue@users.noreply.github.com> --------- Co-authored-by: 张春乔 <83450930+Liyulingyue@users.noreply.github.com> --- tools/check_file_diff_approvals.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tools/check_file_diff_approvals.sh b/tools/check_file_diff_approvals.sh index 9be51d2154d..97a5ee146df 100644 --- a/tools/check_file_diff_approvals.sh +++ b/tools/check_file_diff_approvals.sh @@ -373,6 +373,19 @@ if [ "${PHI_INCLUDE_THIRD_PARTY_FILES}" != "" ] && [ "${GIT_PR_ID}" != "" ]; the check_approval 1 jiahy0825 zyfncg chenwhql YuanRisheng heavyrain-lzy fi +HAS_MODIFIED_PADDLE_API_FILES=`git diff --name-only upstream/$BRANCH | grep "paddle/.*\.h" || true` +INCLUDE_PADDLE_API_FILES="" +for CHANGE_FILE in ${HAS_MODIFIED_PHI_HEADER_FILES}; do + PADDLE_API_ADDED_LINES=`git diff -U0 upstream/$BRANCH -- ${PADDLE_ROOT}/${CHANGE_FILE} | grep -w "PADDLE_API" || true` + if [ "${PADDLE_API_ADDED_LINES}" != "" ] && [ "${GIT_PR_ID}" != "" ]; then + INCLUDE_PADDLE_API_FILES="${INCLUDE_PADDLE_API_FILES} ${CHANGE_FILE}" + fi +done +if [ "${INCLUDE_PADDLE_API_FILES}" != "" ] && [ "${GIT_PR_ID}" != "" ]; then + echo_line="You must have one RD (jiahy0825, zyfncg, chenwhql) or PM (sunzhongkai588, Ligoml) approval for code changes about PADDLE_API. If you add a new PADDLE_API, please make sure you have written detailed comments about the parameter and usage of this PADDLE_API .\n" + check_approval 1 jiahy0825 zyfncg chenwhql sunzhongkai588 Ligoml +fi + HAS_MODIFIED_PHI_OR_FLUID_FILES=`git diff --name-only upstream/$BRANCH | grep -E "paddle/phi|paddle/fluid" || true` USE_MUTABLE_DATA_FILES="" for CHANGE_FILE in ${HAS_MODIFIED_PHI_OR_FLUID_FILES}; do -- GitLab