From d83c841455729ad4956082b6f4bd1e1e224378ed Mon Sep 17 00:00:00 2001 From: Johann Hoffmann Date: Fri, 17 Jun 2022 13:06:04 +0200 Subject: [PATCH] [WIFI-9534] Add condition to avoid deleting default and release branch images Signed-off-by: Johann Hoffmann --- .github/workflows/cleanup.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml index 1ba4c75..4afc0df 100644 --- a/.github/workflows/cleanup.yml +++ b/.github/workflows/cleanup.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - main + - 'release/*' types: [ closed ] defaults: @@ -16,4 +17,10 @@ jobs: steps: - run: | export PR_BRANCH_TAG=$(echo ${GITHUB_HEAD_REF#refs/heads/} | tr '/' '-') - curl -uucentral:${{ secrets.DOCKER_REGISTRY_PASSWORD }} -X DELETE "https://tip.jfrog.io/artifactory/tip-wlan-cloud-ucentral/owanalytics/$PR_BRANCH_TAG" + + if [[ ! $PR_BRANCH_TAG =~ (main|master|release-*) ]]; then + echo "PR branch is $PR_BRANCH_TAG, deleting Docker image" + curl -s -uucentral:${{ secrets.DOCKER_REGISTRY_PASSWORD }} -X DELETE "https://tip.jfrog.io/artifactory/tip-wlan-cloud-ucentral/owanalytics/$PR_BRANCH_TAG" + else + echo "PR branch is $PR_BRANCH_TAG, not deleting Docker image" + fi