From afe13d6885e8691db8cb47373a001bfb3e57a8ed Mon Sep 17 00:00:00 2001 From: Katerina Skroumpelou Date: Thu, 26 Mar 2026 17:25:28 +0200 Subject: [PATCH] ci: include changelogs in js update pr --- .github/workflows/update-supabase-js.yml | 33 ++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.github/workflows/update-supabase-js.yml b/.github/workflows/update-supabase-js.yml index f2793bba..1b75571b 100644 --- a/.github/workflows/update-supabase-js.yml +++ b/.github/workflows/update-supabase-js.yml @@ -47,6 +47,33 @@ jobs: npm pkg set "dependencies.@supabase/supabase-js=${{ inputs.version }}" pnpm install --lockfile-only --ignore-scripts + - name: Fetch release notes + env: + VERSION: ${{ inputs.version }} + GH_TOKEN: ${{ github.token }} + run: | + CURRENT_FULL=$(git show HEAD:website/package.json | jq -r '.dependencies["@supabase/supabase-js"] // ""' | grep -oP '[\d]+\.[\d]+\.[\d]+(-[\w.]+)?') + CURRENT_BASE=$(echo "$CURRENT_FULL" | grep -oP '[\d]+\.[\d]+\.[\d]+') + [[ "$CURRENT_FULL" == *"-"* ]] && INCLUDE_CURRENT=true || INCLUDE_CURRENT=false + [[ "$VERSION" == *"-"* ]] && STABLE_ONLY=false || STABLE_ONLY=true + RELEASES=$(gh api "repos/supabase/supabase-js/releases?per_page=100") + RELEASE_NOTES=$(echo "$RELEASES" | jq -r \ + --arg current "v${CURRENT_BASE}" \ + --arg new "v${VERSION}" \ + --argjson stable_only "$STABLE_ONLY" \ + --argjson include_current "$INCLUDE_CURRENT" \ + '[.[] | select(.draft == false) | select(if $stable_only then .prerelease == false else true end)] | + (map(.tag_name) | index($new)) as $start | + (map(.tag_name) | index($current)) as $end | + ($end | if . != null and $include_current then . + 1 else . end) as $end_adj | + if $start == null then ["Target version not found in last 100 releases."] + elif $end_adj != null and $start >= $end_adj then ["Downgrade — no release notes available."] + else [.[$start:$end_adj][] | "## " + .tag_name + "\n\n" + (.body // "No release notes.")] + end | .[]') + echo "RELEASE_NOTES<> "$GITHUB_ENV" + echo "$RELEASE_NOTES" >> "$GITHUB_ENV" + echo "EOF" >> "$GITHUB_ENV" + - name: Generate token id: app-token uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0 @@ -65,6 +92,12 @@ jobs: **Source**: ${{ inputs.source }} + --- + + ## Release Notes + + ${{ env.RELEASE_NOTES }} + This PR was created automatically. branch: "gha/auto-update-supabase-js-v${{ inputs.version }}" base: ${{ github.event.repository.default_branch }}