Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Created May 3, 2023 01:33
Show Gist options
  • Select an option

  • Save KyMidd/f2a619d40cf1e4b6421b416d5dda81d5 to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/f2a619d40cf1e4b6421b416d5dda81d5 to your computer and use it in GitHub Desktop.
# Get the event action
def check_event_action(event):
# Check action of event
action = event['action']
# If action isn't "created", exit
if action != 'created':
print("🚫 Event action detected as: " + action)
print("🚫 Event is not creating a repo, exiting")
# Return 200 code
return {
'statusCode': 200,
'body': json.dumps("Since action is ", action, ", and not 'created', we are exiting")
}
# Exit script
sys.exit()
else:
print("πŸš€ Successfully detected action: " + action)
# Get repo name
repo_name = event['repository']['name']
print("πŸš€ Successfully detected repo: " + repo_name)
return repo_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment