Skip to content

newCheck189

newCheck189 #384

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: newCheck189
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
watch:
types: started
schedule:
- cron: '0 0 * * *'
jobs:
newCheck189:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@master
with:
python-version: 3.9
- name: requirements
run: |
pip install -r requirements.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
# Start Checkin
WorkWeiBot="${{ secrets.WWBOT }}"
DingDingBot="${{ secrets.DINGDINGBOT }}"
SCKEY="${{ secrets.SCKEY }}"
function WorkWei()
{
echo -n "企业微信机器人:"
curl -s "${WorkWeiBot}" \
-H 'Content-Type: application/json' \
-d '
{
"msgtype": "text",
"text": {
"content": "'"`date "+%F %T %A"`$1"'"
}
}'
echo .
}
function DingDing()
{
echo -n "钉钉机器人:"
curl -s "${DingDingBot}" \
-H 'Content-Type: application/json' \
-d '
{
"msgtype": "text",
"text": {
"content": "'"`date "+%F %T %A"`$1"'"
}
}'
echo .
}
function FTQQ()
{
echo -n "Server酱:"
url="https://sc.ftqq.com/${SCKEY}.send"
data="`date "+%F %T %A"`\n$2"
n='
'
n1='\\n'
data=${data//${n1}/${n}${n}}
data='text='"$1"'&desp='"${data}"
curl -s "${url}" \
-d "${data}"
echo .
}
user="${{ secrets.USER }}"
pwd="${{ secrets.PWD }}"
user_list=()
pwd_list=()
for u in ${user[*]}
do
user_list[${#user_list[*]}]=${u}
done
for p in ${pwd[*]}
do
pwd_list[${#pwd_list[*]}]=${p}
done
user_num=${#user_list[*]}
pwd_num=${#pwd_list[*]}
if [ $user_num != $pwd_num ];then
echo "账号和密码个数不对应"
exit 1
else
echo "共有 $user_num 个账号等待签到"
fi
random_time=$(($RANDOM % 5 + 1))
for ((i=0;i<$user_num;i++))
do
echo "倒计时 ${random_time} 分钟后开始签到"
for((j=0;j<${random_time};j++));
do
echo "$[${random_time}-$j]"
sleep 1m
done
echo "0"
echo "----------"
echo "签到账号$(($i+1))"
r=`python3 newCheck189.py <<EOF
${user_list[$i]}
${pwd_list[$i]}
EOF`
n='
'
n1="\n"
r=${r//${n}/${n1}}
echo -e "${r}"
y1='"'
y2='\"'
r=${r//${y1}/${y2}}
result="${result}\n${r}"
echo "----------"
done
[ g"${WorkWeiBot}" != g"" ] && WorkWei "${result}" || echo "未设置企业微信通知"
[ g"${DingDingBot}" != g"" ] && DingDing "${result}" || echo "未设置钉钉通知"
[ g"${SCKEY}" != g"" ] && FTQQ "天翼签到" "${result}" || echo "未设置Server酱通知"