Open jfoechsler opened 1 year ago
Any plans to add support for GitHub auto-merge by the way? Maybe that could be nice addition to let GitHub merge PR when checks are done instead of doing it in code.
I'm using that in some workflows like this:
gh pr merge --squash --auto <PR>
I ran into similar problems with auto merging PRs. Maybe this will help others.
First, I had to give the Github App used by octopilot read-only admin permissions to solve auth issues.
This is need because the call here leads to GET requests to repos/%v/%v/branches/%v/protection/required_status_checks
. URLs of this format are listed under https://docs.github.com/en/rest/overview/permissions-required-for-github-apps?apiVersion=2022-11-28#repository-permissions-for-administration
Second, and this one was the most confusing to figure out: Github Workflows don't post "status" updates they post "checks" when completed/failed. Those are completely different APIs. You can get your Github Workflow to manually post a "status" as a work around. For example:
on:
push:
branches:
- octopilot-*
permissions:
contents: read
statuses: write
jobs:
...
- name: Post a status check
uses: actions/github-script@v7
with:
script: |
github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.sha,
state: "success",
context: "<check name>"
});
Another thing I've observed is that Github Actions Workflows can't post status updates with the default token when triggered using on: pull_request
. It does work with a on: push
though :confused:
I think this project should switch to the Github provided auto-merge PR feature. It would also mean not having to give this app read-only admin permissions.
However, that's only available via GraphQL API AFAIK: https://docs.github.com/en/graphql/reference/mutations#enablepullrequestautomerge
ok thanks for the details. I'll have a look at enabling auto-merge, and also using the checks API in addition to the status API.
Hello. Have issue merging PR where Required Checks are defined on repository. Octopilot seems to determine PR can be merged before letting checks do its thing.
Please advise if I may be doing something wrong or what. Thanks!