-
-
Save KyMidd/f2a619d40cf1e4b6421b416d5dda81d5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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