Commit & push work fine on a manual Run workflow but not on a cron scheduled one #349
-
Hi I'm trying to create a github actions that runs on a cron scheduled time and use the git-auto-commit to handle the commit & push. Below is my yml file name: Data Collection & Sync
on:
workflow_dispatch:
schedule:
- cron: "11 17 * * *" # Run everyday at 17:11
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: checkout repo content
uses: actions/checkout@v4 # checkout the repository content to github runner
with:
ref: ${{ github.head_ref }}
- name: setup python
uses: actions/setup-python@v5
with:
python-version: '3.12' # install the python version needed
- name: install python packages
run: |
python -m pip install --upgrade pip
pip install -r actions_requirements.txt
- name: execute py script # run main.py
env:
AUTH_KEY: ${{ secrets.AUTH_KEY }}
BASE_URL: ${{ secrets.BASE_URL }}
run: |
python wallet_accts.py
python acct_df.py
- name: Commit & Push
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'Synced data from API' When I manually run this workflow, it works perfectly. But when the cron scheduled action runs, I get the below error; Please help |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 9 replies
-
Hi @Kamal-Moha, I assume these are the runs that cause the problems?
From what I can see in the logs and from your workflow file: everything looks alright. Are you 100% sure, that your Python scripts always changes files? name: Data Collection & Sync
on:
workflow_dispatch:
schedule:
- cron: '11 17 * * *' # Run everyday at 06:08
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: checkout repo content
uses: actions/checkout@v4 # checkout the repository content to github runner
with:
ref: ${{ github.head_ref }}
- name: setup python
uses: actions/setup-python@v5
with:
python-version: '3.12' # install the python version needed
- name: install python packages
run: |
python -m pip install --upgrade pip
pip install -r actions_requirements.txt
- name: execute py script # run main.py
env:
AUTH_KEY: ${{ secrets.AUTH_KEY }}
BASE_URL: ${{ secrets.BASE_URL }}
run: |
python wallet_accts.py
python acct_df.py
+
+ - run: git status
+
- name: Commit & Push
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'Synced data from API'
|
Beta Was this translation helpful? Give feedback.
-
YES I'm 100% sure that those two python scripts actually create and save a dataframe in github
And when I run the workflow manually, both dataframes get created & saved in the proper directory. I have included a git status and will keep you posted on what I get. |
Beta Was this translation helpful? Give feedback.
-
Hi @stefanzweifel, I have included I'm still seeing the "nothing to commit, working tree clean" and I honestly don't know why I'm getting this. How it works with manual run and not the scheduled? Need further help. |
Beta Was this translation helpful? Give feedback.
Yeah, that's correct.
Correct. If the file doesn't change, then git-auto-commit can't commit any changes and can't push them to GitHub.