Skip to content

Commit

Permalink
feat: flag to control whether PRs can be edited by maintainers if `fo…
Browse files Browse the repository at this point in the history
…rkToken`is set

Platforms like GitHub expose options to control whether
a PR can be modified by maintainers.

See e.g. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork

This commit introduces a way to control this in Renovate when Renovate
operates in a fork. The option will default to `true` for backwards
compatibility.

Users may use this option to workaround issues as outlined in: renovatebot#16657.
  • Loading branch information
devversion committed Feb 3, 2023
1 parent 8a25fa3 commit 38da156
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/usage/configuration-options.md
Expand Up @@ -2181,6 +2181,17 @@ Defaults to `update`, but can also be set to `branch`.
This sets the level the postUpgradeTask runs on, if set to `update` the postUpgradeTask will be executed for every dependency on the branch.
If set to `branch` the postUpgradeTask is executed for the whole branch.

## prAllowMaintainerEdits

Use `prAllowMaintainerEdits` to control if maintainers can edit Renovate's pull requests.

When Renovate runs in a fork, this allows project maintainers to make manual changes to the
Renovate PR branch, without needing to create another new PR.

<!-- prettier-ignore -->
!!! note
This option is only relevant if you set `forkToken`.

## prBodyColumns

Use this array to provide a list of column names you wish to include in the PR tables.
Expand Down
7 changes: 7 additions & 0 deletions lib/config/options/index.ts
Expand Up @@ -1555,6 +1555,13 @@ const options: RenovateOptions[] = [
allowedValues: ['strict', 'flexible', 'none'],
default: 'strict',
},
{
name: 'prAllowMaintainerEdits',
description: 'Decides if maintainers can edit Renovate pull requests.',
type: 'boolean',
supportedPlatforms: ['github'],
default: true,
},
{
name: 'prCreation',
description: 'When to create the PR for a branch.',
Expand Down
1 change: 1 addition & 0 deletions lib/config/types.ts
Expand Up @@ -230,6 +230,7 @@ export interface RenovateConfig
postUpdateOptions?: string[];
prConcurrentLimit?: number;
prHourlyLimit?: number;
prAllowMaintainerEdits?: boolean;

defaultRegistryUrls?: string[];
registryUrls?: string[] | null;
Expand Down
1 change: 1 addition & 0 deletions lib/modules/platform/types.ts
Expand Up @@ -103,6 +103,7 @@ export interface CreatePRConfig {
labels?: string[] | null;
platformOptions?: PlatformPrOptions;
draftPR?: boolean;
allowMaintainerEdits?: boolean;
}
export interface UpdatePrConfig {
number: number;
Expand Down
1 change: 1 addition & 0 deletions lib/workers/repository/config-migration/pr/index.ts
Expand Up @@ -100,6 +100,7 @@ ${
sourceBranch: branchName,
// TODO #7154
targetBranch: config.defaultBranch!,
allowMaintainerEdits: config.prAllowMaintainerEdits,
prTitle,
prBody,
labels,
Expand Down
1 change: 1 addition & 0 deletions lib/workers/repository/onboarding/pr/index.ts
Expand Up @@ -174,6 +174,7 @@ If you need any further assistance then you can also [request help here](${
const pr = await platform.createPr({
sourceBranch: config.onboardingBranch!,
targetBranch: config.defaultBranch!,
allowMaintainerEdits: config.prAllowMaintainerEdits,
prTitle: config.onboardingPrTitle!,
prBody,
labels,
Expand Down
1 change: 1 addition & 0 deletions lib/workers/repository/update/pr/index.ts
Expand Up @@ -353,6 +353,7 @@ export async function ensurePr(
labels: prepareLabels(config),
platformOptions: getPlatformPrOptions(config),
draftPR: config.draftPR,
allowMaintainerEdits: config.prAllowMaintainerEdits,
});

incLimitedValue('PullRequests');
Expand Down

0 comments on commit 38da156

Please sign in to comment.