0

Dynamic skip template

by
Published Oct 1, 2025

Template for dynamic skip scripts that filter scheduled execution dates. Return true to execute, false to skip.

Script windmill Verified

The script

Submitted by hugo697 Bun
Verified 251 days ago
1
// Dynamic skip template
2
// Return true to execute the scheduled job, false to skip to next occurrence
3

4
export async function main(
5
  scheduled_for: string // The proposed datetime for the scheduled job (ISO 8601 format)
6
): Promise<boolean> {
7
  // Example: Skip weekends
8
  // const date = new Date(scheduled_for);
9
  // const dayOfWeek = date.getDay(); // 0 = Sunday, 6 = Saturday
10
  // if (dayOfWeek === 0 || dayOfWeek === 6) {
11
  //   console.log(`Skipping weekend execution at ${scheduled_for}`);
12
  //   return false;
13
  // }
14

15
  // Example: Skip holidays
16
  // const holidays = ['2024-12-25', '2024-01-01'];
17
  // const date = new Date(scheduled_for);
18
  // const dateStr = date.toISOString().split('T')[0];
19
  // if (holidays.includes(dateStr)) {
20
  //   console.log(`Skipping holiday execution at ${scheduled_for}`);
21
  //   return false;
22
  // }
23

24
  console.log(`Allowing execution at ${scheduled_for}`);
25
  return true;
26
}
27