From b4e6d0c94c094693b3f81618cd53d0d3afdcf85c Mon Sep 17 00:00:00 2001 From: Simon Planinschek Date: Mon, 20 Apr 2026 08:14:29 +0200 Subject: [PATCH 1/3] add Helm delete deployment action --- helm-delete/action.yml | 39 +++++++++++++++++++++++++++++++++++++++ readme.md | 22 ++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 helm-delete/action.yml diff --git a/helm-delete/action.yml b/helm-delete/action.yml new file mode 100644 index 0000000..e06a16b --- /dev/null +++ b/helm-delete/action.yml @@ -0,0 +1,39 @@ +name: "Helm Delete Deployment" +description: "Delete a Helm deployment from a Kubernetes cluster" + +inputs: + namespace: + description: "The namespace of the Helm release" + required: true + release-name: + description: "The name of the Helm release" + required: true + +runs: + using: "composite" + steps: + - name: Delete Helm deployment + env: + HELM_DRIVER: configmaps + run: | + RELEASE_NAME="${{ inputs.release-name }}" + NAMESPACE="${{ inputs.namespace }}" + + echo "Checking Helm release: $RELEASE_NAME in namespace: $NAMESPACE" + + STATUS_OUTPUT=$(helm status "$RELEASE_NAME" --namespace "$NAMESPACE" 2>&1) && STATUS_EXIT=0 || STATUS_EXIT=$? + + if [ $STATUS_EXIT -eq 0 ]; then + echo "Release found. Uninstalling..." + helm uninstall "$RELEASE_NAME" --namespace "$NAMESPACE" + else + if echo "$STATUS_OUTPUT" | grep -qi "forbidden\|cannot list\|unauthorized\|permission"; then + echo "::error::Permission denied when querying release '$RELEASE_NAME'. Check kubeconfig and RBAC permissions." + echo "$STATUS_OUTPUT" + exit 1 + else + echo "Release '$RELEASE_NAME' not found, skipping uninstall." + echo "$STATUS_OUTPUT" + fi + fi + shell: bash diff --git a/readme.md b/readme.md index f0a5c2a..b8a28e1 100644 --- a/readme.md +++ b/readme.md @@ -90,6 +90,28 @@ The following inputs can be used as `step.with` keys: | `timeout` | `5m` | The timeout for the Helm command | | `working-directory` | `.` | The working directory where the action commands will operate | +### Delete Helm Deployment + +Delete a Helm deployment from a Kubernetes cluster. Checks if the release exists before attempting uninstall and detects permission errors. Requires Kubernetes to be configured first. + +#### Example + +```yaml + - uses: aboutbits/github-actions-kubernetes/helm-delete@v4 + with: + release-name: my-app + namespace: my-namespace +``` + +#### Inputs + +The following inputs can be used as `step.with` keys: + +| Name | Required/Default | Description | +|----------------|------------------|--------------------------------| +| `release-name` | required | The name of the Helm release | +| `namespace` | required | The namespace of the Helm release | + ### Setup S3 Preview Creates an S3 preview prefix by copying from the main prefix. From 0010c911d883d48d4922061d2eeafea187cc8fcf Mon Sep 17 00:00:00 2001 From: Simon Planinschek Date: Mon, 20 Apr 2026 08:16:19 +0200 Subject: [PATCH 2/3] fix docs formatting --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index b8a28e1..aaf98d9 100644 --- a/readme.md +++ b/readme.md @@ -109,8 +109,8 @@ The following inputs can be used as `step.with` keys: | Name | Required/Default | Description | |----------------|------------------|--------------------------------| -| `release-name` | required | The name of the Helm release | | `namespace` | required | The namespace of the Helm release | +| `release-name` | required | The name of the Helm release | ### Setup S3 Preview From feae63ee234d512bf32d6d4288314ac775ac96f6 Mon Sep 17 00:00:00 2001 From: Simon Planinschek Date: Mon, 20 Apr 2026 08:57:08 +0200 Subject: [PATCH 3/3] rename Helm delete action to Helm undeploy --- {helm-delete => helm-undeploy}/action.yml | 4 ++-- readme.md | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) rename {helm-delete => helm-undeploy}/action.yml (92%) diff --git a/helm-delete/action.yml b/helm-undeploy/action.yml similarity index 92% rename from helm-delete/action.yml rename to helm-undeploy/action.yml index e06a16b..89af1be 100644 --- a/helm-delete/action.yml +++ b/helm-undeploy/action.yml @@ -1,5 +1,5 @@ -name: "Helm Delete Deployment" -description: "Delete a Helm deployment from a Kubernetes cluster" +name: "Helm Undeploy" +description: "Undeploy a Helm deployment from a Kubernetes cluster" inputs: namespace: diff --git a/readme.md b/readme.md index aaf98d9..dacc18e 100644 --- a/readme.md +++ b/readme.md @@ -90,14 +90,14 @@ The following inputs can be used as `step.with` keys: | `timeout` | `5m` | The timeout for the Helm command | | `working-directory` | `.` | The working directory where the action commands will operate | -### Delete Helm Deployment +### Helm Undeploy -Delete a Helm deployment from a Kubernetes cluster. Checks if the release exists before attempting uninstall and detects permission errors. Requires Kubernetes to be configured first. +Undeploy a Helm deployment from a Kubernetes cluster. Checks if the release exists before attempting uninstall and detects permission errors. Requires Kubernetes to be configured first. #### Example ```yaml - - uses: aboutbits/github-actions-kubernetes/helm-delete@v4 + - uses: aboutbits/github-actions-kubernetes/helm-undeploy@v4 with: release-name: my-app namespace: my-namespace