Skip to content

Commit

Permalink
Remove slow review label after processing commands to avoid race (#24765
Browse files Browse the repository at this point in the history
)
  • Loading branch information
damccorm authored Dec 23, 2022
1 parent baa8910 commit 820839f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
19 changes: 9 additions & 10 deletions scripts/ci/pr-bot/processPrUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,19 @@ async function processPrComment(
const commentContents = payload.comment.body;
const commentAuthor = payload.sender.login;
const pullAuthor = getPullAuthorFromPayload(payload);
console.log(commentContents);
const processedCommand = await processCommand(
payload,
commentAuthor,
commentContents,
stateClient,
reviewerConfig
);
// If there's been a comment by a non-author, we can remove the slow review label
if (commentAuthor !== pullAuthor && commentAuthor !== BOT_NAME) {
await removeSlowReviewLabel(payload);
}
console.log(commentContents);
if (
await processCommand(
payload,
commentAuthor,
commentContents,
stateClient,
reviewerConfig
)
) {
if (processedCommand) {
// If we've processed a command, don't worry about trying to change the attention set.
// This is not a meaningful push or comment from the author.
console.log("Processed command");
Expand Down
12 changes: 9 additions & 3 deletions scripts/ci/pr-bot/shared/persistentState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,20 @@ async function commitStateToRepo() {
);
}
// Print changes for observability
await exec.exec("git status", [], {ignoreReturnCode: true});
await exec.exec("git status", [], { ignoreReturnCode: true });
await exec.exec("git add state/*");
const changes = await exec.exec("git diff --quiet --cached origin/pr-bot-state state", [], {ignoreReturnCode: true});
const changes = await exec.exec(
"git diff --quiet --cached origin/pr-bot-state state",
[],
{ ignoreReturnCode: true }
);
if (changes == 1) {
await exec.exec(`git commit -m "Updating config from bot" --allow-empty`);
await exec.exec("git push origin pr-bot-state");
} else {
console.log("Skipping updating state branch since there are no changes to commit");
console.log(
"Skipping updating state branch since there are no changes to commit"
);
}
}

Expand Down

0 comments on commit 820839f

Please sign in to comment.