name: Verify Helm Chart
on:
  workflow_dispatch:
  push:
    branches:
      - main
    paths:
       - 'helm/**'

env:
  CSP_API_URL: https://console.tanzu.broadcom.com
  CSP_API_TOKEN: ${{ secrets.CSP_API_TOKEN }}
  VIB_PUBLIC_URL: https://cp.app-catalog.vmware.com

jobs:
  # verify chart in multiple target platforms
  vib-k8s-verify:
    runs-on: ubuntu-latest
    environment: vmware-image-builder
    strategy:
      matrix:
       include:
         - name: Openshift
           target-platform: openshift
           target-platform-id: ebac9e0d-3931-4515-ba54-e6adada1f174
           target-pipeline: vib-platform-verify-openshift.json
      fail-fast: false
    name: Verify chart (${{ matrix.name }})
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          ref: ${{ github.event.pull_request.head.ref }}
          repository: ${{ github.event.pull_request.head.repo.full_name }}
      - uses: vmware-labs/vmware-image-builder-action@90ab5b51680627fe01ea9b2d9ba5d7c9db4c56bc # v0.11.0
        with:
          pipeline: ${{ matrix.target-pipeline }}
          max-pipeline-duration: 7200
        env:
          TARGET_PLATFORM: ${{ matrix.target-platform-id }}
