Skip to content

Commit 4efcea6

Browse files
authored
Merge pull request #30 from stefanbuck/fix-29-scheduled-jobs
Do not break Action when using schedule jobs
2 parents facb42d + 580fc69 commit 4efcea6

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

create-pull-request.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ def get_github_event(github_event_path):
1515

1616

1717
def ignore_event(github_event):
18+
if 'schedule' in github_event:
19+
print("Allow schedule event.")
20+
return False
21+
1822
# Ignore push events on deleted branches
1923
# The event we want to ignore occurs when a PR is created but the repository owner decides
2024
# not to commit the changes. They close the PR and delete the branch. This creates a
@@ -39,8 +43,12 @@ def pr_branch_exists(repo, branch):
3943

4044

4145
def get_head_author(github_event):
42-
email = "{head_commit[author][email]}".format(**github_event)
43-
name = "{head_commit[author][name]}".format(**github_event)
46+
if 'schedule' in github_event:
47+
email=os.environ['GITHUB_ACTOR']
48+
name=os.environ['GITHUB_ACTOR'] + '@users.noreply.github.com'
49+
else
50+
email = "{head_commit[author][email]}".format(**github_event)
51+
name = "{head_commit[author][name]}".format(**github_event)
4452
return email, name
4553

4654

0 commit comments

Comments
 (0)