This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Delete S3 Files on PR Merged | |
on: | |
pull_request: | |
types: | |
- closed | |
jobs: | |
delete-s3-files: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up AWS CLI | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Remove files from S3 | |
run: | | |
PR_NUMBER=${{ github.event.pull_request.number }} | |
aws s3 rm s3://${{ secrets.AWS_S3_BUCKET }}/pr/${PR_NUMBER}/ --recursive |