#!/usr/bin/env bash
set -euo pipefail

tag="" ref="" ref_type="" sha="" repo="" repo_full="" owner="" actor="" event="" server_url="" run_id=""

while [[ $# -gt 0 ]]; do
  case "$1" in
    --tag) tag="$2"; shift 2 ;;
    --ref) ref="$2"; shift 2 ;;
    --ref-type) ref_type="$2"; shift 2 ;;
    --sha) sha="$2"; shift 2 ;;
    --repo) repo="$2"; shift 2 ;;
    --repo-full) repo_full="$2"; shift 2 ;;
    --owner) owner="$2"; shift 2 ;;
    --actor) actor="$2"; shift 2 ;;
    --event) event="$2"; shift 2 ;;
    --server-url) server_url="$2"; shift 2 ;;
    --run-id) run_id="$2"; shift 2 ;;
    *)
      echo "Unknown flag: $1" >&2
      exit 1
      ;;
  esac
done

echo "tag=${tag}"
echo "ref=${ref}"
echo "ref-type=${ref_type}"
echo "sha=${sha}"
echo "repo=${repo}"
echo "repo-full=${repo_full}"
echo "owner=${owner}"
echo "actor=${actor}"
echo "event=${event}"
echo "server-url=${server_url}"
echo "run-id=${run_id}"

# TODO: implement release-direct workflow
