Update pr verify (#23366)

* Fix fmt-image-match.sh

* Update pr verify
This commit is contained in:
Shiming Zhang
2024-08-01 16:11:35 +08:00
committed by GitHub
parent 863d1bbf64
commit 4f82ddf66d
2 changed files with 41 additions and 4 deletions

View File

@@ -4,11 +4,11 @@ function check_match() {
local image=$1
local lines=$2
for line in ${lines}; do
if [[ "${line}" == *"**" ]]; then
if [[ "${line}" == *"/**" ]]; then
if [[ "${image}" == "${line%\*\*}"* ]]; then
return
fi
elif [[ "${line}" == *"*" ]]; then
elif [[ "${line}" == *"/*" ]]; then
if [[ "${image}" == "${line%\*}"* ]]; then
if [[ "${image#"${line%\*}"}" != *"/"* ]]; then
return
@@ -20,6 +20,20 @@ function check_match() {
echo "${image}"
}
function check_match_more() {
local image=$1
local lines=$2
for line in ${lines}; do
if [[ "${line}" == *"/**" ]]; then
if [[ "${image}" == "${line%\*\*}"* ]]; then
return
fi
fi
done
echo "${image}"
}
function format() {
local file=$1
local lines="$(cat "${file}")"
@@ -30,8 +44,10 @@ function format() {
done
for line in ${lines}; do
if [[ "${line}" == *"*" ]]; then
echo ${line}
if [[ "${line}" == *"/**" ]]; then
echo "${line}"
elif [[ "${line}" == *"/*" ]]; then
check_match_more "${line}" "${lines}"
fi
done
}