diff --git a/scripts/ci/pr-bot/processNewPrs.ts b/scripts/ci/pr-bot/processNewPrs.ts index 411e3b5428ec..1f178900e4f5 100644 --- a/scripts/ci/pr-bot/processNewPrs.ts +++ b/scripts/ci/pr-bot/processNewPrs.ts @@ -35,6 +35,7 @@ import { CheckStatus } from "./shared/checks"; * 5) Have already been processed * 6) Have notifications stopped * 7) The pr doesn't contain the go label (temporary). TODO(damccorm) - remove this when we're ready to roll this out to everyone. + * 8) The pr happens after the date we turn on the automation. TODO(damccorm) - remove this once this has been rolled out for a while. * unless we're supposed to remind the user after tests pass * (in which case that's all we need to do). */ @@ -45,6 +46,10 @@ function needsProcessed(pull: any, prState: typeof Pr): boolean { ); return false; } + let firstPrToProcess = new Date(2022, 3, 2, 20); + if (new Date(pull.created_at) < firstPrToProcess) { + return false; + } if (prState.remindAfterTestsPass && prState.remindAfterTestsPass.length > 0) { return true; } @@ -164,6 +169,9 @@ async function processPull( } if (!checkState.succeeded) { + if (!checkState.completed) { + return; + } return await notifyChecksFailed(pull, stateClient, prState); } prState.commentedAboutFailingChecks = false; diff --git a/scripts/ci/pr-bot/shared/persistentState.ts b/scripts/ci/pr-bot/shared/persistentState.ts index f7fade16f9b9..e440d2ae3d8d 100644 --- a/scripts/ci/pr-bot/shared/persistentState.ts +++ b/scripts/ci/pr-bot/shared/persistentState.ts @@ -32,7 +32,13 @@ function getReviewersForLabelFileName(label) { } async function commitStateToRepo() { - await exec.exec("git pull origin pr-bot-state"); + try { + await exec.exec("git pull origin pr-bot-state"); + } catch (err) { + console.log( + `Unable to get most recent repo contents, commit may fail: ${err}` + ); + } await exec.exec("git add state/*"); await exec.exec(`git commit -m "Updating config from bot" --allow-empty`); await exec.exec("git push origin pr-bot-state");