emergency-pull-request-prob.../template.yml

119 строки
3.3 KiB
YAML

AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: Serverless GitHub app
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 base64 encoded private key of your GitHub app
Type: String
emergencyLabel:
Description: The label to use for emergency issues
Type: String
issueTitle:
Description: The title of the issue
Default: Emergency PR Audit
Type: String
issueBodyFile:
Description: The file containing the body of the issue
Default: issueBody.md
Type: String
issueAssignees:
Description: The assignees of the issue in a comma separated list
Type: String
approvePr:
Description: Enable the app to approve PRs
Default: true
AllowedValues:
- true
- false
Type: String
createIssue:
Description: Enable the app to create issues
Default: true
AllowedValues:
- true
- false
Type: String
mergePr:
Description: Enable the app to merge PRs
Default: true
AllowedValues:
- true
- false
Type: String
slackNotify:
Description: Enable the app to notify Slack
Default: true
AllowedValues:
- true
- false
Type: String
slackBotToken:
Description: The bot token for Slack
Type: String
slackChannelId:
Description: The channel ID for Slack
Type: String
slackMessageFile:
Description: The file containing the message for Slack
Default: slackMessage.txt
Type: String
emergencyLabelPermanent:
Description: Enable the app prevent removal of the emergency label on a PR or Issue
Default: true
AllowedValues:
- true
- false
Type: String
triggerString:
Description: The string value in a PR or Issue title that triggers appling the emegency label
Default: emergency landing
Type: String
authorizedTeam:
Description: The team who's members are authorized to use this app
Type: String
Resources:
webhooks:
Type: AWS::Serverless::Function
Properties:
FunctionName: !Sub ${AWS::StackName}-webhooks
Description: Basic Auth Funtion
CodeUri: .
Handler: handler.webhooks
Runtime: nodejs16.x
MemorySize: 256
Timeout: 20
Events:
ApiEvent:
Type: HttpApi
Environment:
Variables:
APP_ID: !Ref githubAppId
WEBHOOK_SECRET: !Ref githubWebhookSecret
PRIVATE_KEY: !Ref githubPrivateKey
EMERGENCY_LABEL: !Ref emergencyLabel
ISSUE_TITLE: !Ref issueTitle
ISSUE_BODY_FILE: !Ref issueBodyFile
ISSUE_ASSIGNEES: !Ref issueAssignees
APPROVE_PR: !Ref approvePr
CREATE_ISSUE: !Ref createIssue
MERGE_PR: !Ref mergePr
SLACK_NOTIFY: !Ref slackNotify
SLACK_BOT_TOKEN: !Ref slackBotToken
SLACK_CHANNEL_ID: !Ref slackChannelId
SLACK_MESSAGE_FILE: !Ref slackMessageFile
EMERGENCY_LABEL_PERMANENT: !Ref emergencyLabelPermanent
TRIGGER_STRING: !Ref triggerString
AUTHORIZED_TEAM: !Ref authorizedTeam
Outputs:
WebhooksUrl:
Description: "Endpoint URL"
Value: !Sub "https://${ServerlessHttpApi}.execute-api.${AWS::Region}.amazonaws.com/"