#!/usr/bin/env bash

# this is only valid for releases created on github, prefer using git data directly

gh api repos/globaldigitalagency/autoadmin-library/releases --paginate \
  \
  | jq '[.[] | {version: .tag_name, body: (.body // ""), changes: (.body // "")}]' \
  | jq 'map(.changes |= split("\r\n"))' \
  | jq 'map(.changes |= map(select(test("^\\* [^@][^\r\n]+$"))))' \
  | jq 'map(.changes |= map(.[2:]))' \
  | jq 'map(del(.body))' \
  > releases_output.json

