Skip to content

Commit

Permalink
Allow ops-bot to merge to main if main is the default branch. (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdice authored Jul 9, 2024
1 parent e236fc8 commit bacc3c5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/plugins/AutoMerger/auto_merger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class AutoMerger extends OpsBotPlugin {
});

// Check if PR is mergeable (all green)
if (!this.isPrMergeable(pr)) {
if (!this.isPrMergeable(pr, repo.default_branch)) {
this.logger.info({ pr }, "PR not mergeable");
return;
}
Expand Down Expand Up @@ -97,14 +97,14 @@ export class AutoMerger extends OpsBotPlugin {
*
* @param pr
*/
isPrMergeable(pr: PullsGetResponseData): boolean {
isPrMergeable(pr: PullsGetResponseData, default_branch: string): boolean {
const mergeable_state = pr.mergeable_state;
const mergeable = pr.mergeable;
const baseRef = pr.base.ref;
return (
(mergeable_state === "clean" || mergeable_state === "unstable") &&
mergeable === true &&
baseRef !== "main"
(baseRef !== "main" || default_branch === "main")
);
}

Expand Down

0 comments on commit bacc3c5

Please sign in to comment.