#!/bin/bash

# Convenience script to run the action locally
# https://stackoverflow.com/a/63722429/1040915
# (Which, incidentally, is why the `input` variables are named with underscores, not hyphens, even though the latter
# would be my natural preference
rm -rf working

if [[ -z "$TOKEN" ]]; then
  echo "TOKEN is not set"
  exit 1
fi

INPUT_SOURCE_REPO_DOMAIN="gitea.scubbo.org" \
    INPUT_SOURCE_REPO_OWNER="scubbo" \
    INPUT_SOURCE_REPO_NAME="commit-report-sync" \
    INPUT_TARGET_REPO_DOMAIN="github.com" \
    INPUT_TARGET_REPO_OWNER="scubbo" \
    INPUT_TARGET_REPO_NAME="gitea-commit-mirror" \
    INPUT_DRY_RUN="false" \
    INPUT_TOKEN_FOR_TARGET_REPO="$TOKEN" \
    npx ts-node src/index.ts