mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
scripts/merge-pr.py: Wrap merge commit message to 72 columns
This commit is contained in:
parent
74bd1ed8f4
commit
ec94770d08
1 changed files with 9 additions and 1 deletions
|
@ -15,6 +15,7 @@ from github import Github
|
|||
import os
|
||||
import subprocess
|
||||
import tempfile
|
||||
import textwrap
|
||||
|
||||
|
||||
def run_command(command):
|
||||
|
@ -68,6 +69,10 @@ def get_pr_info(g, repo, pr_number):
|
|||
}
|
||||
|
||||
|
||||
def wrap_text(text, width=72):
|
||||
return '\n'.join(textwrap.wrap(text, width=width))
|
||||
|
||||
|
||||
def merge_pr(pr_number):
|
||||
# GitHub authentication
|
||||
token = os.getenv('GITHUB_TOKEN')
|
||||
|
@ -84,7 +89,10 @@ def merge_pr(pr_number):
|
|||
pr_info = get_pr_info(g, repo, pr_number)
|
||||
|
||||
# Format commit message
|
||||
commit_message = f"Merge '{pr_info['title']}' from {pr_info['author']}\n\n{pr_info['body']}\n"
|
||||
commit_title = f"Merge '{pr_info['title']}' from {pr_info['author']}"
|
||||
commit_body = wrap_text(pr_info['body'])
|
||||
|
||||
commit_message = f"{commit_title}\n\n{commit_body}\n"
|
||||
|
||||
# Add Reviewed-by lines
|
||||
for approver in pr_info['reviewed_by']:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue