Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/update-supabase-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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<<EOF" >> "$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
Expand All @@ -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 }}
Loading