Add token param
This commit is contained in:
		
							
								
								
									
										2
									
								
								.github/workflows/ship.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/ship.yml
									
									
									
									
										vendored
									
									
								
							@ -4,7 +4,7 @@ name: Build & Ship
 | 
				
			|||||||
on:
 | 
					on:
 | 
				
			||||||
  push:
 | 
					  push:
 | 
				
			||||||
    branches:
 | 
					    branches:
 | 
				
			||||||
    - master
 | 
					    - main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
jobs:
 | 
					jobs:
 | 
				
			||||||
  deploy:
 | 
					  deploy:
 | 
				
			||||||
 | 
				
			|||||||
@ -4,10 +4,20 @@ from github import Github
 | 
				
			|||||||
logger = logging.getLogger()
 | 
					logger = logging.getLogger()
 | 
				
			||||||
logger.setLevel(logging.INFO)
 | 
					logger.setLevel(logging.INFO)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
github = Github("")
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def lambda_handler(event, context):
 | 
					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"))
 | 
					    repo = github.get_repo(os.environ.get("REPOSITORY"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if not "Records" in event:
 | 
					    if not "Records" in event:
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										5
									
								
								top.yaml
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								top.yaml
									
									
									
									
									
								
							@ -7,6 +7,8 @@ Parameters:
 | 
				
			|||||||
    Type: String
 | 
					    Type: String
 | 
				
			||||||
  GenerateOwnerName:
 | 
					  GenerateOwnerName:
 | 
				
			||||||
    Type: String
 | 
					    Type: String
 | 
				
			||||||
 | 
					  GitHubTokenSecret:
 | 
				
			||||||
 | 
					    Type: String
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Resources:
 | 
					Resources:
 | 
				
			||||||
  SnsTopic:
 | 
					  SnsTopic:
 | 
				
			||||||
@ -31,6 +33,7 @@ Resources:
 | 
				
			|||||||
        Variables:
 | 
					        Variables:
 | 
				
			||||||
          GENERATED_OWNER: !Ref GenerateOwnerName
 | 
					          GENERATED_OWNER: !Ref GenerateOwnerName
 | 
				
			||||||
          REPOSITORY: !Ref GithubRepository
 | 
					          REPOSITORY: !Ref GithubRepository
 | 
				
			||||||
 | 
					          GITHUB_TOKEN_SECRET: !Ref GitHubTokenSecret
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  SnsLambdaPermission:
 | 
					  SnsLambdaPermission:
 | 
				
			||||||
    Type: AWS::Lambda::Permission
 | 
					    Type: AWS::Lambda::Permission
 | 
				
			||||||
@ -38,4 +41,4 @@ Resources:
 | 
				
			|||||||
      Action: lambda:InvokeFunction
 | 
					      Action: lambda:InvokeFunction
 | 
				
			||||||
      Principal: sns.amazonaws.com
 | 
					      Principal: sns.amazonaws.com
 | 
				
			||||||
      SourceArn: !Ref SnsTopic
 | 
					      SourceArn: !Ref SnsTopic
 | 
				
			||||||
      FunctionName: !GetAtt AlertHandler.Arn
 | 
					      FunctionName: !GetAtt CreateIssueLambda.Arn
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user