From 58cabe58172fd0d4da1b3eb82f0ee09f1a8e2314 Mon Sep 17 00:00:00 2001 From: Radoslav Stoyanov Date: Fri, 8 Aug 2025 11:38:46 +0200 Subject: [PATCH] Modified the API request --- .github/workflows/release.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 40cc163..6c54941 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -176,11 +176,11 @@ jobs: echo "Commit SHA: '$commit_sha'" # Use GitHub API to get PRs associated with this commit - pr_data=$(gh api repos/${{ github.repository }}/commits/$commit_sha/pulls --jq '.[0]' 2>/dev/null) + pr_data=$(gh api repos/${{ github.repository }}/commits/${{ github.sha }}/pulls --jq '.[0]' 2>/dev/null || echo "") - if [ -n "$pr_data" ] && [ "$pr_data" != "null" ]; then + if [ -n "$pr_data" ] && [ "$pr_data" != "null" ] && [ "$pr_data" != "" ]; then # Extract labels from the PR - pr_labels=$(echo "$pr_data" | jq -r '.labels[].name' 2>/dev/null | tr '\n' ' ') + pr_labels=$(echo "$pr_data" | jq -r '.labels[].name' 2>/dev/null | tr '\n' ' ' || echo "") echo "PR labels from API: '$pr_labels'" # Check for release labels @@ -191,6 +191,8 @@ jobs: elif echo "$pr_labels" | grep -q "release: patch"; then version_type="patch" fi + else + echo "No PR data found for commit $commit_sha" fi fi