Add token param

This commit is contained in:
Layla 2020-11-16 19:19:29 -05:00
parent 206284e599
commit 8d2ee0f91e
No known key found for this signature in database
GPG Key ID: A494D9357BA1BE31
3 changed files with 16 additions and 3 deletions

View File

@ -4,7 +4,7 @@ name: Build & Ship
on:
push:
branches:
- master
- main
jobs:
deploy:

View File

@ -4,10 +4,20 @@ from github import Github
logger = logging.getLogger()
logger.setLevel(logging.INFO)
github = Github("")
def lambda_handler(event, context):
# Secret Client
secretsmanager = boto3.client('secretsmanager')
# Get Secrets
token = secretsmanager.get_secret_value(SecretId=os.environ.get("GITHUB_TOKEN_SECRET")).get("SecretString")
# GitHub client
github = Github(token)
repo = github.get_repo(os.environ.get("REPOSITORY"))
if not "Records" in event:

View File

@ -7,6 +7,8 @@ Parameters:
Type: String
GenerateOwnerName:
Type: String
GitHubTokenSecret:
Type: String
Resources:
SnsTopic:
@ -31,6 +33,7 @@ Resources:
Variables:
GENERATED_OWNER: !Ref GenerateOwnerName
REPOSITORY: !Ref GithubRepository
GITHUB_TOKEN_SECRET: !Ref GitHubTokenSecret
SnsLambdaPermission:
Type: AWS::Lambda::Permission
@ -38,4 +41,4 @@ Resources:
Action: lambda:InvokeFunction
Principal: sns.amazonaws.com
SourceArn: !Ref SnsTopic
FunctionName: !GetAtt AlertHandler.Arn
FunctionName: !GetAtt CreateIssueLambda.Arn