run main.py #109024
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
# run a python program that creates a new file and stores a random number in it | |
name: run main.py | |
on: | |
schedule: | |
- cron: '* * * * *' | |
jobs: | |
setup: | |
runs-on: ubuntu-22.04 | |
container: | |
image: python:3 | |
steps: | |
- name: Checkout current repository | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Execute python script | |
run: python3 main.py | |
- name: Commit files | |
run: | | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
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 logs" --allow-empty) | |
- name: Push changes | |
uses: ad-m/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: main |