name: 'Release branches'
description: 'Determine branches for release & backport'
inputs:
  major_version:
    description: 'The version as extracted from the package.json file'
    required: true
  latest_tag:
    description: 'The most recent tag published to the repository'
    required: true
outputs:
  backport_source_branch:
    description: "The release branch for the given tag"
    value: ${{ steps.branches.outputs.backport_source_branch }}
  backport_target_branches:
    description: "JSON encoded list of branches to target with backports"
    value: ${{ steps.branches.outputs.backport_target_branches }}
runs:
  using: "composite"
  steps:
    - id: branches
      env:
        MAJOR_VERSION: ${{ inputs.major_version }}
        LATEST_TAG: ${{ inputs.latest_tag }}
      run: |
        python ${{ github.action_path }}/release-branches.py \
            --major-version "$MAJOR_VERSION" \
            --latest-tag "$LATEST_TAG"
      shell: bash
