feat(presets): add schedule presets for automerge (#20305)

Co-authored-by: Rhys Arkins <rhys@arkins.net>
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
This commit is contained in:
Duncan Casteleyn 2023-02-10 12:32:54 +01:00 committed by GitHub
parent f885dc033a
commit d791614edb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,39 +2,85 @@ import type { Preset } from '../types';
/* eslint sort-keys: ["error", "asc", {caseSensitive: false, natural: true}] */ /* eslint sort-keys: ["error", "asc", {caseSensitive: false, natural: true}] */
const daily = ['before 2am'];
const earlyMondays = ['before 3am on Monday'];
const monthly = ['before 3am on the first day of the month'];
const nonOfficeHours = [
'after 10pm every weekday',
'before 5am every weekday',
'every weekend',
];
const quarterly = ['every 3 months on the first day of the month'];
const weekdays = ['every weekday'];
const weekends = ['every weekend'];
const yearly = ['every 12 months on the first day of the month'];
export const presets: Record<string, Preset> = { export const presets: Record<string, Preset> = {
automergeDaily: {
automergeSchedule: daily,
description: 'Schedule automerge daily.',
},
automergeEarlyMondays: {
automergeSchedule: earlyMondays,
description: 'Weekly automerge schedule on early Monday mornings.',
},
automergeMonthly: {
automergeSchedule: monthly,
description: 'Schedule automerge monthly.',
},
automergeNonOfficeHours: {
automergeSchedule: nonOfficeHours,
description:
'Schedule automerge for typical non-office hours (night time and weekends).',
},
automergeQuarterly: {
automergeSchedule: quarterly,
description: 'Schedule automerge quarterly.',
},
automergeWeekdays: {
automergeSchedule: weekdays,
description: 'Schedule automerge for weekdays.',
},
automergeWeekends: {
automergeSchedule: weekends,
description: 'Schedule automerge for weekends.',
},
automergeWeekly: {
description: 'Schedule automerge weekly.',
extends: ['schedule:automergeEarlyMondays'],
},
automergeYearly: {
automergeSchedule: yearly,
description: 'Schedule automerge once a year (not recommended).',
},
daily: { daily: {
description: 'Schedule daily.', description: 'Schedule daily.',
schedule: ['before 2am'], schedule: daily,
}, },
earlyMondays: { earlyMondays: {
description: 'Weekly schedule on early Monday mornings.', description: 'Weekly schedule on early Monday mornings.',
schedule: ['before 3am on Monday'], schedule: earlyMondays,
}, },
monthly: { monthly: {
description: 'Schedule monthly.', description: 'Schedule monthly.',
schedule: ['before 3am on the first day of the month'], schedule: monthly,
}, },
nonOfficeHours: { nonOfficeHours: {
description: description:
'Schedule for typical non-office hours (night time and weekends).', 'Schedule for typical non-office hours (night time and weekends).',
schedule: [ schedule: nonOfficeHours,
'after 10pm every weekday',
'before 5am every weekday',
'every weekend',
],
}, },
quarterly: { quarterly: {
description: 'Schedule quarterly.', description: 'Schedule quarterly.',
schedule: ['every 3 months on the first day of the month'], schedule: quarterly,
}, },
weekdays: { weekdays: {
description: 'Schedule for weekdays.', description: 'Schedule for weekdays.',
schedule: ['every weekday'], schedule: weekdays,
}, },
weekends: { weekends: {
description: 'Schedule for weekends.', description: 'Schedule for weekends.',
schedule: ['every weekend'], schedule: weekends,
}, },
weekly: { weekly: {
description: 'Schedule weekly.', description: 'Schedule weekly.',
@ -42,6 +88,6 @@ export const presets: Record<string, Preset> = {
}, },
yearly: { yearly: {
description: 'Schedule once a year (not recommended).', description: 'Schedule once a year (not recommended).',
schedule: ['every 12 months on the first day of the month'], schedule: yearly,
}, },
}; };