Github action not getting triggered on scheduled time

35 Views Asked by At

I have a workflow that I want to trigger on GitHub as an action every 15 minutes. I have used cron-jobs to schedule it. But it's not getting triggered. I checked it on other events like push and it's working.

Adding my .yml file below:-

name: Temp Workflow

on:
  schedule:
    - cron: "*/15 * * * *"

jobs:
  build:
    runs-on: ubuntu-latest

steps:
  - name: Checkout code
    uses: actions/checkout@v3
    ref: branch_123

  - name: Hello World
    run: echo "Hello, World!"

  - name: Hi world
    run: echo "Hii, World!"
  
  env:
    CI: true

At first I want to run it on branch_123 to test and after testing will do it for master branch.

2

There are 2 best solutions below

0
GuiFalourd On BEST ANSWER

According to the official documentation, those cron runs only trigger if the workflow is on the repository default branch.

You can schedule a workflow to run at specific UTC times using POSIX cron syntax. Scheduled workflows run on the latest commit on the default. The shortest interval you can run scheduled workflows is once every 5 minutes.

Also, note that 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. If the load is sufficiently high enough, some queued jobs may be dropped. To decrease the chance of delay, schedule your workflow to run at a different time of the hour.

0
deep bajaj On

This feature is only for the default branch as of now, Refer the snippet below

enter image description here

However, you may still reach out to actions community - https://github.com/orgs/community/discussions

Your suggestion might result into a new feature.