Run GitHub Events Daily #4347
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: Run GitHub Events Daily | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "* 0/12 * * *" #'*/60 * * * *' | |
push: | |
branches: [main] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
TIME_ZONE: "Asia/Shanghai" | |
RUN_ENV: "production" # within ['production', 'development'] | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
AUTH_TOKEN: ${{ secrets.AUTH_TOKEN }} | |
steps: | |
# ============================================ | |
# TODO [√] 检查工作分支及 Workflows 运行环境 | |
# ============================================ | |
- name: Checkout | |
uses: actions/checkout@v2 | |
# ============================================ | |
# TODO [√] 创建 Python3.6+ 编译环境 | |
# ============================================ | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
# ============================================ | |
# TODO [√] 安装 Project 第三方依赖 | |
# ============================================ | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
# ============================================ | |
# TODO [√] 测试 Scaffold 脚手架指令 | |
# ============================================ | |
- name: Run github events | |
run: | | |
cd src && python main.py run | |
# ============================================ | |
# TODO [√] 更新仓库数据 | |
# ============================================ | |
- name: Setup GIT user | |
uses: fregante/setup-git-user@v1 | |
- name: Push done work | |
run: | | |
git add -A | |
if ! git diff-index --quiet HEAD; then | |
git commit -m "Automated deployment @ $(date '+%Y-%m-%d %H:%M:%S') ${{ env.TIME_ZONE }}" | |
git push --force origin main | |
fi |