Skip to content

Commit e138d84

Browse files
committed
Add variables to override the commit author name and email
1 parent 90843d3 commit e138d84

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

create-pull-request.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def remote_branch_exists(repo, branch):
5252
return False
5353

5454

55-
def get_head_author(event_name, event_data):
55+
def get_author_default(event_name, event_data):
5656
if event_name == "push":
5757
email = "{head_commit[author][email]}".format(**event_data)
5858
name = "{head_commit[author][name]}".format(**event_data)
@@ -203,8 +203,11 @@ def process_event(event_name, event_data, repo, branch, base, remote_exists):
203203
print("Pull request branch '%s' already exists for this commit. Skipping." % branch)
204204
sys.exit()
205205

206-
# Get the HEAD committer's email and name
207-
author_email, author_name = get_head_author(event_name, event_data)
206+
# Get the default for author email and name
207+
author_email, author_name = get_author_default(event_name, event_data)
208+
# Set commit author overrides
209+
author_email = os.getenv('COMMIT_AUTHOR_EMAIL', author_email)
210+
author_name = os.getenv('COMMIT_AUTHOR_NAME', author_name)
208211
# Set git configuration
209212
set_git_config(repo.git, author_email, author_name)
210213
# Checkout branch

0 commit comments

Comments
 (0)