CI #21957
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: CI | |
on: | |
# 手动打卡 | |
workflow_dispatch: | |
schedule: | |
# UTC时间,北京时间为8:05-23:05,间隔30min | |
- cron: '5,35 0-17 * * *' | |
push: | |
# 运行分支 | |
branches: | |
- main | |
paths: | |
- "/" | |
jobs: | |
check_score: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/[email protected] #安装node.js | |
with: | |
node-version: '14' | |
- name: get COURSE | |
run: | | |
COURSE=$(node ./score_num.js) | |
echo "COURSE=$COURSE" >> $GITHUB_ENV | |
# - uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/[email protected] | |
with: | |
python-version: '3.8' | |
cache: 'pip' | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Run score.py | |
run: | | |
python score.py | |
env: | |
SID: ${{ secrets.SID }} | |
PASSWORD: ${{ secrets.PASSWORD }} | |
PUSHKEY: ${{ secrets.PUSHKEY }} | |
COURSE: ${{ env.COURSE }} | |
# git 提交文件 | |
- name: Commit files | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "UPDATE" | |
git diff --exit-code || git add . && git commit -m "`date '+%Y-%m-%d %H:%M:%S'`" --allow-empty #动态提交信息 | |
# 推送到github仓库 | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |