Skip to content

Commit

Permalink
fix(gitlab): filter issues for ignorePrAuthor (#28996)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
  • Loading branch information
rarkins and viceice committed May 12, 2024
1 parent 5540e0b commit 054e53e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion docs/usage/configuration-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -2060,9 +2060,12 @@ Applicable for Composer only for now.
## ignorePrAuthor

This is usually needed if someone needs to migrate bot accounts, including from the Mend Renovate App to self-hosted.
An additional use case is for GitLab users of project or group access tokens who need to rotate them.

If `ignorePrAuthor` is configured to true, it means Renovate will fetch the entire list of repository PRs instead of optimizing to fetch only those PRs which it created itself.
You should only want to enable this if you are changing the bot account (e.g. from `@old-bot` to `@new-bot`) and want `@new-bot` to find and update any existing PRs created by `@old-bot`.
It's recommended to revert this setting once that transition period is over and all old PRs are resolved.

Setting this field to `true` in GitLab will also mean that all Issues will be fetched instead of only those by the bot itself.

## ignorePresets

Expand Down
9 changes: 6 additions & 3 deletions lib/modules/platform/gitlab/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1069,11 +1069,14 @@ export async function setBranchStatus({

export async function getIssueList(): Promise<GitlabIssue[]> {
if (!config.issueList) {
const query = getQueryString({
const searchParams: Record<string, string> = {
per_page: '100',
scope: 'created_by_me',
state: 'opened',
});
};
if (!config.ignorePrAuthor) {
searchParams.scope = 'created_by_me';
}
const query = getQueryString(searchParams);
const res = await gitlabApi.getJson<
{ iid: number; title: string; labels: string[] }[]
>(`projects/${config.repository}/issues?${query}`, {
Expand Down

0 comments on commit 054e53e

Please sign in to comment.