Reputation: 11991
How to run cron jobs automatically every Thursday at 10:30 am
Australian Standard time irrespective of any other action? I have tried the below, but not sure if it's running. Could someone please advise?
I have the schedule.yml
file in my branch.
Should I add the schedule.yml
somewhere else?
Branch: cypress-schedule-test-ci-100
.github\workflows\schedule.yml
name: Cypress E2E Tests
on:
schedule:
- cron: "30 10 * * 4"
env:
CYPRESS_BOOKING_PASSWORD: ${{ secrets.CYPRESS_BOOKING_PASSWORD }}
CYPRESS_BOOKING_FREE_USER_PASSWORD: ${{ secrets.CYPRESS_BOOKING_FREE_USER_PASSWORD }}
jobs:
install:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
uses: cypress-io/github-action@v2
with:
# just perform install
runTests: false
tests:
runs-on: ubuntu-22.04
needs: install
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Install dependencies
uses: cypress-io/github-action@v2
with:
# perform installation
runTests: false
- name: Run E2E tests
run: npm run cy:run -- --env grepTags="@MainUITests+-@Failing",ENV="qaserver" --browser chrome
- name: Upload Results
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
- uses: actions/upload-artifact@v2
if: always()
with:
name: cypress-videos
path: cypress/videos
Upvotes: 2
Views: 7689
Reputation: 14637
While working with the schedule cron job, the following points need to keep in mind:
You can schedule a workflow to run at specific UTC times using POSIX cron syntax.
So, you might need to adjust it according to your time zone.
Scheduled workflows run on the latest commit on the default or base branch.
It should be scheduled for the default branch e.g. main
. Apparently, this seems to be the reason why your scheduled job isn't working.
And,
Note: The
schedule
event can be delayed during periods of high loads of GitHub Actions workflow runs. High load times include the start of every hour. To decrease the chance of delay, schedule your workflow to run at a different time of the hour.
You need to account for such delays due to high loads.
Upvotes: 1