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

Remove slow review label after processing commands to avoid race #24765

Merged
merged 1 commit into from
Dec 23, 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
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"
);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes in this file are non-functional, I just ran npm run format

}
}

Expand Down