Schedule icon
Log icon

Executes flow on schedule trigger with PublicHoliday condition

Run scheduled flows only on public holidays with Kestra's PublicHoliday schedule condition. Business-aware automation across 70+ countries via cron.

Categories
Core
id: schedule-condition-publicholiday
namespace: company.team

triggers:
  - id: schedule
    type: io.kestra.plugin.core.trigger.Schedule
    cron: "0 11 * * *"
    when: "{{ isPublicHoliday(trigger.date, 'FR') }}"

tasks:
  - id: hello
    type: io.kestra.plugin.core.log.Log
    message: Demo for PublicHoliday condition

Make your scheduled workflows aware of the calendar. This blueprint shows how to gate a Kestra Schedule trigger with a when Pebble expression built around the isPublicHoliday function, so the flow runs only on public holidays for a given country. It solves a common scheduling gap: plain cron has no notion of holidays, so teams end up hard coding date lists or skipping runs manually. By attaching a holiday check to the trigger's when property, you get business-aware automation that fires (or skips) precisely when the calendar says so.

How it works

  • A io.kestra.plugin.core.trigger.Schedule trigger evaluates the cron 0 11 * * *, meaning it considers an execution every day at 11am.
  • The trigger's when property holds the expression {{ isPublicHoliday(trigger.date, 'FR') }}. The execution only proceeds when the trigger date is a French public holiday.
  • When the expression evaluates to true, the io.kestra.plugin.core.log.Log task runs and emits a demo message confirming the holiday-gated execution fired.

The isPublicHoliday function uses the Jollyday library, which ships holiday calendars for more than 70 countries.

What you get

  • A working pattern for calendar-aware scheduling without external services.
  • A single declarative place where the cron and the holiday check live together.
  • An easy switch (the country code passed to isPublicHoliday) to adapt the same flow to any supported country.

Who it's for

  • Data and platform engineers who need runs that respect business calendars.
  • Teams running batch jobs, payroll, or reporting that behave differently on holidays.
  • Anyone replacing hard coded date lists with a maintainable declarative rule.

Why orchestrate this with Kestra

Kestra lets you express scheduling logic as declarative YAML, with the holiday check sitting right in the trigger's when property instead of buried in task code. Event and schedule triggers, automatic retries, and full execution lineage come built in, so every gated run is observable and replayable. A raw cron scheduler cannot answer "is today a public holiday in this country?" without you maintaining that calendar yourself. The isPublicHoliday function fills exactly that gap.

Prerequisites

  • A running Kestra instance.

Secrets

This blueprint references no secrets.

Quick start

  1. Add this flow to a namespace in your Kestra instance.
  2. Leave the trigger enabled so Kestra evaluates the schedule daily at 11am.
  3. On the next French public holiday, watch the hello task log the demo message.

How to extend

  • Change the country code passed to isPublicHoliday (for example US, DE, IN) to gate on a different national calendar.
  • Invert the intent by skipping holidays: wrap the expression in not(...) so the flow runs on every day that is not a holiday.
  • Replace the Log task with real work such as a report, backfill, or notification.
  • Combine the holiday check with other when conditions, like dayOfWeek(trigger.date) or isDayWeekInMonth(...), using and/or for richer rules.

Links

Share this Blueprint
See How

New to Kestra?

Use blueprints to kickstart your first workflows.