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

considers skipped as success #780

Open
alita-moore opened this issue Jan 18, 2022 · 8 comments
Open

considers skipped as success #780

alita-moore opened this issue Jan 18, 2022 · 8 comments
Labels
enhancement New feature or request

Comments

@alita-moore
Copy link

if the check is skipped instead of failed; see alita-moore/EIPs#388

Screen Shot 2022-01-17 at 8 55 26 PM

In this case the "greetings" was the only required check. But the bot kodiak still merged. It would be nice to have an option to consider skips as fails, just to be safe.

@alita-moore alita-moore added the bug Something isn't working label Jan 18, 2022
@sbdchd
Copy link
Collaborator

sbdchd commented Jan 18, 2022

Yeah seems like it could fit behind a config flag, something like, require_skipped_checks = true

We need to update the evaluation logic:

required = set(branch_protection.requiredStatusCheckContexts)
for status_context in contexts:
# handle dont_wait_on_status_checks. We want to consider a
# status_check failed if it is incomplete and in the
# configuration.
if (
status_context.context in config.merge.dont_wait_on_status_checks
and status_context.state
in (StatusState.EXPECTED, StatusState.PENDING)
):
skippable_contexts.append(status_context.context)
continue
if status_context.state in (StatusState.ERROR, StatusState.FAILURE):
failing_contexts.append(status_context.context)
elif status_context.state in (
StatusState.EXPECTED,
StatusState.PENDING,
):
pending_contexts.append(status_context.context)
else:
assert status_context.state == StatusState.SUCCESS
passing_contexts.append(status_context.context)
for check_run in deduplicate_check_runs(check_runs):
if (
check_run.name in config.merge.dont_wait_on_status_checks
and check_run.conclusion in (None, CheckConclusionState.NEUTRAL)
):
skippable_contexts.append(check_run.name)
continue
if check_run.conclusion is None:
continue
if check_run.conclusion == CheckConclusionState.SUCCESS:
passing_contexts.append(check_run.name)
if check_run.conclusion in (
CheckConclusionState.ACTION_REQUIRED,
CheckConclusionState.FAILURE,
CheckConclusionState.TIMED_OUT,
CheckConclusionState.CANCELLED,
CheckConclusionState.SKIPPED,
CheckConclusionState.STALE,
):
failing_contexts.append(check_run.name)
passing = set(passing_contexts)
failing = set(failing_contexts)
# we have failing statuses that are required
failing_required_status_checks = failing & required

Currently we check the failing checks and compare them against the branch protection's required checks.

@sbdchd sbdchd added enhancement New feature or request and removed bug Something isn't working labels Jan 18, 2022
@chdsbd
Copy link
Owner

chdsbd commented Jan 18, 2022

I think this current behavior is correct, but we could add this as an enhancement.

GitHub considers "skipped" checks as passing. If you want to block merging if a check has been skipped, I think you could use a GitHub Action to fail the build.

@alita-moore
Copy link
Author

alita-moore commented Jan 18, 2022

I think this current behavior is correct, but we could add this as an enhancement.

GitHub considers "skipped" checks as passing. If you want to block merging if a check has been skipped, I think you could use a GitHub Action to fail the build.

do you mean to use a separate github action to fail the builds that skip so that kodiak would not merge skipped checks? Do you have any in mind?

@alita-moore
Copy link
Author

In any case, you could simply fail the skipped check instead of skipping it if a criteria is not met, but then you will be showing the user that the check failed when in reality it was skipped. Which (imo) is confusing.

@chdsbd
Copy link
Owner

chdsbd commented Jan 18, 2022

@alita-moore Maybe this will help for your use case? #719 (comment)

I think the https://github.com/technote-space/workflow-conclusion-action action can be used to fail the build if the conclusion of some jobs is failure

@alita-moore
Copy link
Author

alita-moore commented Feb 3, 2022

@chdsbd we can't use kodiak until this feature is implemented because it allows for circumventing required checks when you go from draft -> PR: ethereum/EIPs#4749

@chdsbd
Copy link
Owner

chdsbd commented Feb 4, 2022

@alita-moore I've deployed #785 to production, so you can enable the merge.block_on_neutral_required_check_runs setting (currently undocumented) to stop Kodiak from merging a PR if a required check run has a neutral status.

Screen Shot 2022-02-03 at 9 17 07 PM

kodiakhq bot pushed a commit that referenced this issue Feb 4, 2022
When `merge.block_on_neutral_required_check_runs` is enabled, we won't merge the pull request if a required check run has a neutral conclusion.

related: #780
@alita-moore
Copy link
Author

Thank you 🙏🙇‍♀️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants