Skip to content

Commit

Permalink
feat: allow cleanup steps to be turned off (#643)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe committed Nov 25, 2020
1 parent bb946dd commit 055cd3a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/bin/release-please.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ const argv = yargs
describe: 'include library name in tags and release branches',
type: 'boolean',
default: false,
})
.option('clean', {
describe: 'should stale release PRs be cleaned post run?',
default: true,
type: 'boolean',
});
},
(argv: ReleasePROptions) => {
Expand Down
7 changes: 6 additions & 1 deletion src/release-pr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export interface BuildOptions {
lastPackageVersion?: string;
octokitAPIs?: OctokitAPIs;
versionFile?: string;
clean?: boolean;
}

export interface ReleasePROptions extends BuildOptions {
Expand Down Expand Up @@ -86,6 +87,7 @@ export class ReleasePR {
static releaserName = 'base';

apiUrl: string;
clean: boolean;
defaultBranch?: string;
labels: string[];
fork: boolean;
Expand Down Expand Up @@ -122,6 +124,7 @@ export class ReleasePR {
this.lastPackageVersion = options.lastPackageVersion
? options.lastPackageVersion.replace(/^v/, '')
: undefined;
this.clean = options.clean ?? true;

this.gh = this.gitHubInstance(options.octokitAPIs);

Expand Down Expand Up @@ -304,7 +307,9 @@ export class ReleasePR {
`${this.repoUrl} find stale PRs with label "${this.labels.join(',')}"`,
CheckpointType.Success
);
await this.closeStaleReleasePRs(pr, includePackageName);
if (this.clean) {
await this.closeStaleReleasePRs(pr, includePackageName);
}
}
return pr;
}
Expand Down

0 comments on commit 055cd3a

Please sign in to comment.