update #751
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: update | |
on: | |
schedule: | |
- cron: "0 3 * * *" | |
push: | |
tags: | |
- '*' | |
workflow_dispatch: | |
inputs: | |
name: | |
description: 'reason' | |
required: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
with: | |
ref: "master" | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' | |
- name: Run script with retries | |
run: | | |
sudo timedatectl set-timezone "Asia/Shanghai" | |
for i in {1..3}; do | |
pip install -r requirements.txt && python ./main.py && break || sleep 60 | |
done | |
- name: update readme | |
env: | |
GIT_USER: "Github Action" | |
GIT_EMAIL: "[email protected]" | |
run: | | |
for i in {1..3}; do | |
git config user.name "${GIT_USER}" | |
git config user.email "${GIT_EMAIL}" | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git | |
git checkout master | |
git add . | |
git commit -m "Update by Github Action" | |
git push -u origin master && break || sleep 60 | |
done |