Skip to content

Commit

Permalink
feat: add log messages for api-review/skip-delay label handling (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
itsananderson authored Jan 22, 2025
1 parent 5be84e8 commit 9550c33
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/api-review-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,22 @@ export const hasAPIReviewRequestedLabel = (pr: PullRequest) =>
export const getPRReadyDate = (pr: PullRequest) => {
let readyTime = new Date(pr.created_at).getTime();

if (!pr.labels.some((l) => l.name === API_SKIP_DELAY_LABEL)) {
if (pr.labels.some((l) => l.name === API_SKIP_DELAY_LABEL)) {
log(
'getPRReadyDate',
LogLevel.INFO,
`${pr.number} has "${API_SKIP_DELAY_LABEL}" label - skipping minimum open time`,
);
} else {
const isMajorMinor = pr.labels.some((l) => isSemverMajorMinorLabel(l.name));
readyTime += isMajorMinor ? MINIMUM_MINOR_OPEN_TIME : MINIMUM_PATCH_OPEN_TIME;
log(
'getPRReadyDate',
LogLevel.INFO,
`${pr.number} has no "${API_SKIP_DELAY_LABEL}" label - applying minimum open time for ${
isMajorMinor ? 'major/minor' : 'patch'
}`,
);
}

return new Date(readyTime).toISOString().split('T')[0];
Expand Down

0 comments on commit 9550c33

Please sign in to comment.