name: "OSDC: Plan (prod)"

on:
  pull_request:
    paths:
      - "osdc/**"
      - ".github/workflows/osdc-plan-prod.yml"
      - ".github/workflows/_osdc-plan.yml"
      - ".github/workflows/_osdc-deploy.yml"

concurrency:
  group: osdc-plan-prod-${{ github.ref }}
  cancel-in-progress: true

permissions:
  id-token: write
  contents: read
  pull-requests: write

jobs:
  plan_ue2:
    if: github.event.pull_request.head.repo.full_name == github.repository
    uses: ./.github/workflows/_osdc-plan.yml
    with:
      cluster: meta-prod-aws-ue2
      pr_number: ${{ github.event.pull_request.number }}
    secrets: inherit

  plan_uw1:
    needs: plan_ue2
    if: |
      !cancelled() &&
      github.event.pull_request.head.repo.full_name == github.repository
    uses: ./.github/workflows/_osdc-plan.yml
    with:
      cluster: meta-prod-aws-uw1
      pr_number: ${{ github.event.pull_request.number }}
    secrets: inherit

  plan_ue1:
    needs: plan_uw1
    if: |
      !cancelled() &&
      github.event.pull_request.head.repo.full_name == github.repository
    uses: ./.github/workflows/_osdc-plan.yml
    with:
      cluster: meta-prod-aws-ue1
      pr_number: ${{ github.event.pull_request.number }}
    secrets: inherit

  plan_lf_ue1:
    needs: plan_ue1
    if: |
      !cancelled() &&
      github.event.pull_request.head.repo.full_name == github.repository
    uses: ./.github/workflows/_osdc-plan.yml
    with:
      cluster: lf-prod-aws-ue1
      use_lf_credentials: true
      pr_number: ${{ github.event.pull_request.number }}
    secrets: inherit

  plan_lf_ue2:
    needs: plan_lf_ue1
    if: |
      !cancelled() &&
      github.event.pull_request.head.repo.full_name == github.repository
    uses: ./.github/workflows/_osdc-plan.yml
    with:
      cluster: lf-prod-aws-ue2
      use_lf_credentials: true
      pr_number: ${{ github.event.pull_request.number }}
    secrets: inherit
