# This code is autogenerated.
# Code is generated by running custom script: python3 readme.py
# Any manual changes to this file may cause incorrect behavior.
# Any manual changes will be overwritten if the code is regenerated.

name: cli-jobs-pipelines-with-components-pipeline_job_with_flow_as_component-pipeline
on:
  workflow_dispatch:
  schedule:
    - cron: "4 6/12 * * *"
  pull_request:
    branches:
      - main
    paths:
      - cli/jobs/pipelines-with-components/pipeline_job_with_flow_as_component/**
      - infra/bootstrapping/**
      - .github/workflows/cli-jobs-pipelines-with-components-pipeline_job_with_flow_as_component-pipeline.yml
      - cli/run-pipeline-jobs.sh
      - cli/setup.sh
permissions:
  id-token: write
concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: check out repo
      uses: actions/checkout@v2
    - name: azure login
      uses: azure/login@v1
      with:
        client-id: ${{ secrets.OIDC_AZURE_CLIENT_ID }}
        tenant-id: ${{ secrets.OIDC_AZURE_TENANT_ID }}
        subscription-id: ${{ secrets.OIDC_AZURE_SUBSCRIPTION_ID }}
    - name: bootstrap resources
      run: |
          echo '${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}';
          bash bootstrap.sh
      working-directory: infra/bootstrapping
      continue-on-error: false
    - name: setup-cli
      run: |
          source "${{ github.workspace }}/infra/bootstrapping/sdk_helpers.sh";
          source "${{ github.workspace }}/infra/bootstrapping/init_environment.sh";
          bash setup.sh
      working-directory: cli
      continue-on-error: true
    - name: Eagerly cache access tokens for required scopes
      run: |
          # Workaround for azure-cli's lack of support for ID token refresh
          # Taken from: https://github.com/Azure/login/issues/372#issuecomment-2056289617

          # Management
          az account get-access-token --scope https://management.azure.com/.default --output none
          # ML
          az account get-access-token --scope https://ml.azure.com/.default --output none
    - name: run job
      run: |
          source "${{ github.workspace }}/infra/bootstrapping/sdk_helpers.sh";
          source "${{ github.workspace }}/infra/bootstrapping/init_environment.sh";
          bash -x ../../../run-job.sh pipeline.yml
      working-directory: cli/jobs/pipelines-with-components/pipeline_job_with_flow_as_component
    - name: validate readme
      run: |
          python check-readme.py "${{ github.workspace }}/cli/jobs/pipelines-with-components/pipeline_job_with_flow_as_component"
      working-directory: infra/bootstrapping
      continue-on-error: false