chdsbd / kodiak

🔮 A bot to automatically update and merge GitHub PRs

Home Page:https://kodiakhq.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wait for in progress github checks before merging

styfle opened this issue · comments

Some repositories use GitHub Actions to dynamically create jobs based on what files changed.

In that case, we can't set those checks to "required" because it would block PRs that don't create those jobs.

However, this caused Kodiak to permaturally merge a PR while the checks were still in progress.

It would be great if there was a way to say "don't merge while any checks are in progress".

Hey @styfle,

Thanks for the suggestion!

On a separate project, we ran into a similar issue with GitHub Actions when using the "on.push.paths" configuration option. As a workaround, we're using https://github.com/fkirc/skip-duplicate-actions, which seems to work: https://github.com/sbdchd/squawk/blob/f8588d1daf1d09a57a1dc8d1efed49375ed0df32/.github/workflows/js.yml

We use CircleCI in Kodiak, which makes skipping jobs much easier and we have a small script to handle that:

- run:
name: skip build if no changes
command: |
./s/stop_ci_if_no_changes bot/

Anyway, I think we could add an option to support not merging until all checks have finished, but wouldn't that mean if a job failed, the PR would still be merged?

Anyway, I think we could add an option to support not merging until all checks have finished, but wouldn't that mean if a job failed, the PR would still be merged?

Hmm good point. So maybe the new option should be something like "wait for optional checks to pass" in addition to required checks.

One catch I just realized is that the GitHub API only provides a list of required status checks, not optional status checks.

So there isn't a way for Kodiak to know the optional status checks unless we provide them manually.

Some solution would probably interact with the code here:

required_status_checks = set(branch_protection.requiredStatusCheckContexts)