mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-18 09:04:19 +01:00
scripts/merge-pr.py: Wrap merge commit message to 72 columns
This commit is contained in:
@@ -15,6 +15,7 @@ from github import Github
|
|||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import textwrap
|
||||||
|
|
||||||
|
|
||||||
def run_command(command):
|
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):
|
def merge_pr(pr_number):
|
||||||
# GitHub authentication
|
# GitHub authentication
|
||||||
token = os.getenv('GITHUB_TOKEN')
|
token = os.getenv('GITHUB_TOKEN')
|
||||||
@@ -84,7 +89,10 @@ def merge_pr(pr_number):
|
|||||||
pr_info = get_pr_info(g, repo, pr_number)
|
pr_info = get_pr_info(g, repo, pr_number)
|
||||||
|
|
||||||
# Format commit message
|
# 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
|
# Add Reviewed-by lines
|
||||||
for approver in pr_info['reviewed_by']:
|
for approver in pr_info['reviewed_by']:
|
||||||
|
|||||||
Reference in New Issue
Block a user