Optimize some code
This commit is contained in:
+39
-29
@@ -78,6 +78,40 @@ jobs:
|
||||
GITHUB_RUN_ID: ${{ github.run_id }}
|
||||
run: |
|
||||
# 运行主程序
|
||||
# 判断环境变量是否为空
|
||||
if [ -z "$URL" ]; then
|
||||
echo "URL Secret is empty!"
|
||||
echo "::error title=URL Secret is empty!" \
|
||||
"::Your 'URL' Secret is not filled with any" \
|
||||
"information, so your program will not work!"
|
||||
Whether_Secret_is_empty=true
|
||||
fi
|
||||
if [ -z "$USERNAME" ]; then
|
||||
echo "USERNAME Secret is empty!"
|
||||
echo "::error title=USERNAME Secret is empty!" \
|
||||
"::Your 'USERNAME' Secret is not filled with any" \
|
||||
"information, so your program will not work!"
|
||||
Whether_Secret_is_empty=true
|
||||
fi
|
||||
if [ -z "$PASSWORD" ]; then
|
||||
echo "PASSWORD Secret is empty!"
|
||||
echo "::error title=PASSWORD Secret is empty!" \
|
||||
"::Your 'PASSWORD' Secret is not filled with any" \
|
||||
"information, so your program will not work!"
|
||||
Whether_Secret_is_empty=true
|
||||
fi
|
||||
if [ -z "$TOKEN" ]; then
|
||||
echo "TOKEN Secret is empty!"
|
||||
echo "::error title=TOKEN Secret is empty!" \
|
||||
"::Your 'TOKEN' Secret is not filled with any" \
|
||||
"information, so your program will not work!"
|
||||
Whether_Secret_is_empty=true
|
||||
fi
|
||||
if [ "$Whether_Secret_is_empty" = true ]; then
|
||||
echo "One or more Secrets are empty."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 判断是否需要强制推送信息
|
||||
if [ -z "${{ github.event.inputs.force_push_message }}" ]; then
|
||||
export FORCE_PUSH_MESSAGE="False"
|
||||
@@ -86,34 +120,6 @@ jobs:
|
||||
fi
|
||||
export BEIJING_TIME="$(TZ='Asia/Shanghai' date +'%Y-%m-%d %H:%M:%S:%3N')"
|
||||
echo "BEIJING_TIME=$BEIJING_TIME" >> $GITHUB_OUTPUT
|
||||
python main.py
|
||||
echo "------"
|
||||
|
||||
# 判断环境变量是否为空
|
||||
if [ -z "$URL" ]; then
|
||||
echo "URL Secret is empty!"
|
||||
echo "::error title=URL Secret is empty!" \
|
||||
"::Your 'URL' Secret is not filled with any" \
|
||||
"information, so your program will not work!"
|
||||
fi
|
||||
if [ -z "$USERNAME" ]; then
|
||||
echo "USERNAME Secret is empty!"
|
||||
echo "::error title=USERNAME Secret is empty!" \
|
||||
"::Your 'USERNAME' Secret is not filled with any" \
|
||||
"information, so your program will not work!"
|
||||
fi
|
||||
if [ -z "$PASSWORD" ]; then
|
||||
echo "PASSWORD Secret is empty!"
|
||||
echo "::error title=PASSWORD Secret is empty!" \
|
||||
"::Your 'PASSWORD' Secret is not filled with any" \
|
||||
"information, so your program will not work!"
|
||||
fi
|
||||
if [ -z "$TOKEN" ]; then
|
||||
echo "TOKEN Secret is empty!"
|
||||
echo "::error title=TOKEN Secret is empty!" \
|
||||
"::Your 'TOKEN' Secret is not filled with any" \
|
||||
"information, so your program will not work!"
|
||||
fi
|
||||
|
||||
# 定义 mask_middle 函数,接收一个字符串作为输入参数
|
||||
mask_middle() {
|
||||
@@ -150,6 +156,7 @@ jobs:
|
||||
# 组合协议、匿名化后的域名和路径,输出结果
|
||||
echo "${protocol}${anonymized_domain}${path}"
|
||||
}
|
||||
|
||||
LOGINURL="xtgl/login_slogin.html"
|
||||
|
||||
# 方便通过截图快速定位到用户
|
||||
@@ -172,6 +179,9 @@ jobs:
|
||||
echo "Author's website: https://www.nianbroken.top/"
|
||||
echo "Author's Repository URL: https://github.com/NianBroken/ZFCheckScores/"
|
||||
|
||||
echo "------"
|
||||
python main.py
|
||||
|
||||
- name: Delete __pycache__ folder
|
||||
run: |
|
||||
# 删除__pycache__文件夹
|
||||
@@ -183,4 +193,4 @@ jobs:
|
||||
# 将更改强制推送到运行分支
|
||||
git add .
|
||||
git commit -m "Update from GitHub Actions" || true
|
||||
git push origin $GITHUB_REF_NAME --force
|
||||
git push origin $GITHUB_REF_NAME --force
|
||||
Reference in New Issue
Block a user