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

fix(bitbucket): use last created PR in decision process #32672

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jgraglia
Copy link

Changes

When looking for an existing PR in the decision process, use the last PR created (using it's number) as it the the one with the last up to date intention of the dev team (approved,ignored, comments...)

Context

Renovate running manually as docker container, against repos on BitBucket cloud.

A non immortal PR has been created and merged.
But it was en error and the dev team, manually revert the merge commit.
Renovate still propose new PR for the same patch and the dev team can no more ignore the patch (declining subsequent PRs has no effect)

When a non immortal PR has been created multiple times, the decision process was taking the first PR returned by BitBucket cloud who happens to sort by ascending number (oldest -> newest).

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@jgraglia jgraglia changed the title bugfix: use last created PR in decision process (bitbucket cloud) fix: use last created PR in decision process (bitbucket cloud) Nov 22, 2024
@jgraglia jgraglia changed the title fix: use last created PR in decision process (bitbucket cloud) fix(bitbucket): use last created PR in decision process Nov 22, 2024
@jgraglia jgraglia force-pushed the bugfix/use_last_created_pr_in_decision branch from 2861256 to 2b29a48 Compare November 22, 2024 08:39
matchesState(p.state, state),
);
const pr = prList
.sort((a, b) => b.number - a.number)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weren't they already sorted on line 315?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the sort at line 315 is on another branch of the code (if (includeOtherAuthors) and handle another kind of object (PrResponse vs Pr)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer that we sort once, in one location, instead of logic being duplicated like now and also it gets repeatedly sorted every time findPr() is called

@setchy setchy added the platform:bitbucket Bitbucket Cloud platform label Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:bitbucket Bitbucket Cloud platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants