-
Notifications
You must be signed in to change notification settings - Fork 24
131 lines (123 loc) · 3.46 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# 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酱通知"