name: equivalence-tests-manual

on:
  workflow_dispatch:
    inputs:
      target-branch:
        type: string
        description: "Which branch should be updated?"
        required: true
      new-branch:
        type: string
        description: "Name of new branch to be created for the review."
        required: true
      equivalence-test-version:
        type: string
        description: 'Equivalence testing framework version to use (no v prefix, eg. 0.5.0).'
        default: "0.5.0"
        required: true

permissions:
  contents: write
  pull-requests: write

env:
  GH_TOKEN: ${{ github.token }}

jobs:
  run-equivalence-tests:
    name: "Run equivalence tests"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
        with:
          ref: ${{ inputs.target-branch }}

      - name: Determine Go version
        id: go
        uses: ./.github/actions/go-version

      - name: Install Go toolchain
        uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
        with:
          go-version: ${{ steps.go.outputs.version }}
          cache-dependency-path: go.sum

      - uses: ./.github/actions/equivalence-test
        with:
          target-equivalence-test-version: ${{ inputs.equivalence-test-version }}
          target-os: linux
          target-arch: amd64
          current-branch: ${{ inputs.target-branch }}
          new-branch: ${{ inputs.new-branch }}
          reviewers: ${{ github.actor }}
          message: "Update equivalence test golden files."
