Skip to content

Commit 076a31f

Browse files
authored
Merge pull request #408 from supabase/ci/include-release-notes-update-js
ci: include changelogs in js update pr
2 parents 2552f38 + afe13d6 commit 076a31f

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

.github/workflows/update-supabase-js.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,33 @@ jobs:
4747
npm pkg set "dependencies.@supabase/supabase-js=${{ inputs.version }}"
4848
pnpm install --lockfile-only --ignore-scripts
4949
50+
- name: Fetch release notes
51+
env:
52+
VERSION: ${{ inputs.version }}
53+
GH_TOKEN: ${{ github.token }}
54+
run: |
55+
CURRENT_FULL=$(git show HEAD:website/package.json | jq -r '.dependencies["@supabase/supabase-js"] // ""' | grep -oP '[\d]+\.[\d]+\.[\d]+(-[\w.]+)?')
56+
CURRENT_BASE=$(echo "$CURRENT_FULL" | grep -oP '[\d]+\.[\d]+\.[\d]+')
57+
[[ "$CURRENT_FULL" == *"-"* ]] && INCLUDE_CURRENT=true || INCLUDE_CURRENT=false
58+
[[ "$VERSION" == *"-"* ]] && STABLE_ONLY=false || STABLE_ONLY=true
59+
RELEASES=$(gh api "repos/supabase/supabase-js/releases?per_page=100")
60+
RELEASE_NOTES=$(echo "$RELEASES" | jq -r \
61+
--arg current "v${CURRENT_BASE}" \
62+
--arg new "v${VERSION}" \
63+
--argjson stable_only "$STABLE_ONLY" \
64+
--argjson include_current "$INCLUDE_CURRENT" \
65+
'[.[] | select(.draft == false) | select(if $stable_only then .prerelease == false else true end)] |
66+
(map(.tag_name) | index($new)) as $start |
67+
(map(.tag_name) | index($current)) as $end |
68+
($end | if . != null and $include_current then . + 1 else . end) as $end_adj |
69+
if $start == null then ["Target version not found in last 100 releases."]
70+
elif $end_adj != null and $start >= $end_adj then ["Downgrade — no release notes available."]
71+
else [.[$start:$end_adj][] | "## " + .tag_name + "\n\n" + (.body // "No release notes.")]
72+
end | .[]')
73+
echo "RELEASE_NOTES<<EOF" >> "$GITHUB_ENV"
74+
echo "$RELEASE_NOTES" >> "$GITHUB_ENV"
75+
echo "EOF" >> "$GITHUB_ENV"
76+
5077
- name: Generate token
5178
id: app-token
5279
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
@@ -65,6 +92,12 @@ jobs:
6592
6693
**Source**: ${{ inputs.source }}
6794
95+
---
96+
97+
## Release Notes
98+
99+
${{ env.RELEASE_NOTES }}
100+
68101
This PR was created automatically.
69102
branch: "gha/auto-update-supabase-js-v${{ inputs.version }}"
70103
base: ${{ github.event.repository.default_branch }}

0 commit comments

Comments
 (0)