Update run.yml #7
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 Program | |
on: | |
push: | |
branches: | |
- main | |
repository_dispatch: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
run_program: | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/[email protected] | |
with: | |
# Version range or exact version of Python or PyPy to use, using SemVer's version range syntax. Reads from .python-version if unset. | |
python-version: 3.12.6 | |
# Used to specify a package manager for caching in the default directory. Supported values: pip, pipenv, poetry. | |
cache: pipenv | |
- name: Install Dependencies | |
run: | | |
pip3 install --upgrade pipenv | |
pipenv install | |
- name: Run Python Program | |
run: | | |
pipenv run ./main.py | |
- name: Check for changes | |
id: check_changes | |
run: | | |
git diff --exit-code || echo "Changes detected" | |
- name: Commit files | |
if: steps.check_changes.outputs.changed == 'true' | |
run: | | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add . | |
git commit -m "Add changes" | |
- name: Push changes | |
if: steps.check_changes.outputs.changed == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} |