Skip to content

Normalize display names with NFKC and dot-to-space replacement #3147

Normalize display names with NFKC and dot-to-space replacement

Normalize display names with NFKC and dot-to-space replacement #3147

Workflow file for this run

name: Deployment to AWS Lambda with Docker
on:
pull_request:
types: [closed]
branches: [main]
paths-ignore:
- "**.md"
- ".github/workflows/pytest.yml"
- ".gitignore"
- "CODEOWNERS"
- "LICENSE"
workflow_dispatch:
concurrency:
group: deploy-lambda
cancel-in-progress: true # Cancel older deployments, run only the latest
env:
AWS_REGION: us-west-1
jobs:
deploy_lambda:
name: Publish and Deploy
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true
steps:
- name: Checkout code
uses: actions/checkout@v4 # https://github.com/actions/checkout
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4 # https://github.com/aws-actions/configure-aws-credentials
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2 # https://github.com/aws-actions/amazon-ecr-login
- name: Set deployment environment variables
run: |
{
echo "ECR_REGISTRY=${{ steps.login-ecr.outputs.registry }}"
echo "IMAGE_TAG=${{ github.sha }}"
echo "SLACK_WEBHOOK_URL=${{ secrets.SLACK_WEBHOOK_URL_FOR_PRD }}"
} >> $GITHUB_ENV
- name: Build, tag, and push image to Amazon ECR
run: |
# --provenance=false prevents OCI manifest format, which Lambda doesn't support
docker build --provenance=false -f ./Dockerfile -t $ECR_REGISTRY/pr-agent-prod:$IMAGE_TAG .
docker push $ECR_REGISTRY/pr-agent-prod:$IMAGE_TAG
- name: Deploy infrastructure stack
run: |
aws cloudformation deploy \
--stack-name gitauto-vpc-nat-efs \
--template-file infrastructure/setup-vpc-nat-efs.yml \
--capabilities CAPABILITY_NAMED_IAM \
--no-fail-on-empty-changeset
- name: Deploy Lambda stack
run: |
aws cloudformation deploy \
--stack-name gitauto-lambda-with-vpc-efs \
--template-file infrastructure/deploy-lambda-with-vpc-efs.yml \
--parameter-overrides ECRImageUri=$ECR_REGISTRY/pr-agent-prod:$IMAGE_TAG \
--capabilities CAPABILITY_NAMED_IAM \
--no-fail-on-empty-changeset
- name: Deploy Scheduler stack
run: |
aws cloudformation deploy \
--stack-name gitauto-scheduler \
--template-file infrastructure/eventbridge-scheduler.yml \
--capabilities CAPABILITY_NAMED_IAM \
--no-fail-on-empty-changeset
- name: Deploy Monitoring stack
run: |
aws cloudformation deploy \
--stack-name MonitoringStack \
--template-file infrastructure/cloudwatch-alarms-sns.yml \
--capabilities CAPABILITY_NAMED_IAM \
--no-fail-on-empty-changeset
- name: Notify Slack of deployment status
if: always()
env:
SLACK_MESSAGE: ${{ job.status == 'success' && 'Deployment successful' || 'Deployment failed' }}
run: |
PR_INFO=""
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
PR_URL="${{ github.event.pull_request.html_url }}"
PR_TITLE="${{ github.event.pull_request.title }}"
PR_INFO=" for <${PR_URL}|${PR_TITLE}>"
fi
curl -X POST -H 'Content-type: application/json' --data "{\"msg\":\"${SLACK_MESSAGE}${PR_INFO}\"}" $SLACK_WEBHOOK_URL