This repository has been archived on 2023-04-11. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
github-issue-sns-topic/create_issue/lambda_function.py
2020-08-13 01:06:25 -04:00

19 lines
578 B
Python

import logging, boto3, os
from github import Github
logger = logging.getLogger()
logger.setLevel(logging.INFO)
github = Github("")
def lambda_handler(event, context):
repo = github.get_repo(os.environ.get("REPOSITORY"))
if not "Records" in event:
raise Exception("Missing key Records in event!")
for record in event["Records"]:
if "Sns" in record:
sns_event = record["Sns"]
repo.create_issue(sns_event["Subject"], body=sns_event["Message"] + "\nThis was generated by " + os.environ.get("GENERATED_OWNER", "AWS"))