File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ import boto3
2
+
3
+ def lambda_handler (event , context ):
4
+ sc = 200
5
+ body = "Successfully Triggered a Lambda Function"
6
+
7
+ #If we want to do the whole organization, something like this:
8
+ #if event.repository.owner.login == "rearc":
9
+ if event .has_key ("repository" ) and event ["repository" ]["name" ] == "test-lambda-github" :
10
+ if event ["action" ] in ["opened" , "synchronize" ]:
11
+ pr = event ["pull_request" ]
12
+ branch = pr ["head" ]["ref" ]
13
+ print (branch )
14
+ #Figure out what needs to be done so codepipeline uses "branch" to build and trigger a test job?
15
+ # Looks like something like this should work:
16
+ #codepipeline_client = boto3.client('codepipeline')
17
+ #codepipeline_response = codepipeline_client.start_pipeline_execution(
18
+ # name="codepipeline-customization-sandbox-pipeline"
19
+ #)
20
+ else :
21
+ body = "Event is not a PR opening or updating"
22
+ else :
23
+ sc = 400
24
+ body = "Request didn't contain a repository key"
25
+
26
+ return {
27
+ 'statusCode' : sc ,
28
+ 'body' : body
29
+ }
30
+
31
+
File renamed without changes.
You can’t perform that action at this time.
0 commit comments