octopilot icon indicating copy to clipboard operation
octopilot copied to clipboard

Octopilot to create automated PR instead of using a manual human Pull Request

Open chekly opened this issue 1 year ago • 11 comments

I am using Octopilot in my GitubAction to create a PR instead of using a manual human Pull Request. I want to reproduce this (automated no human clicking)

image

following this documentation : https://dailymotion-oss.github.io/octopilot/v1.2.7/index.html#pull-request

The below command does not give automated Pull Request creation

                octopilot \
                --pr-merge "true" \
                --pr-merge-method "merge" \
                --pr-merge-commit-title "cadevce(deps): updating cadevce app" \
                --pr-merge-commit-message "{{ githubRelease (printf oxygen app) | expandGithubLinks | extractMarkdownURLs | md2txt }}" \
                --update "yaml(file=values.yaml,path='app.imagetags')=file(path='values.yaml')" \
                --strategy "recreate" \
                --pr-labels "octopilot-chuj" \
                --pr-body-update-operation "not applicable" \
                --pr-title "Updating files"

chekly avatar Jun 05 '23 11:06 chekly

image

I want a PULL REQUEST to be created automated

chekly avatar Jun 05 '23 11:06 chekly

hi, can you please copy/paste the output of octopilot please? if needed you can also run it in a more verbose mode with the --log-level flag, set to debug or even trace

vbehar avatar Jun 05 '23 11:06 vbehar

Hi in my team environment, we create PR manually. I am not having any error in using Octopilot. My team just want to know what commands to create automated PR instead of using a manual human Pull Request.

We want Octopilot to CREATE PR from a DEV branch and merge them into the the MAIN branch without human clicking

chekly avatar Jun 05 '23 11:06 chekly

               We are using octopilot \
                            --strategy "recreate"  \
                            .....


               BUT PR and MERGE into MAIN BRANCH not created automatically!

chekly avatar Jun 05 '23 11:06 chekly

sorry I don't understand your issue. can you please copy/paste the whole octopilot command (with all the flags), and the output of this command?

usually if octopilot doesn't create a pull request, it's because there is nothing to change.

and if octopilot creates a PR but doesn't merge it automatically, it may be because the PR is not "mergeable". for example depending on your github settings, you may require extra steps (approval policy, ...)

vbehar avatar Jun 05 '23 11:06 vbehar

My full octopilot command

`` octopilot
--github-auth-method "token"
--github-token "${{ steps.backstage-runner-test-token.outputs.token }}"
--github-app-id 300550
--github-installation-id 34466512
--git-clone-dir "github.com"
--repo "backstage/manifest-temple"
--pr-base-branch "main"
--pr-merge "true"
--pr-merge-method "merge"
--pr-merge-commit-title "oxygen(deps): updating oxygen apps"
--pr-merge-commit-message "{{ githubRelease (printf oxygen apps) | expandGithubLinks | extractMarkdownURLs | md2txt }}"
--update "yaml(file=values.yaml,path='app.imagetags')=file(path='values.yaml')"
--strategy "recreate"
--pr-labels "octopilot-chuj"
--pr-body-update-operation "not applicable"
--pr-title "Updating files"

  ``

i just want to create PR in an automated way!

chekly avatar Jun 05 '23 11:06 chekly

The error from the GithubAction

`` time="2023-06-05T11:57:51Z" level=error msg="Repository update failed" error="failed to create Pull Request: failed to create a new Pull Request for repository backstage/manifest-temple: POST https://api.github.com/repos/backstage/manifest-temple/pulls: 403 Resource not accessible by integration []" repository=backstage/manifest-temple time="2023-06-05T11:57:51Z" level=info msg="Updates finished" repositories-count=1

``

chekly avatar Jun 05 '23 12:06 chekly

image

chekly avatar Jun 05 '23 12:06 chekly

please do note this repository=backstage/manifest-temple exist internally!, the token attached to the Octopilot from the GithubApp token authentication gives full administration, content write and read

chekly avatar Jun 05 '23 12:06 chekly

from the error message POST https://api.github.com/repos/backstage/manifest-temple/pulls: 403 Resource not accessible by integration I think there's a permission issue somewhere - not related to octopilot.

I suggest to contact the github support or try to find something on google, such as https://github.com/actions/first-interaction/issues/10 for example

vbehar avatar Jun 05 '23 13:06 vbehar

@chekly I have gotten that to work — so just to say that it's possible (using a GitHub app). Have you tried using a token from the app using another method (i.e. curl/GH CLI) to verify that it works (is installed on your org?) and has the permissions you need?

MPV avatar Nov 20 '23 08:11 MPV