diff --git a/CHANGELOG.md b/CHANGELOG.md index 1615acc78f..a8a949bb3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ All notable changes to this project will be documented in this file. - [Netkan] Filter duplicate co-authors from SpaceDock (#3599 by: HebaruSan; reviewed: techman83) - [Netkan] Log errors instead of PRs for OOO mods on GitHub (#3625 by: HebaruSan) - [Core] Cache remote build map, fetch in registry refresh (#3624 by: HebaruSan; reviewed: techman83) +- [Tooling] Self review option for merge script (#3650 by: HebaruSan; reviewed: DasSkelett) ## v1.31.0 (IKAROS) diff --git a/bin/ckan-merge-pr.py b/bin/ckan-merge-pr.py index 23698d979c..3ab4042688 100755 --- a/bin/ckan-merge-pr.py +++ b/bin/ckan-merge-pr.py @@ -82,8 +82,8 @@ def latest_commit(self, repo: CkanRepo) -> Commit: def merge_commit_message(self) -> str: return f'Merge #{self.pull_request.number} {self.pull_request.title}' - def merge_into(self, repo: CkanRepo) -> bool: - if not self.approvers(): + def merge_into(self, repo: CkanRepo, self_review: bool) -> bool: + if not self_review and not self.approvers(): print(f'PR #{self.pull_request.number} is not approved!') return False if not repo.on_master(): @@ -111,12 +111,13 @@ def merge_into(self, repo: CkanRepo) -> bool: @option('--repo-path', type=click.Path(exists=True, file_okay=False), default='.', help='Path to CKAN working copy') @option('--token', required=False, envvar='GITHUB_TOKEN') +@option('--self-review', is_flag=True, default=False) @argument('pr_num', type=click.INT) -def merge_pr(repo_path: str, token: str, pr_num: int) -> None: +def merge_pr(repo_path: str, token: str, self_review: bool, pr_num: int) -> None: ckr = CkanRepo(repo_path) ckpr = CkanPullRequest(Github(token).get_repo('KSP-CKAN/CKAN').get_pull(pr_num)) sys.exit(ExitStatus.success - if ckpr.merge_into(ckr) + if ckpr.merge_into(ckr, self_review) else ExitStatus.failure) if __name__ == '__main__':