Files
upstream-tldraw/skills/update-release-notes/scripts/get-new-prs.sh
upstream-mirror a774ac673a
Some checks failed
Deploy analytics worker / Deploy analytics worker to ${{ (github.ref == 'refs/heads/production' && 'production') || (github.ref == 'refs/heads/main' && 'staging') || 'preview' }} (push) Failing after 1s
i18n upload strings / Upload latest strings (push) Failing after 1s
Deploy bemo / Deploy bemo to ${{ (github.ref == 'refs/heads/bemo-production' && 'production') || (github.ref == 'refs/heads/main' && 'staging') || 'preview' }} (push) Failing after 1s
Deploy grafana resources / ${{ github.event_name == 'push' && 'Deploy grafana resources' || 'Validate grafana resources (dry run)' }} (push) Failing after 0s
End to end tests (dotcom) / Check for relevant changes (push) Failing after 0s
End to end tests (examples) / Check for relevant changes (push) Failing after 0s
End to end tests (mermaid readability) / Check for relevant changes (push) Failing after 1s
End to end tests (perf) / Check for relevant changes (push) Failing after 0s
Publish editor extensions / Publish editor extensions (push) Failing after 1s
Publish SDK packages / Remove the publish-packages label (push) Has been skipped
Checks / Tests & checks (push) Has been cancelled
Checks / Build all projects (push) Has been cancelled
Deploy templates / Deploy templates (push) Has been cancelled
End to end tests (dotcom) / End to end tests (dotcom) (push) Has been cancelled
End to end tests (mermaid readability) / End to end tests (mermaid readability) (push) Has been cancelled
End to end tests (perf) / End to end tests (perf) (push) Has been cancelled
Deploy .com / Deploy dotcom to ${{ (github.ref == 'refs/heads/production' && 'production') || (github.ref == 'refs/heads/main' && 'staging') || 'preview' }} (push) Has been cancelled
End to end tests (examples) / End to end tests (examples) (push) Has been cancelled
Publish SDK packages / Publish SDK packages (push) Has been cancelled
Publish SDK packages / Tell user released version (push) Has been cancelled
Publish SDK packages / Publishes code templates to separate repositories (push) Has been cancelled
Publish SDK packages / Deploys the template demos with the new SDK version (push) Has been cancelled
snapshot of https://github.com/tldraw/tldraw.git (main, 2026-09-23; blobs > 131072B omitted)
2026-09-23 16:12:52 +05:00

77 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
# Find PR numbers on the production branch since a release branch.
# Uses `git cherry` (like extract-draft-changelog.tsx) to correctly
# handle cherry-picked hotfix commits.
#
# Usage: ./get-new-prs.sh <tldraw-repo-dir> <release-branch>
# Example: ./get-new-prs.sh /tmp/tldraw v4.2.x
#
# Output:
# PR numbers (one per line), then any commits
# without PR numbers (hash + title) on stderr.
#
# Requires a local clone of tldraw/tldraw.
set -e
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: $0 <tldraw-repo-dir> <release-branch>" >&2
echo "Example: $0 /tmp/tldraw v4.2.x" >&2
exit 1
fi
TLDRAW_REPO="$1"
RELEASE_BRANCH="$2"
cd "$TLDRAW_REPO"
# Fetch to ensure we have latest refs
git fetch origin production "$RELEASE_BRANCH" --quiet 2>/dev/null || true
# Use git cherry to find commits on production that aren't on the
# release branch. git cherry compares patches (not hashes), so it
# correctly handles cherry-picks and hotfixes.
# Lines starting with '+' are unique to production.
commit_hashes=$(git cherry "origin/$RELEASE_BRANCH" origin/production 2>/dev/null \
| grep '^+' \
| cut -d' ' -f2)
pr_numbers=()
unmatched=()
for hash in $commit_hashes; do
# Get the first line of the commit message
title=$(git log -1 --pretty=format:%s "$hash" 2>/dev/null)
# Skip [skip ci] commits (version bumps, deploys)
if echo "$title" | grep -q '\[skip ci\]'; then
continue
fi
# Skip deploy commits
if echo "$title" | grep -q '^Deploy from'; then
continue
fi
# Extract PR number from commit message (format: "... (#1234)")
pr=$(echo "$title" | grep -oE '#[0-9]+' | head -1 | sed 's/#//')
if [ -n "$pr" ]; then
pr_numbers+=("$pr")
else
unmatched+=("$hash $title")
fi
done
# Output unique PR numbers, sorted descending
printf '%s\n' "${pr_numbers[@]}" | sort -rn | uniq
# Output unmatched commits (hotfixes without PR numbers) to stderr
if [ ${#unmatched[@]} -gt 0 ]; then
echo "" >&2
echo "Commits without PR numbers (likely hotfixes):" >&2
for line in "${unmatched[@]}"; do
echo " $line" >&2
done
fi