I am trying to setup a workflow on a branch called workflow-test. It has to run on a schedule and run every 24 hours. This workflow has to run a python script and commit and push the changes made by the python script. I got it to work on pushes, but it doesn't seem to work on schedules. I have looked at every question regarding this topic and tried all solutions, but to no avail.
This is my code:
name: update-state
on:
schedule:
- cron: '0 0 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v2
with:
ref: workflow-test
- name: Setup python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Execute script
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
python scripts/script.py
- name: Commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -A
git commit -m "update data" -a
- name: Push changes
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: workflow-test
This is what I have tried:
- Run a schedule on the master branch, which should trigger the schedule to work on the other branch, according to a stack overflow answer;
- Add the
with: ref: branch-part.
I have also tried just triggering this workflow on a push, which did work. Everything ran and worked. This was without the with: ref: branch-part. But from what I understand that is necessary when working with a schedule because schedule checks out to the last commit of the default branch, thus it has to be changed to the branch you are working on.
It doesn't seem to even attempt to run this workflow. It gives no record of attempting to run this workflow under the "actions" tab. Thus, I believe the problem lies with the schedule part, since it works on push and doesn't even run when working on a schedule.
I have also tried adding a simple workflow on schedule to my master branch, which does run. But when I add this simple workflow on schedule to my workflow-test branch, it doesn't run anymore.
I can't find anymore fixes on stack overflow, documentation or anywhere else. Thus I decided to open my own question. I hope someone can help me. Thanks in advance :).
Edit: this workflow updates the data used by a website.