name: Create GitHub Release
description: 'Create the release on GitHub with a changelog'
inputs:
  milestone:
    description: 'Name of the GitHub milestone for which a release will be created'
    required: true
  pre-release:
    description: 'Whether the release is a pre-release (a milestone or release candidate)'
    required: false
    default: 'false'
  token:
    description: 'Token to use for authentication with GitHub'
    required: true
runs:
  using: composite
  steps:
    - name: Generate Changelog
      uses: spring-io/github-changelog-generator@86958813a62af8fb223b3fd3b5152035504bcb83 #v0.0.12
      with:
        config-file: .github/actions/create-github-release/changelog-generator.yml
        milestone: ${{ inputs.milestone }}
        token: ${{ inputs.token }}
    - name: Create GitHub Release
      shell: bash
      env:
        GITHUB_TOKEN: ${{ inputs.token }}
      run: gh release create ${{ format('v{0}', inputs.milestone) }} --notes-file changelog.md ${{ inputs.pre-release == 'true' && '--prerelease' || '' }}
