Skip to content

Commit 8b0d6c8

Browse files
authored
Modify PR_API_URL to include all pull requests
Updated PR_API_URL to query all pull requests instead of just open ones.
1 parent fcf8a5d commit 8b0d6c8

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,15 +213,22 @@ jobs:
213213
echo "inside pr_number=$PR_NUMBER"
214214
echo "Before pr_number=$PR_NUMBER"
215215
216-
PR_API_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls?state=open"
216+
# Query all pull requests (open, closed, and merged)
217+
PR_API_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls"
217218
PR_NUMBER=$(curl -s -H "Accept: application/vnd.github.v3+json" \
218219
-H "Authorization: Bearer $GITHUB_TOKEN" \
219220
$PR_API_URL | jq '.[] | select(.head.sha == "'${GITHUB_SHA}'") | .number')
221+
222+
# Fallback: Retrieve PR number from GITHUB_EVENT_PATH if API fails
223+
if [ -z "$PR_NUMBER" ]; then
224+
echo "PR number not found via API. Attempting fallback..."
225+
PR_NUMBER=$(jq -r '.pull_request.number // empty' < "$GITHUB_EVENT_PATH")
226+
fi
227+
220228
if [ -z "$PR_NUMBER" ]; then
221229
echo "No PR associated with this commit. Skipping deployment."
222230
exit 0
223231
fi
224-
echo "PR_NUMBER=$PR_NUMBER"
225232
226233
227234

0 commit comments

Comments
 (0)