From fcc56736a6d08ba156dc74a76e0dce52d92cdbe4 Mon Sep 17 00:00:00 2001 From: Derek Ardolf Date: Tue, 24 Sep 2019 00:56:53 -0700 Subject: [PATCH] Add skip_ignore arg to ignore_event function During testing, I found it useful to have this function skipped so I added a simple check for SKIP_IGNORE env variable --- create-pull-request.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/create-pull-request.py b/create-pull-request.py index 8d13e4c..f74159e 100755 --- a/create-pull-request.py +++ b/create-pull-request.py @@ -15,8 +15,8 @@ def get_github_event(github_event_path): return github_event -def ignore_event(event_name, event_data): - if event_name == "push": +def ignore_event(event_name, event_data, skip_ignore): + if event_name == "push" and not skip_ignore: # Ignore push events on deleted branches # The event we want to ignore occurs when a PR is created but the repository owner decides # not to commit the changes. They close the PR and delete the branch. This creates a @@ -122,7 +122,8 @@ def process_event(event_name, event_data, repo, branch, base): event_name = os.environ['GITHUB_EVENT_NAME'] event_data = get_github_event(os.environ['GITHUB_EVENT_PATH']) # Check if this event should be ignored -if not ignore_event(event_name, event_data): +skip_ignore_event = bool(os.environ.get('SKIP_IGNORE')) +if not ignore_event(event_name, event_data, skip_ignore_event): # Set the repo to the working directory repo = Repo(os.getcwd())