-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add config for running in a date window #29
base: master
Are you sure you want to change the base?
Conversation
👋 @fryz |
core.info(`Today: ${now}`) | ||
|
||
if (!(startDate && startDate < now)) { | ||
throw new Error('Running before StartDate - not executing') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if throwing an error here (and below) is desired behavior (do people monitor workflow executions)?
Happy to refactor this to something better if that's the preferred approach.
export function getStartDate() { | ||
return new Date(Date.parse(core.getInput('startDate'))) | ||
} | ||
|
||
export function getEndDate() { | ||
return new Date(Date.parse(core.getInput('endDate'))) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not doing any validation on the input, as Date.parse
will return NaN
if the format isn't a date.
For now I've managed to workaround this using a separate step to check the date and fail the workflow if it isn't within the expected range. I'll post this here in case there are others looking to do something similar.
|
Description
Add a
startDate
andendDate
parameters, which are used to configure the behavior of executing the auto-comment workflow. Either or bothstartDate
andendDate
can be provided, and the current time is checked agains these dates to determine if the workflow can be executed.The
startDate
andendDate
parameters are not required, and as such, this feature is backwards compatible.Motivation and Context
I want to support the case where we auto-comment only within a specific date-window. For example, if the company is on a company-wide holiday, I want to configure the auto-commenter to message out that the company is on break and what that means for providing support during this time.
Types of changes
Self Check before Merge