This repository has been archived by the owner on Nov 29, 2023. It is now read-only.
PDX-812 #195
Workflow file for this run
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
# Deletes the staging docsite folder in the staging bucket on a closed PR | |
name: PR Closed Delete Staging Site | |
on: | |
pull_request: | |
types: [closed] | |
branches: | |
- "main" | |
paths: | |
- "site/**" | |
jobs: | |
delete_bucket_folder: | |
name: Delete Bucket Folder | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set Environment Variables | |
run: | | |
BRANCH_NAME=${GITHUB_HEAD_REF#refs/heads/} | |
BRANCH_NAME=$(echo "$BRANCH_NAME" | tr '[:upper:]' '[:lower:]') | |
BRANCH_NAME=$(echo "$BRANCH_NAME" | sed -e "s/[^a-z0-9]/-/g") | |
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Cleanup S3 Bucket | |
run: aws s3 rm s3://staging-dev-docsite/ --recursive --exclude "*" --include "${{ env.BRANCH_NAME }}/*" | |
notify_for_failures: | |
name: Notify for Failures | |
needs: [delete_bucket_folder] | |
if: failure() | |
runs-on: ubuntu-latest | |
steps: | |
- name: Notify Slack of Failures | |
uses: Bandwidth/[email protected] | |
with: | |
job-status: failure | |
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} | |
slack-channel: ${{ secrets.SLACK_CHANNEL }} |