From c9160eeff17ad45d22cb32107adadfdd89e2d6f7 Mon Sep 17 00:00:00 2001 From: Eric McDaniel Date: Tue, 24 Feb 2026 18:17:08 -0600 Subject: [PATCH] Replace overwritten file --- .github/scripts/get-pr-details.sh | 72 +++++++++---------------------- 1 file changed, 20 insertions(+), 52 deletions(-) diff --git a/.github/scripts/get-pr-details.sh b/.github/scripts/get-pr-details.sh index 7368cd7..339ac25 100644 --- a/.github/scripts/get-pr-details.sh +++ b/.github/scripts/get-pr-details.sh @@ -1,8 +1,9 @@ + #!/usr/bin/env bash set -euo pipefail -echo "Determining next SemVer..." +echo "Retrieving PR information..." if [ -z "${GITHUB_TOKEN:-}" ]; then echo "GITHUB_TOKEN not set" @@ -13,68 +14,35 @@ OWNER="${GITHUB_REPOSITORY%%/*}" REPO="${GITHUB_REPOSITORY##*/}" SHA="${GITHUB_SHA}" -git fetch --tags -LATEST_TAG=$(git tag --list 'v*.*.*' --sort=-v:refname | head -n1 || true) - -if [ -z "$LATEST_TAG" ]; then - LATEST_TAG="v0.0.0" -fi - -echo "Latest tag: $LATEST_TAG" - -VERSION="${LATEST_TAG#v}" -IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION" - PRS_JSON=$(curl -s \ -H "Authorization: Bearer $GITHUB_TOKEN" \ -H "Accept: application/vnd.github+json" \ "https://api.github.com/repos/$OWNER/$REPO/commits/$SHA/pulls") -echo "$PRS_JSON" | jq . - PR_COUNT=$(echo "$PRS_JSON" | jq length) if [ "$PR_COUNT" -eq 0 ]; then echo "No PR associated with this commit." - exit 1 + echo "title=" >> "$GITHUB_OUTPUT" + echo "body=" >> "$GITHUB_OUTPUT" + exit 0 fi -LABELS=$(echo "$PRS_JSON" | jq -r '.[0].labels[].name' | tr '[:upper:]' '[:lower:]') - -BUMP="patch" - -COUNT=0 -for LABEL in major minor patch; do - if echo "$LABELS" | grep -qx "$LABEL"; then - BUMP="$LABEL" - COUNT=$((COUNT+1)) - fi -done - -if [ "$COUNT" -gt 1 ]; then - echo "Multiple SemVer labels applied. Use only one of: major, minor, patch." - exit 1 -fi - -echo "Version bump type: $BUMP" - -case "$BUMP" in - major) - MAJOR=$((MAJOR+1)) - MINOR=0 - PATCH=0 - ;; - minor) - MINOR=$((MINOR+1)) - PATCH=0 - ;; - patch) - PATCH=$((PATCH+1)) - ;; -esac +TITLE=$(echo "$PRS_JSON" | jq -r '.[0].title // ""') +BODY=$(echo "$PRS_JSON" | jq -r '.[0].body // ""') -NEW_TAG="v${MAJOR}.${MINOR}.${PATCH}" +{ + echo "title<> "$GITHUB_OUTPUT" -echo "New tag: $NEW_TAG" +{ + echo "body<> "$GITHUB_OUTPUT" -echo "tag=$NEW_TAG" >> "$GITHUB_OUTPUT" +echo "PR details captured." +echo "- Title = $TITLE." +echo "- Description = $BODY." \ No newline at end of file