Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support rerunning --pr-merge with --strategy append #283

Open
MPV opened this issue Nov 21, 2023 · 3 comments
Open

Support rerunning --pr-merge with --strategy append #283

MPV opened this issue Nov 21, 2023 · 3 comments

Comments

@MPV
Copy link
Contributor

MPV commented Nov 21, 2023

I'd like to be able to "rerun Octopilot, and have it attempt auto-merging again".

Steps to reproduce:

  1. Let Octopilot create PRs (with flags --pr-merge and --strategy append)
  2. Some PRs may not have auto-merged, for example/possibly due to outstanding issues as described in:
  3. Return a while later, rerunning step 1 above.

Expected results:

  1. PRs created (and some merged)
  2. PRs changing into a merge'able state (approved by codeowners, checks passing)
  3. PRs outstanding being merged.

Actual results:

  1. OK
  2. OK
  3. PRs outstanding are not touched by Octopilot, as it considers No changes recorded, nothing to push and Repository update has no changes, as seen in:
time="2023-11-20T15:15:31Z" level=debug msg="Git repository cloned" git-reference=HEAD git-url="https://github.com/my-org/my-repo.git" local-path=/tmp/octopilot1734020439/my-org/my-repo
time="2023-11-20T15:15:31Z" level=info msg="Found existing Pull Request" labels="[HAWK-1546 octopilot-update gha-workflows]" pull-request="https://github.com/my-org/my-repo/pull/310" repository=my-org/my-repo
time="2023-11-20T15:15:31Z" level=debug msg="Updater finished" changes=true repository=my-org/my-repo updater="Exec[cmd=sh,args=[-c git add .]]"
time="2023-11-20T15:15:31Z" level=debug msg="All updaters finished" repository=my-org/my-repo
time="2023-11-20T15:15:31Z" level=debug msg="No changes recorded, nothing to push" repository=my-org/my-repo
time="2023-11-20T15:15:31Z" level=warning msg="Repository update has no changes" repository=my-org/my-repo
time="2023-11-20T15:15:31Z" level=info msg="Updates finished" repositories-count=3
@MPV
Copy link
Contributor Author

MPV commented Nov 21, 2023

I imagine this could be the related code:

repoUpdated, pr, err := strategy.Run(ctx)
if err != nil {
return false, fmt.Errorf("%w", err)
}
if !repoUpdated {
return false, nil
}

...which runs into this:
if !changesCommitted {
logrus.WithField("repository", s.Repository.FullName()).Debug("No changes recorded, nothing to push")
return false, nil, nil
}

...which makes this code not run:
if !options.GitHub.PullRequest.Merge.Enabled {
logrus.WithFields(logrus.Fields{
"repository": r.FullName(),
}).Debug("Pull Request merging is disabled")
return true, nil
}
if pr == nil {
logrus.WithFields(logrus.Fields{
"repository": r.FullName(),
}).Warning("No Pull Request was created - can't merge it!")
return true, nil
}
err = r.mergePullRequest(ctx, options.GitHub, pr)
if err != nil {
return true, fmt.Errorf("failed to merge Pull Request %s: %w", pr.GetHTMLURL(), err)
}

Would you agree that's the case?

How might we work towards supporting this?

@vbehar
Copy link
Collaborator

vbehar commented Nov 22, 2023

ok, so if I understand correctly you'd like octopilot to retry merging an existing PR, even if it doesn't need to change anything in the code.
that's reasonable, I'll have a look at the code to see how to enable that.

@MPV
Copy link
Contributor Author

MPV commented Nov 22, 2023

ok, so if I understand correctly you'd like octopilot to retry merging an existing PR, even if it doesn't need to change anything in the code. that's reasonable, I'll have a look at the code to see how to enable that.

Yes, that's the idea:

"Here's the code change I want merged, octopilot make it so." 🤖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants