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

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

chekly opened this issue · comments

commented

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"
commented
image

I want a PULL REQUEST to be created automated

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

commented

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

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


               BUT PR and MERGE into MAIN BRANCH not created automatically!

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, ...)

commented
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!

commented

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

``

commented
image
commented

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

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 actions/first-interaction#10 for example

@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?