Skip to content
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

[BEAM-13925] A couple small pr-bot bug fixes #16996

Merged
merged 2 commits into from
Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions scripts/ci/pr-bot/processNewPrs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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).
*/
Expand All @@ -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;
}
Expand Down Expand Up @@ -164,6 +169,9 @@ async function processPull(
}

if (!checkState.succeeded) {
if (!checkState.completed) {
return;
}
return await notifyChecksFailed(pull, stateClient, prState);
}
prState.commentedAboutFailingChecks = false;
Expand Down
8 changes: 7 additions & 1 deletion scripts/ci/pr-bot/shared/persistentState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down