Skip to content

Commit

Permalink
Merge #3650 Self review option for merge script
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Aug 29, 2022
2 parents e12cbfd + 83e4cc2 commit 7022058
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
9 changes: 5 additions & 4 deletions bin/ckan-merge-pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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__':
Expand Down

0 comments on commit 7022058

Please sign in to comment.