name: Closed Frontend PR
on:
  pull_request:
    types: [closed]
    paths:
      - "client/**/*"
env:
  PR_NUMBER: ${{ github.event.number }}
jobs:
  remove-artifacts:
    runs-on: ubuntu-latest
    steps:
      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.CLIENT_DEV_AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.CLIENT_DEV_AWS_SECRET_ACCESS_KEY }}
          aws-region: us-east-1
      - name: Remove staging artifacts
        run: aws s3 rm s3://usds-geoplatform-justice40-website/justice40-tool/ --exclude "*" --include "$(echo $PR_NUMBER)-*" --recursive
