chore: Add package auto deletion
Some checks failed
Build Docker Image / build_docker (push) Failing after 1m52s
Build, check & Test / run (push) Successful in 2m58s

This commit is contained in:
Florian Bouillon 2024-01-18 13:39:35 +00:00
parent 45a6d0bab8
commit 22a20d67d0

44
.github/workflows/delete_packages.yml vendored Normal file
View File

@ -0,0 +1,44 @@
name: Delete Packages
on:
# Run when a PR is closed/merged
pull_request:
types:
- closed
# Run when a branch is deleted
delete:
# Config
env:
TOKEN: ${{ secrets.GIT_TOKEN }}
GROUP: avior
TYPE: container
PACKAGE: ifremer-loop
jobs:
pull_request:
name: Delete the package on a closed Pull Request
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' && github.event.action == 'close' }}
steps:
- name: Delete package
run: |
curl --fail -X 'DELETE' "https://git.dzeio.com/api/v1/packages/${GROUP}/${TYPE}/${PACKAGE}/${VERSION}" -H 'accept: application/json' -H "Authorization: token ${TOKEN}"
env:
VERSION: pr-${{ github.event.number }}-head
branch:
runs-on: ubuntu-latest
name: Delete the package on a deleted branch
if: ${{ github.event_name == 'delete' }}
steps:
- name: Delete package
run: |
curl --fail -X 'DELETE' "https://git.dzeio.com/api/v1/packages/${GROUP}/${TYPE}/${PACKAGE}/${VERSION}" -H 'accept: application/json' -H "Authorization: token ${TOKEN}"
env:
TOKEN: ${{ secrets.GIT_TOKEN }}
GROUP: avior
TYPE: container
PACKAGE: ifremer-loop
VERSION: branch-${{ github.event.ref }}