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
This commit is contained in:
Derek Ardolf 2019-09-24 00:56:53 -07:00 committed by GitHub
parent 014d447f0c
commit fcc56736a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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())