Feat/test10 #13
Workflow file for this run
This file contains hidden or 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: 작업 완료된 feature 브랜치의 S3 버킷 삭제 | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: | |
| - dev | |
| jobs: | |
| cd-feat: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Set up AWS CLI | |
| uses: aws-actions/configure-aws-credentials@v3 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: ap-northeast-2 | |
| - name: Get branch name for bucket deletion | |
| id: extract-bucket-name | |
| env: | |
| FEATURE_BRANCH: ${{ github.event.pull_request.head.ref }} | |
| run: | | |
| # feat/ 이후의 문자열만 추출 | |
| BUCKET_NAME=$(echo $FEATURE_BRANCH | sed 's|^feat/||') | |
| echo "Bucket name determined: $BUCKET_NAME" # For debugging | |
| echo "bucket=$BUCKET_NAME" >> $GITHUB_ENV | |
| - name: Delete S3 bucket | |
| env: | |
| S3_BUCKET: zipline-fe-${{ env.bucket }} | |
| run: | | |
| if [ "${{ github.event.action }}" = "closed" ] && [ "${{ github.event.pull_request.merged }}" = "true" ]; then | |
| echo "Deleting S3 bucket: $S3_BUCKET" | |
| aws s3 rb s3://$S3_BUCKET --force | |
| else | |
| echo "No action needed" | |
| fi |