feat: add config for running in a date window#29
Open
fryz wants to merge 1 commit intowow-actions:masterfrom
Open
feat: add config for running in a date window#29fryz wants to merge 1 commit intowow-actions:masterfrom
fryz wants to merge 1 commit intowow-actions:masterfrom
Conversation
|
👋 @fryz |
fryz
commented
Nov 22, 2022
| core.info(`Today: ${now}`) | ||
|
|
||
| if (!(startDate && startDate < now)) { | ||
| throw new Error('Running before StartDate - not executing') |
Author
There was a problem hiding this comment.
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.
fryz
commented
Nov 22, 2022
Comment on lines
+102
to
+108
| export function getStartDate() { | ||
| return new Date(Date.parse(core.getInput('startDate'))) | ||
| } | ||
|
|
||
| export function getEndDate() { | ||
| return new Date(Date.parse(core.getInput('endDate'))) | ||
| } |
Author
There was a problem hiding this comment.
I'm not doing any validation on the input, as Date.parse will return NaN if the format isn't a date.
Author
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add a
startDateandendDateparameters, which are used to configure the behavior of executing the auto-comment workflow. Either or bothstartDateandendDatecan be provided, and the current time is checked agains these dates to determine if the workflow can be executed.The
startDateandendDateparameters 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