Skip to content

Commit

Permalink
Merge pull request github#436 from github/sam-template
Browse files Browse the repository at this point in the history
AWS sam template
  • Loading branch information
robandpdx authored Apr 11, 2023
2 parents 6745c6a + 8dbeabc commit 4b24615
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,7 @@ private-key.pem
*.pem
.vscode
yarn.lock

# aws sam stuff
.aws-sam
samconfig.toml
55 changes: 55 additions & 0 deletions template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: Safe Settings Serverless GitHub app

Globals:
Function:
Tags:
owner: !Ref owner

Parameters:
githubAppId:
Description: The App ID of your GitHub app
Type: String
githubWebhookSecret:
Description: The webhook secret of your GitHub app
Type: String
githubPrivateKey:
Description: The private key of your GitHub app in base64 format
Type: String
environment:
Description: Environment deployment of your GitHub App
Type: String
logLevel:
Description: Log level for your GitHub App
Type: String
owner:
Description: Owner of the GitHub App
Type: String

Resources:
webhooks:
Type: AWS::Serverless::Function
Properties:
FunctionName: !Sub ${AWS::StackName}-webhooks
Description: Safe Settings GitHub App
CodeUri: .
Handler: handler.webhooks
Runtime: nodejs16.x
MemorySize: 256
Timeout: 900
Events:
ApiEvent:
Type: HttpApi
Environment:
Variables:
APP_ID: !Ref githubAppId
WEBHOOK_SECRET: !Ref githubWebhookSecret
PRIVATE_KEY: !Ref githubPrivateKey
NODE_ENV: !Ref environment
LOG_LEVEL: !Ref logLevel

Outputs:
WebhooksUrl:
Description: "Endpoint URL"
Value: !Sub "https://${ServerlessHttpApi}.execute-api.${AWS::Region}.amazonaws.com/"

0 comments on commit 4b24615

Please sign in to comment.