fix: asf checker and gpr

This commit is contained in:
Klesh Wong 2023-12-13 20:40:39 +08:00
parent c7b0d0014d
commit 60c9122603
2 changed files with 10 additions and 4 deletions

View File

@ -67,7 +67,7 @@ check() {
# check unexpected binary files # check unexpected binary files
echo "** CHECK UNEXPRECTED BINARY FILES **" echo "** CHECK UNEXPRECTED BINARY FILES **"
UNEXPRECTED_BIN_FILES="$(find $SRC -type f ! -size 0 ! -name '*.png' ! -name '*.ico' -exec grep -IL . '{}' \;)" UNEXPRECTED_BIN_FILES="$(find $SRC -type f ! -size 0 ! -name '*.jpg' ! -name '*.png' ! -name '*.ico' -exec grep -IL . '{}' \;)"
if [ -n "$UNEXPRECTED_BIN_FILES" ]; then if [ -n "$UNEXPRECTED_BIN_FILES" ]; then
printf "Found unexpected binary files: \n%s\n" "$UNEXPRECTED_BIN_FILES" printf "Found unexpected binary files: \n%s\n" "$UNEXPRECTED_BIN_FILES"
else else
@ -79,12 +79,17 @@ check() {
echo "** CHECK ASF HEADER **" echo "** CHECK ASF HEADER **"
HEADER="$(cat $SRC/backend/.golangci-goheader.template)" HEADER="$(cat $SRC/backend/.golangci-goheader.template)"
test -n "$HEADER" test -n "$HEADER"
for FN in $(find "$SRC" -name '*.go'); do OIFS="$IFS"
if ! grep -qF "$HEADER" $FN; then IFS='
'
for FN in `find "$SRC" -name '*.go'`; do
echo "$FN"
if ! grep -qF "$HEADER" "$FN"; then
echo $FN has no ASF header echo $FN has no ASF header
exit -1 exit -1
fi fi
done done
IFS="$OIFS"
for FN in $(find "$SRC" -name '*.js' -not -path './config-ui/node_modules/*'); do for FN in $(find "$SRC" -name '*.js' -not -path './config-ui/node_modules/*'); do
if ! cut -c4- $FN | grep -qF "$HEADER"; then if ! cut -c4- $FN | grep -qF "$HEADER"; then
echo $FN has no ASF header echo $FN has no ASF header
@ -95,7 +100,7 @@ check() {
echo " echo "
+1 +1 (binding)
I checked these items: I checked these items:
- Download links are valid. - Download links are valid.

View File

@ -11,6 +11,7 @@ if [ -n "$PROXY_HOST" ] && [ -n "$PROXY_PORT" ]; then
fi fi
BRANCH=$(git branch --show-current) BRANCH=$(git branch --show-current)
# UPSTREAM_BRANCH=$(git rev-parse --abbrev-ref --symbolic-full-name @{u} | awk -F/ '{print $2}')
UPSTREAM_BRANCH=$(HTTPS_PROXY=$HTTP_PROXY git remote show upstream | grep -oP 'HEAD branch: \K\w+') UPSTREAM_BRANCH=$(HTTPS_PROXY=$HTTP_PROXY git remote show upstream | grep -oP 'HEAD branch: \K\w+')
ORIGIN_NAME=${1:-origin} ORIGIN_NAME=${1:-origin}
ORIGIN_URL=$(git remote get-url $ORIGIN_NAME) ORIGIN_URL=$(git remote get-url $ORIGIN_NAME)