Skip to content

Clean up feature branches #36

Clean up feature branches

Clean up feature branches #36

name: Clean up feature branches
on:
delete:
jobs:
delete:
if: github.event.ref_type == 'branch' && startsWith(github.event.ref, 'feature/')
runs-on: ubuntu-latest
strategy:
matrix:
image-name: [tna-python, tna-python-root, tna-python-django, tna-python-django-root, tna-python-dev]
steps:
- name: Prepare image tag
run: |
IMAGE_ID=${{ matrix.image-name }}
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
echo "IMAGE_ID=$IMAGE_ID" >> "$GITHUB_ENV"
# Strip git ref prefix from version
VERSION=$(echo "${{ github.event.ref }}" | sed -e 's,.*/\(.*\),\1,')
echo "TAG=$VERSION" >> "$GITHUB_ENV"
- name: Output image tag
run: echo "Clean up Docker image ${{ env.IMAGE_ID }}:${{ env.TAG }}"
- name: Delete image
uses: bots-house/[email protected]
with:
owner: ${{ github.repository_owner }}
name: ${{ env.IMAGE_ID }}
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.TAG }}