-
Notifications
You must be signed in to change notification settings - Fork 12
40 lines (34 loc) · 1.41 KB
/
test-admin-remove.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: Remove test admin deployment
on:
pull_request:
branches:
- main
types:
- closed
env:
AWS_DEFAULT_REGION: ca-central-1
FUNCTION_NAME: "notify-admin-pr"
GITHUB_SHA: ${{ github.sha }}
IMAGE: notify/admin
REGISTRY: 239043911459.dkr.ecr.ca-central-1.amazonaws.com
jobs:
remove-test-admin:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'Renovate') }}
runs-on: ubuntu-latest
steps:
- name: Set envs
run: echo "PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")" >> $GITHUB_ENV
- name: Configure AWS credentials
id: aws-creds
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2.2.0
with:
aws-access-key-id: ${{ secrets.STAGING_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.STAGING_AWS_SECRET_ACCESS_KEY }}
aws-region: ca-central-1
- name: Delete lambda function resources
run: |
aws lambda wait function-active --function-name $FUNCTION_NAME-$PR_NUMBER
aws lambda delete-function-url-config --function-name $FUNCTION_NAME-$PR_NUMBER
aws lambda delete-function --function-name $FUNCTION_NAME-$PR_NUMBER
aws logs delete-log-group --log-group-name /aws/lambda/$FUNCTION_NAME-$PR_NUMBER
aws ecr batch-delete-image --repository-name $IMAGE --image-ids imageTag=$PR_NUMBER