|
47 | 47 | npm pkg set "dependencies.@supabase/supabase-js=${{ inputs.version }}" |
48 | 48 | pnpm install --lockfile-only --ignore-scripts |
49 | 49 |
|
| 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 | +
|
50 | 77 | - name: Generate token |
51 | 78 | id: app-token |
52 | 79 | uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0 |
|
65 | 92 |
|
66 | 93 | **Source**: ${{ inputs.source }} |
67 | 94 |
|
| 95 | + --- |
| 96 | +
|
| 97 | + ## Release Notes |
| 98 | +
|
| 99 | + ${{ env.RELEASE_NOTES }} |
| 100 | +
|
68 | 101 | This PR was created automatically. |
69 | 102 | branch: "gha/auto-update-supabase-js-v${{ inputs.version }}" |
70 | 103 | base: ${{ github.event.repository.default_branch }} |
0 commit comments