Delete feature branch from S3 #1404
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 feature branch from S3 | |
on: delete | |
jobs: | |
cleanup: | |
runs-on: ubuntu-latest | |
if: github.event.ref_type == 'branch' && startsWith(github.event.ref, 'feature-') == true | |
steps: | |
- name: Inject slug/short variables | |
uses: rlespinasse/[email protected] | |
- name: Remove from S3 | |
uses: vitorsgomes/s3-rm-action@master | |
with: | |
args: --recursive | |
env: | |
AWS_S3_BUCKET: uk-sdg-feature-branches | |
# Remember to add AWS_ACCESS as a "repository secret". | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS }} | |
# Remember to add AWS_SECRET as a "repository secret". | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET }} | |
PATH_TO_DELETE: ${{ env.GITHUB_EVENT_REF_SLUG }}-data | |
- name: Delete site branch | |
env: | |
# Enter your Github username (or the username of whomever owns | |
# the personal access token being used). | |
GITHUB_USERNAME: lucygwilliamadmin | |
# Enter your Github organization (maybe the same as your username). | |
GITHUB_ORG: onsdigital | |
# Enter the site repository name | |
GITHUB_SITE_REPO: sdg-indicators | |
# Remember to create a personal access token and set it as a | |
# repository secret called "token". | |
ACCESS_TOKEN: ${{ secrets.token }} | |
SITE_BRANCH: ${{ env.GITHUB_EVENT_REF_SLUG }} | |
run: | | |
git clone https://$GITHUB_USERNAME:[email protected]/$GITHUB_ORG/$GITHUB_SITE_REPO | |
cd $GITHUB_SITE_REPO | |
git config user.name "Feature branch server" | |
git config user.email "[email protected]" | |
git push origin --delete $SITE_BRANCH |