-
-
Notifications
You must be signed in to change notification settings - Fork 96
37 lines (31 loc) · 1.17 KB
/
website-destroy-preview.yml
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
name: "Website Destroy Preview"
on:
workflow_dispatch:
pull_request:
types:
- closed
env:
AWS_REGION: us-east-2
IAM_ROLE_ARN: arn:aws:iam::068007702576:role/cplive-plat-ue2-dev-atmos-docs-gha
IAM_ROLE_SESSION_NAME: cloudposse-atmos-ci-destroy-pr-${{ github.event.pull_request.number }}
S3_BUCKET_NAME: cplive-plat-ue2-dev-atmos-docs-origin
PR_NUMBER: ${{ github.event.pull_request.number }}
# These permissions are needed to interact with the GitHub's OIDC Token endpoint
permissions:
id-token: write
contents: read
jobs:
website-destroy-preview:
runs-on: ubuntu-latest
steps:
# https://github.com/marketplace/actions/configure-aws-credentials-action-for-github-actions
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v3
with:
aws-region: ${{ env.AWS_REGION }}
role-to-assume: ${{ env.IAM_ROLE_ARN }}
role-session-name: ${{ env.IAM_ROLE_SESSION_NAME }}
- name: Delete S3 Bucket PR Folder
run: |
aws sts get-caller-identity
aws s3 rm s3://${{ env.S3_BUCKET_NAME }}/ --recursive --exclude "*" --include "pr-${{ env.PR_NUMBER }}/*"