# Pollers

There may be times where you wish to have a workflow run at a fixed duration. For instance, using a workflow to fetch and update a set of data everyday. Github Actions supports such workflows by offering the `schedule` event type that triggers a workflow.

To declare such a workflow, use the `schedule` event type along with the `cron` key, specify a [cron schedule format](https://crontab.guru/):

```yaml
on:
  schedule:
    # * is a special character in YAML so you have to quote this string
    - cron:  '30 5,17 * * *'
```

From the official Github Actions documentation on the [`schedule` event](https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule), you would specify the cron schedule and this will cause the workflow to be triggered at the given timing. You could even schedule it multiple times a day or across different times.

```yaml
on:
  schedule:
    - cron: '30 5 * * 1,3'
    - cron: '30 5 * * 2,4'

jobs:
  test_schedule:
    runs-on: ubuntu-latest
    steps:
      - name: Not on Monday or Wednesday
        if: github.event.schedule != '30 5 * * 1,3'
        run: echo "This step will be skipped on Monday and Wednesday"
      - name: Every time
        run: echo "This step will always run"
```

Once again, taken from the official Github Actions documentation.

You can use this "poller" pattern in conjunction with some of the next use cases to really power up your workflows. We will discuss them as we go.

{% hint style="danger" %}
There are several restrictions to this event type:

1. There may be delays to when exactly the workflow runs due to an increase in workload
2. This only works for workflows located on the [default branch](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/changing-the-default-branch) (this may change, so it's not always `main`)
3. These workflows can only run on the default branch
4. These workflows are disabled in repositories with no activity in 60 days
   {% endhint %}
