V2freeCheckin #3
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: V2freeCheckin | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '7 16 * * *' | |
jobs: | |
check-in: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@main | |
- name: Initialize Python | |
uses: actions/setup-python@main | |
with: | |
python-version: '3.8' | |
- name: requirements | |
run: | | |
pip3 install -r requirements.txt | |
- name: Checkin | |
env: | |
PUSH_PLUS_TOKEN: ${{ secrets.PUSH_PLUS_TOKEN }} | |
run: | | |
echo `TZ=UTC-8 date +"%Y-%m-%d %H:%M:%S"` 喵喵喵......我来啦😁😁😁 > time.log | |
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 --username ${user_list[$i]} --password ${pwd_list[$i]} | |
done | |
- name: Commit | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
git add . | |
git commit -m "Update time.log" -a | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |