Update image match
This commit is contained in:
parent
cd9efa259c
commit
55e09223e4
|
@ -54,9 +54,9 @@ jobs:
|
|||
|
||||
- name: Verify allows.txt sort
|
||||
run: |
|
||||
./hack/verify-fmt.sh allows.txt || {
|
||||
echo "Please run './hack/fmt.sh allows.txt'"
|
||||
gh pr comment "${{ github.event.pull_request.number }}" --body '请运行 `./hack/fmt.sh allows.txt` 对内容进行排序'
|
||||
./hack/verify-image-match.sh allows.txt || {
|
||||
echo "Please run './hack/fmt-image-match.sh allows.txt'"
|
||||
gh pr comment "${{ github.event.pull_request.number }}" --body '请运行 `./hack/fmt-image-match.sh allows.txt` 对内容进行排序'
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
|
|
@ -287,7 +287,6 @@ docker.io/prom/**
|
|||
docker.io/prometheuscommunity/**
|
||||
docker.io/pytorch/**
|
||||
docker.io/qdrant/**
|
||||
docker.io/qdrant/qdrant
|
||||
docker.io/rancher/**
|
||||
docker.io/rclone/**
|
||||
docker.io/redislabs/**
|
||||
|
@ -306,8 +305,6 @@ docker.io/sonobuoy/**
|
|||
docker.io/soulter/astrbot
|
||||
docker.io/squidfunk/**
|
||||
docker.io/starrocks/**
|
||||
docker.io/starrocks/dev-env-centos7
|
||||
docker.io/starrocks/dev-env-ubuntu
|
||||
docker.io/tailscale/**
|
||||
docker.io/talebook/talebook
|
||||
docker.io/tdengine/**
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
function check_match() {
|
||||
local image=$1
|
||||
local lines=$2
|
||||
for line in ${lines}; do
|
||||
if [[ "${line}" == *"**" ]]; then
|
||||
if [[ "${image}" == "${line%\*\*}"* ]]; then
|
||||
return
|
||||
fi
|
||||
elif [[ "${line}" == *"*" ]]; then
|
||||
if [[ "${image}" == "${line%\*}"* ]]; then
|
||||
if [[ "${image#"${line%\*}"}" != *"/"* ]]; then
|
||||
return
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
echo "${image}"
|
||||
}
|
||||
|
||||
function format() {
|
||||
local file=$1
|
||||
local lines="$(cat "${file}")"
|
||||
for line in ${lines}; do
|
||||
if [[ "${line}" != *"*" ]]; then
|
||||
check_match "${line}" "${lines}"
|
||||
fi
|
||||
done
|
||||
|
||||
for line in ${lines}; do
|
||||
if [[ "${line}" == *"*" ]]; then
|
||||
echo ${line}
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
export LC_ALL=C
|
||||
file=$1
|
||||
|
||||
format "${file}" |
|
||||
sort -u |
|
||||
grep -v '^$' >$1.tmp && mv $1.tmp $1
|
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
export LC_ALL=C
|
||||
|
||||
cp $1 $1.bak
|
||||
|
||||
$(dirname "${BASH_SOURCE}")/fmt-image-match.sh $1.bak
|
||||
|
||||
diff -c $1 $1.bak && rm $1.bak
|
Loading…
Reference in New Issue