Skip to content
Open
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
24 changes: 22 additions & 2 deletions .github/workflows/sdk-update-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ on:
schedule:
- cron: '0 9 * * *'
workflow_dispatch:
inputs:
include-prerelease-upgrades:
description: 'Also detect when a stable release replaces a pre-release (e.g. 0.11.0-dev3 → 0.11.0)'
type: boolean
default: false

permissions:
contents: read
Expand All @@ -17,7 +22,7 @@ jobs:

- name: Check for update and create issue
env:
GH_TOKEN: ${{ github.token }}
GH_TOKEN: ${{ secrets.SDK_CHECK_PAT }}
run: |
set -euo pipefail

Expand All @@ -29,7 +34,22 @@ jobs:
")

echo "Current: $CURRENT, Latest: $LATEST"
npx semver "$LATEST" -r ">$CURRENT" > /dev/null 2>&1 || { echo "Up to date."; exit 0; }

# Standard range check (works for normal version bumps)
if npx semver "$LATEST" -r ">$CURRENT" > /dev/null 2>&1; then
echo "New version available."
elif [ "${{ inputs.include-prerelease-upgrades }}" = "true" ]; then
# Strip range operators (^, ~, etc.) and compare raw versions
# so that 0.11.0 is detected as newer than 0.11.0-dev3
CURRENT_VER=$(echo "$CURRENT" | sed 's/^[^0-9]*//')
if npx semver "$LATEST" -r ">$CURRENT_VER" > /dev/null 2>&1; then
echo "Stable release available for current pre-release."
else
echo "Up to date."; exit 0
fi
else
echo "Up to date."; exit 0
fi

COUNT=$(gh issue list --label sdk-upgrade --state open --json number --jq 'length')
[ "$COUNT" -gt 0 ] && echo "Open issue already exists." && exit 0
Expand Down
Loading