Reduced input variables
This commit is contained in:
@@ -1,27 +1,41 @@
|
||||
name: Cleanup Preview
|
||||
description: Stop container and remove Pangolin resource
|
||||
description: Stop container and remove Pangolin resource for a deleted branch
|
||||
|
||||
inputs:
|
||||
app-name:
|
||||
required: true
|
||||
description: Application name (used for image/container naming)
|
||||
slug:
|
||||
branch:
|
||||
required: true
|
||||
description: Branch slug to clean up
|
||||
description: Branch name being cleaned up
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Derive cleanup parameters
|
||||
id: derive
|
||||
shell: bash
|
||||
env:
|
||||
BRANCH: ${{ inputs.branch }}
|
||||
run: |
|
||||
BRANCH="${BRANCH#refs/heads/}"
|
||||
SLUG=$(echo "$BRANCH" | tr '/_' '--' | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9-]//g' | cut -c1-40)
|
||||
REPO_SLUG="${GITHUB_REPOSITORY//\//-}"
|
||||
{
|
||||
echo "slug=$SLUG"
|
||||
echo "resource-name=${REPO_SLUG}-${SLUG}"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Remove Pangolin resource
|
||||
shell: bash
|
||||
run: |
|
||||
bash ${{ github.action_path }}/pangolin-delete.sh \
|
||||
--resource-name "${{ inputs.app-name }}-${{ inputs.slug }}"
|
||||
--resource-name "${{ steps.derive.outputs.resource-name }}"
|
||||
|
||||
- name: Stop preview container
|
||||
shell: bash
|
||||
run: |
|
||||
CONTAINER="${{ inputs.app-name }}-${{ inputs.slug }}"
|
||||
CONTAINER="${{ inputs.app-name }}-${{ steps.derive.outputs.slug }}"
|
||||
docker stop "$CONTAINER" 2>/dev/null || true
|
||||
docker rm "$CONTAINER" 2>/dev/null || true
|
||||
docker rmi "${{ inputs.app-name }}:${{ inputs.slug }}" 2>/dev/null || true
|
||||
docker rmi "${{ inputs.app-name }}:${{ steps.derive.outputs.slug }}" 2>/dev/null || true
|
||||
|
||||
Reference in New Issue
Block a user