Skip to content

GitHub LeetCode Bot #1646

GitHub LeetCode Bot

GitHub LeetCode Bot #1646

Workflow file for this run

name: 'GitHub LeetCode Bot'
on:
# 执行git push操作将会触发此脚本
push:
# 每隔12小时将会触发此脚本
schedule:
- cron: '0 */12 * * *'
workflow_dispatch:
jobs:
bot:
runs-on: ubuntu-latest
steps:
# 检测代码
- name: 'Checkout codes'
uses: actions/checkout@v2
# 修改系统时区
- name: Setup the time zone to Asia/Shanghai
uses: zcong1993/setup-timezone@master
with:
timezone: Asia/Shanghai
# 安装requirements.txt中的依赖包
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
if: steps.pip-cache.outputs.cache-hit != 'true'
# 运行leetcode.py文件
# 将在程序当前生成目录下生成一个新的README.md文件
- name: Get LeetCode Data
run: python leetcode.py ${{ secrets.LEETCODE_SESSION }}
# 执行push操作,推送最新的README.md文件
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Update changes