-
Notifications
You must be signed in to change notification settings - Fork 1.8k
33 lines (30 loc) · 1.15 KB
/
cleanup-branch-builds.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
name: Cleanup on Branch Delete
on:
workflow_dispatch:
delete:
branches:
- '**DAT-**'
- 'github-action-**'
- 'dependabot-**'
- 'feat/**'
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@v5
if: ${{ steps.version.outputs.ids != '' }}
with:
package-type: maven
# 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 }}"