Skip to content

Commit

Permalink
feat: add workflow to remove preview files when pr closed
Browse files Browse the repository at this point in the history
  • Loading branch information
f-hollow committed Dec 9, 2024
1 parent 1e58f82 commit a223d8f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/pr-remove-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Remove Preview for PR

on:
pull_request:
types:
- closed
# pull_request:
# types: [opened, synchronize, reopened]

jobs:
remove-preview:
name: Remove preview for PR
runs-on: ubuntu-latest

steps:
# Remove the PR-specific folder from S3
- name: Remove PR-specific subdirectory from S3
run: |
echo "Cleaning up preview folder for PR #${{ github.event.pull_request.number }}"
aws s3 rm "s3://${{ secrets.PREVIEW_AWS_BUCKET_NAME }}/pr${{ github.event.pull_request.number }}" --recursive
env:
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

0 comments on commit a223d8f

Please sign in to comment.