name: "Spiced Matrix Generation"
description: "Generate a spliced matrix given an input YAML file"
inputs:
  yaml:
    description: path to the config YAML
    required: true
  container:
    description: A optional container base to include in the matrix
    required: false
  branch:
    description: The branch of spack to use (defaults to develop)
    required: true
    default: main
  do_install:
    description: Should spliced be installed first?
    required: false
    default: true  
  release:
    description: A spack release to use (if defined, overrides branch)
    required: false
    default: ""

outputs:
  matrix:
    description: matrix of spliced builds
    value: ${{ steps.matrix.outputs.matrix }}

runs:
  using: "composite"
  steps:

    - name: Set Root Directory
      env:
        ACTION_PATH: ${{ github.action_path }}
      run: ${{ github.action_path }}/scripts/set_root.sh
      shell: bash

    - name: Install Spliced
      env:
        INPUT_BRANCH: ${{ inputs.branch }}
        INPUT_RELEASE: ${{ inputs.release }}
        INPUT_DOINSTALL: ${{ inputs.do_install }}
      run: ${{ env.ACTION_ROOT }}/install/scripts/install.sh
      shell: bash

    - name: Generate matrix
      id: matrix
      env:
        INPUT_YAML: ${{ inputs.yaml }}
        INPUT_CONTAINER: ${{ inputs.container }}
      run: ${{ github.action_path }}/scripts/generate.sh
      shell: bash
