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

fix(bot): handling of duplicate check suites #688

Merged
merged 4 commits into from
Jul 11, 2021

Conversation

chdsbd
Copy link
Owner

@chdsbd chdsbd commented Jul 10, 2021

Previously if a user created duplicate check suites with the same check run name, Kodiak would consider all of the check suites, not just the most recent one. So if the check suite had failed previously, but the latest check suite passed, Kodiak would incorrectly mark the PR as blocked for merging.

Now Kodiak only considers the most recent check run name.

Previously if a user created duplicate check suites with the same check run name, Kodiak would consider all of the check suites, not just the most recent one. So if the check suite had failed previously, but the latest check suite passed, Kodiak would incorrectly mark the PR as blocked for merging.

Now Kodiak only considers the most recent check run name.
@chdsbd chdsbd requested a review from sbdchd July 10, 2021 23:03
@chdsbd chdsbd added the automerge Mark PR for auto merge by Kodiak label Jul 10, 2021
Comment on lines 267 to 270
check_run_map = dict()
for check_run in check_runs:
check_run_map[check_run.name] = check_run
return list(check_run_map.values())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
check_run_map = dict()
for check_run in check_runs:
check_run_map[check_run.name] = check_run
return list(check_run_map.values())
check_run_map = {
check_run.name: check_run
for check_run in check_runs
}
return check_run_map.values()

@@ -260,6 +263,13 @@ def review_status(reviews: List[PRReview]) -> PRReviewState:
return status


def deduplicate_check_runs(check_runs: Iterable[CheckRun]) -> List[CheckRun]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
def deduplicate_check_runs(check_runs: Iterable[CheckRun]) -> List[CheckRun]:
def deduplicate_check_runs(check_runs: Iterable[CheckRun]) -> Iterable[CheckRun]:

name="Pre-merge checks", conclusion=CheckConclusionState.FAILURE
),
create_check_run(
name="Pre-merge checks", conclusion=CheckConclusionState.SUCCESS
Copy link
Collaborator

Choose a reason for hiding this comment

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

does the GitHub API order the results with the most recent ones last?

Copy link
Owner Author

Choose a reason for hiding this comment

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

I opened a support ticket about that but my assumption here is yes

@chdsbd chdsbd requested a review from sbdchd July 11, 2021 01:32
@kodiakhq kodiakhq bot merged commit 942221e into master Jul 11, 2021
@kodiakhq kodiakhq bot deleted the chris/fix-dupe-check-suites-handling branch July 11, 2021 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Mark PR for auto merge by Kodiak
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants