Moved scripts

This commit is contained in:
2026-04-12 02:35:05 -05:00
parent c9e77915b0
commit f4653456f3
5 changed files with 3 additions and 3 deletions

View File

@@ -15,7 +15,7 @@ runs:
- name: Remove Pangolin resource
shell: bash
run: |
bash ${{ github.action_path }}/../scripts/pangolin-delete.sh \
bash ${{ github.action_path }}/pangolin-delete.sh \
--resource-name "${{ inputs.app-name }}-${{ inputs.slug }}"
- name: Stop preview container

View File

@@ -0,0 +1,38 @@
#!/usr/bin/env bash
# Remove a Pangolin resource by name
set -euo pipefail
RESOURCE_NAME=""
while [[ $# -gt 0 ]]; do
case $1 in
--resource-name) RESOURCE_NAME="$2"; shift 2 ;;
*) echo "Unknown arg: $1"; exit 1 ;;
esac
done
API="${PANGOLIN_API_URL}/v1"
AUTH="Authorization: Bearer ${PANGOLIN_API_KEY}"
echo "→ Pangolin delete: ${RESOURCE_NAME}"
RESOURCE_ID=$(curl -sf \
-H "${AUTH}" \
"${API}/org/${PANGOLIN_ORG_ID}/resources?limit=1000" \
| jq -r --arg name "${RESOURCE_NAME}" \
'.data.resources[] | select(.name == $name) | .resourceId' \
|| echo "")
if [[ -z "${RESOURCE_ID}" ]]; then
echo " No resource found with name '${RESOURCE_NAME}', skipping."
exit 0
fi
echo " Found resource ${RESOURCE_ID}, deleting…"
curl -sf -X DELETE \
-H "${AUTH}" \
"${API}/resource/${RESOURCE_ID}" \
> /dev/null
echo "✓ Resource ${RESOURCE_ID} (${RESOURCE_NAME}) removed from Pangolin"