Clean up feature branch #6
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: Clean up feature branch | |
on: | |
delete: | |
jobs: | |
delete: | |
if: github.event.ref_type == 'branch' && startsWith(github.event.ref, 'feature/') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get tag from deleted branch | |
id: version-tag | |
run: echo "VERSION=$(echo "${{ github.event.ref }}" | sed -e 's,/,-,g')" >> "$GITHUB_OUTPUT" | |
- name: Debug | |
run: echo "Clean up Docker image ${{ vars.DOCKER_IMAGE_NAME }}:${{ steps.version-tag.outputs.VERSION }}" | |
- name: Delete image | |
if: ${{ steps.version-tag.outputs.VERSION }} | |
uses: bots-house/ghcr-delete-image-action@v1.1.0 | |
with: | |
owner: ${{ github.repository_owner }} | |
name: ${{ vars.DOCKER_IMAGE_NAME }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ steps.version-tag.outputs.VERSION }} |