Skip to content

Execute On Push

Execute On Push #4028

Workflow file for this run

name: Execute On Push
on:
schedule:
- cron: '30 */2 * * *' # Executes at 25 minutes past the hour, every 2 hours.
push:
branches:
- master
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository Contents
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11' #Install Latest Python
- name: Install Python Packages Requirements
run: |
python -m pip install --upgrade pip
pip install -r requirements
- name: Execute Python Script
run: python main.py
- name: Commit Files
run: |
git config --local user.email "[email protected]"
git config --local user.name "LiuYi0526"
git add -A
git diff-index --quiet HEAD || (git commit -a -m "Updated $(TZ='Asia/Tehran' date '+%Y-%m-%d %H:%M %Z')" --allow-empty)
- name: Push Changes
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: master
- name: Clean Up Files
run: |
git checkout --orphan latest_branch
git config --local user.email "[email protected]"
git config --local user.name "LiuYi0526"
git add -A
git commit -am "Updated $(TZ='Asia/Shanghai' date '+%Y-%m-%d %H:%M %Z')"
git branch -D master
git branch -m master
git push -f origin master
- name: Push Changes
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: master