parent
863d1bbf64
commit
4f82ddf66d
|
@ -7,6 +7,7 @@ on:
|
||||||
- 'domain.txt'
|
- 'domain.txt'
|
||||||
- 'mirror.txt'
|
- 'mirror.txt'
|
||||||
- 'allows.txt'
|
- 'allows.txt'
|
||||||
|
- 'privileged.txt'
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
issues: write
|
issues: write
|
||||||
|
@ -59,6 +60,7 @@ jobs:
|
||||||
gh pr comment "${{ github.event.pull_request.number }}" --body '请运行 `./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
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
- name: Verify privileged.txt sort
|
- name: Verify privileged.txt sort
|
||||||
run: |
|
run: |
|
||||||
./hack/verify-image-match.sh privileged.txt || {
|
./hack/verify-image-match.sh privileged.txt || {
|
||||||
|
@ -66,6 +68,25 @@ jobs:
|
||||||
gh pr comment "${{ github.event.pull_request.number }}" --body '请运行 `./hack/fmt-image-match.sh privileged.txt` 对内容进行排序'
|
gh pr comment "${{ github.event.pull_request.number }}" --body '请运行 `./hack/fmt-image-match.sh privileged.txt` 对内容进行排序'
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- name: Verify privileged.txt in allows.txt
|
||||||
|
run: |
|
||||||
|
cat privileged.txt >>allows.txt
|
||||||
|
./hack/fmt-image-match.sh allows.txt
|
||||||
|
git --no-pager diff --exit-code || {
|
||||||
|
gh pr comment "${{ github.event.pull_request.number }}" --body '部分 privileged.txt 镜像未加到 allows.txt. 请运行 `cat privileged.txt >>allows.txt; ./hack/fmt-image-match.sh allows.txt`'
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
- name: Verify mirror.txt in allows.txt
|
||||||
|
run: |
|
||||||
|
cat mirror.txt >>allows.txt
|
||||||
|
./hack/fmt-image-match.sh allows.txt
|
||||||
|
git --no-pager diff --exit-code || {
|
||||||
|
gh pr comment "${{ github.event.pull_request.number }}" --body '部分 mirror.txt 镜像未加到 allows.txt, 请运行 `cat mirror.txt >>allows.txt; ./hack/fmt-image-match.sh allows.txt`'
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
- name: Verify Image Exists
|
- name: Verify Image Exists
|
||||||
run: |
|
run: |
|
||||||
./hack/verify-image.sh mirror.txt https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}.patch || {
|
./hack/verify-image.sh mirror.txt https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}.patch || {
|
||||||
|
|
|
@ -4,11 +4,11 @@ function check_match() {
|
||||||
local image=$1
|
local image=$1
|
||||||
local lines=$2
|
local lines=$2
|
||||||
for line in ${lines}; do
|
for line in ${lines}; do
|
||||||
if [[ "${line}" == *"**" ]]; then
|
if [[ "${line}" == *"/**" ]]; then
|
||||||
if [[ "${image}" == "${line%\*\*}"* ]]; then
|
if [[ "${image}" == "${line%\*\*}"* ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
elif [[ "${line}" == *"*" ]]; then
|
elif [[ "${line}" == *"/*" ]]; then
|
||||||
if [[ "${image}" == "${line%\*}"* ]]; then
|
if [[ "${image}" == "${line%\*}"* ]]; then
|
||||||
if [[ "${image#"${line%\*}"}" != *"/"* ]]; then
|
if [[ "${image#"${line%\*}"}" != *"/"* ]]; then
|
||||||
return
|
return
|
||||||
|
@ -20,6 +20,20 @@ function check_match() {
|
||||||
echo "${image}"
|
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() {
|
function format() {
|
||||||
local file=$1
|
local file=$1
|
||||||
local lines="$(cat "${file}")"
|
local lines="$(cat "${file}")"
|
||||||
|
@ -30,8 +44,10 @@ function format() {
|
||||||
done
|
done
|
||||||
|
|
||||||
for line in ${lines}; do
|
for line in ${lines}; do
|
||||||
if [[ "${line}" == *"*" ]]; then
|
if [[ "${line}" == *"/**" ]]; then
|
||||||
echo ${line}
|
echo "${line}"
|
||||||
|
elif [[ "${line}" == *"/*" ]]; then
|
||||||
|
check_match_more "${line}" "${lines}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue