name: "Infra: Feature Testing Public: Destroy env"
on:
  workflow_dispatch:
    inputs:
      ENV_NAME:
        description: 'Will be used to remove previously deployed separate environment.'
        required: true
        default: 'demo'

jobs:
  separate-env-remove:
    runs-on: ubuntu-latest
    steps:
      - name: clone
        run: |
          git clone https://infra-tech:${{ secrets.INFRA_USER_ACCESS_TOKEN }}@github.com/provectus/kafka-ui-infra.git --branch envs
      - name: separate environment remove
        run: |
          cd kafka-ui-infra/aws-infrastructure4eks/argocd/scripts
          bash separate_env_remove.sh ${{ github.event.inputs.ENV_NAME }}
          git config --global user.email "infra-tech@provectus.com"
          git config --global user.name "infra-tech"
          git add -A
          git commit -m "separate env removed: ${{ github.event.inputs.ENV_NAME }}" && git push || true
