dailymotion-oss / octopilot

Automate your Gitops workflow, by automatically creating/merging GitHub Pull Requests

Home Page:https://dailymotion-oss.github.io/octopilot/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Issue] Octopilot fails to merge if the base branch is unprotected

mgarstecki opened this issue · comments

Hi, and thanks for the great tool :)

When trying to merge towards a base branch that is not protected at all, I get the following error:

octopilot --log-level debug --repo "..." --pr-base-branch main --pr-merge --update "..."
...
INFO[0003] Pull Request updated                          pull-request="https://github.com/.../pull/1" repository=...
DEBU[0003] No labels to add to the Pull Request          pull-request="https://github.com/.../pull/1" repository=...
DEBU[0003] No comments to add to the Pull Request        pull-request="https://github.com/.../pull/1" repository=...
DEBU[0004] Pull Request mergeable status is not available yet  mergeable-state=unknown pull-request="https://github.com/.../pull/1" repository=...
DEBU[0034] Pull Request is mergeable                     pull-request="https://github.com/.../pull/1" repository=...
ERRO[0034] Repository update failed                      error="failed to merge Pull Request https://github.com/.../pull/1: failed to wait until Pull Request https://github.com/.../pull/1 is mergeable: failed to retrieve the required status checks for branch main: GET https://api.github.com/repos/.../branches/main/protection/required_status_checks: 404 Branch not protected []" repository=...
INFO[0034] Updates finished                              repositories-count=1

Indeed there is no branch protection at all on this repository (yet).

I think it's about checking for the nature of the error here, I'll submit a PR to detect and ignore 404s here :)

hi,
yes, nice catch, thanks. Indeed we're only using it to merge on our master branches that are protected. I'm waiting for your PR ;-)

And there it is :)