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

update pr upon changing baseBranch #19900

Closed
gberche-orange opened this issue Jan 18, 2023 · 7 comments · Fixed by #23010
Closed

update pr upon changing baseBranch #19900

gberche-orange opened this issue Jan 18, 2023 · 7 comments · Fixed by #23010
Assignees
Labels
auto:reproduction A minimal reproduction is necessary to proceed status:requirements Full requirements are not yet known, so implementation should not be started type:feature Feature (new functionality)

Comments

@gberche-orange
Copy link
Contributor

What would you like Renovate to be able to do?

as a renovate user
in order to change the baseBranch without having to update myself the existing PRs targetting an old base branch
I need renovate to update existing PRs baseBranch when renovate baseBranch is changed

Workaround: update the PRs using the script below using github cli

#!/bin/bash

set -x
set -f # disable file name expansion, especially in for loops

FROM="feature-bumps-for-v55"
TARGET="feature-bumps"
LIMIT="300"

echo "Editing renovate PRs to change base branch from ${FROM} to ${TARGET}"

PRS=$(gh pr list \
  --limit ${LIMIT} \
  --app "renovate" \
  --base "${FROM}" \
  --json number \
  | jq -r '.[].number' )

echo "first PRs (maxed at ${LIMIT}} to edit are: ${PRS}"

for p in $PRS; do
  gh pr edit $p --base ${TARGET}
done;


echo "rereun this command to check not more PR beyond $LIMIT is left to process"

If you have any ideas on how this should be implemented, please tell us here.

similar as current PR submissions

Is this a feature you are interested in implementing yourself?

No

@gberche-orange gberche-orange added priority-5-triage status:requirements Full requirements are not yet known, so implementation should not be started type:feature Feature (new functionality) labels Jan 18, 2023
@rarkins
Copy link
Collaborator

rarkins commented Jan 18, 2023

Please include:

  1. Current behavior (logs could be useful)
  2. Exact instructions to reproduce minimally

@gberche-orange
Copy link
Contributor Author

Please include:

2. Exact instructions to reproduce minimally
  • configure renovate with baseBranch=branch1
  • get some PRs opened with baseBranch=branch1
  • change renovate config with baseBranch=branch2
  • [x] Click on this checkbox to rebase all open PRs at once in the dashboard issue

Expected behavior

The existing PRs are edited to set the base branch to branch 2

1. Current behavior (logs could be useful)

The existing PRs are NOT edited to set the base branch to branch 2, only a force push is performed

Logs from renovate dashboard UI

DEBUG: migrated config
{
  "config": {
    "$schema": "https://docs.renovatebot.com/renovate-schema.json",
    "extends": [
      "github>whitesource/merge-confidence:beta",
      "config:base",
      ":disableRateLimiting",
      ":rebaseStalePrs"
    ],
    "baseBranches": [
      "feature-bumps-for-v56"
    ],
[...]

DEBUG: Found PR #1512(branch="renovate/cloudfoundry-community-ntp-release-4.x")
{
  "baseBranch": "feature-bumps-for-v56"
}

DEBUG: Branch summary
{
  "baseBranches": [
    {
      "branchName": "feature-bumps-for-v56",
      "sha": "098701b34f161503effe6b6c143af201509cea0b"
    }
  ],
  "branches": [
    {
      "automerge": false,
      "baseBranch": "feature-bumps-for-v56",
      "baseBranchSha": "098701b34f161503effe6b6c143af201509cea0b",
      "branchName": "renovate/cloudfoundry-community-ntp-release-4.x",
      "branchSha": "3660bc7d1291dea8f4de2891aa41f6e323f24433",
      "isModified": false,
      "isPristine": false
    },

DEBUG: Renovate repository PR statistics
{
  "stats": {
    "total": 428,
    "open": 101,
    "closed": 185,
    "merged": 142
  }
}

See the PR associated history not showing the PR edition, and instead the actions from the automated workaround script above "changing base branch from ..."
image

@rarkins
Copy link
Collaborator

rarkins commented Jan 18, 2023

Can you reproduce this on github.com using the hosted app?

I had expected that Renovate would detect it as modified and stop updating it, but it seems it force pushed after you made that modification. Is the git history itself correct, e.g. it's committed on top of the correct base branch commit?

@gberche-orange
Copy link
Contributor Author

gberche-orange commented Jan 18, 2023

Can you reproduce this on github.com using the hosted app?

This was reproduced on github.com with mend renovatebot saas version. I'm not running a self hosted version.

I had expected that Renovate would detect it as modified and stop updating it, but it seems it force pushed after you made that modification. Is the git history itself correct, e.g. it's committed on top of the correct base branch commit?

The renovate branch hasn't been modified outside renovate bot forced pushes. The only changes made are:

  • on the git history of the base branch
  • on the PR base branch, illustrated in changed the base branch and reflected in the screenshot below
    image

@rarkins
Copy link
Collaborator

rarkins commented Jan 19, 2023

Please reproduce it on a public repo and share the URL

@github-actions
Copy link
Contributor

github-actions bot commented Jun 6, 2023

Hi there,

Get your issue fixed faster by creating a minimal reproduction. This means a repository dedicated to reproducing this issue with the minimal dependencies and config possible.

Before we start working on your issue we need to know exactly what's causing the current behavior. A minimal reproduction helps us with this.

To get started, please read our guide on creating a minimal reproduction.

We may close the issue if you, or someone else, haven't created a minimal reproduction within two weeks. If you need more time, or are stuck, please ask for help or more time in a comment.

Good luck,

The Renovate team

@gberche-orange
Copy link
Contributor Author

thanks @RahulGautamSingh @rarkins !

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto:reproduction A minimal reproduction is necessary to proceed status:requirements Full requirements are not yet known, so implementation should not be started type:feature Feature (new functionality)
Projects
None yet
3 participants