Skip to content

Commit 4a753ab

Browse files
FlyingPhishFlyingPhish
FlyingPhish
authored and
FlyingPhish
committed
unfucking things
1 parent 7338411 commit 4a753ab

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

github-contributing.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
import argparse
33
import subprocess
44

5+
def get_github_username():
6+
"""Retrieve GitHub username from local Git configuration."""
7+
result = subprocess.run(['git', 'config', '--get', 'user.name'], capture_output=True, text=True)
8+
if result.returncode == 0 and result.stdout:
9+
return result.stdout.strip()
10+
else:
11+
raise Exception("Failed to retrieve GitHub username from Git config.")
12+
513
def update_fork():
614
# Sync your fork's main branch with the original repository's main branch
715
print("Updating fork...")
@@ -28,11 +36,12 @@ def push_changes(branch_name, commit_message):
2836
def create_pull_request(branch_name, pr_title, pr_file):
2937
# Create a pull request on GitHub using the GitHub CLI
3038
print("Creating pull request...")
39+
github_username = get_github_username()
3140
with open(pr_file, 'r') as file:
3241
pr_body = file.read() # Read the PR description from a markdown file
3342
subprocess.run(['gh', 'pr', 'create',
3443
'--base', 'main',
35-
'--head', f'{branch_name}',
44+
'--head', f'{github_username}:{branch_name}',
3645
'--title', pr_title,
3746
'--body', pr_body], check=True) # Create a pull request with the specified title and markdown body
3847
print("Pull request created successfully.")

0 commit comments

Comments
 (0)