签到 #71
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 签到 | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
schedule: | |
- cron: '45 2,14 * * *' | |
watch: | |
types: started | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: ${{ !github.event.sender.id || github.event.repository.owner.id == github.event.sender.id }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: 初始化Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.7 | |
- name: 签到 | |
run: | | |
# echo ${{github.event.sender.id}} | |
# echo ${{github.event.repository.owner.id}} | |
pip install -r requirements.txt | |
user='${{ secrets.USER }}' | |
pwd='${{ secrets.PWD }}' | |
user_list=() | |
pwd_list=() | |
IFS="#" | |
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 | |
for ((i=0;i<$user_num;i++)) | |
do | |
python3 checkin.py <<EOF | |
${user_list[$i]} | |
${pwd_list[$i]} | |
EOF | |
done |