Skip to content

run main.py on schedule #1590

run main.py on schedule

run main.py on schedule #1590

Workflow file for this run

name: run main.py on schedule
on:
schedule:
- cron: '0 */12 * * *' # every 12 hours
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout repo content
uses: actions/checkout@v3 # checkout the repository content to github runner
with:
ref: dev
- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.11' # install the python version needed
- name: install python packages
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: execute py script # run main.py
env:
SOME_SECRET: ${{ secrets.SOME_SECRET }}
run: |
wget -nv "https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-Country.mmdb"
mkdir -p geoip2
mv -v GeoLite2-Country.mmdb geoip2
python main.py
# - name: commit files
# run: |
# git config --local user.email "[email protected]"
# git config --local user.name "GitHub Action"
# git add -A
# git diff-index --quiet HEAD || (git commit -a -m "updated subs" --allow-empty)
# - name: push changes
# uses: ad-m/[email protected]
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: main
- name: Clean Up Files
run: |
rm -r -f __pycache__
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add -A
git commit -a -m "updated subs" --allow-empty
git branch -m main
git push -f origin main