Cleanup on Branch Delete #12
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: Cleanup on Branch Delete | |
on: | |
workflow_dispatch: | |
delete: | |
branches: | |
- '**DAT-**' | |
jobs: | |
delete-package: | |
name: Delete Github Package for Branch | |
runs-on: ubuntu-22.04 | |
steps: | |
# Get version id(s) based on version name | |
- uses: castlabs/get-package-version-id-action@v2.2 | |
id: version | |
with: | |
version: "${{ github.event.ref }}-SNAPSHOT" | |
- uses: actions/delete-package-versions@v3 | |
if: ${{ steps.version.outputs.ids != '' }} | |
with: | |
# The number of latest versions to keep. | |
# This cannot be specified with `num-old-versions-to-delete`. By default, `num-old-versions-to-delete` takes precedence over `min-versions-to-keep`. | |
# When set to 0, all deletable versions will be deleted. | |
# When set greater than 0, all deletable package versions except the specified number will be deleted. | |
min-versions-to-keep: 0 | |
# on branch id's deletion we only want to delete that particular branch version | |
package-version-ids: "${{ steps.version.outputs.ids }}" |