Skip to content

Commit e8b4beb

Browse files
committed
Replace GitHub CLI with curl for PR file diff retrieval in CI workflow
1 parent e9e367c commit e8b4beb

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

.github/workflows/postgresql-test.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,23 @@ jobs:
4848
4949
- name: Get PostgreSQL Versions
5050
id: get-versions
51-
env:
52-
GH_TOKEN: ${{ github.token }}
5351
run: |
5452
if [ "${{ github.event.inputs.version }}" != "" ]; then
5553
# Manual workflow with specific version
5654
VERSION="${{ github.event.inputs.version }}"
5755
echo "Testing specific version: $VERSION"
5856
VERSIONS="[\"$VERSION\"]"
5957
elif [ "${{ github.event_name }}" == "pull_request" ]; then
60-
# For PRs, detect which versions were added or modified
58+
# For PRs, detect which versions were added or modified using GitHub API
6159
echo "Detecting versions changed in PR #${{ github.event.pull_request.number }}"
6260
63-
# Get the diff from GitHub API
64-
DIFF=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files \
65-
--jq '.[] | select(.filename == "releases.properties") | .patch' 2>/dev/null || echo "")
61+
# Get the diff from GitHub API using curl
62+
PATCH=$(curl -s -H "Authorization: token ${{ github.token }}" \
63+
-H "Accept: application/vnd.github.v3+json" \
64+
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" | \
65+
jq -r '.[] | select(.filename == "releases.properties") | .patch' 2>/dev/null || echo "")
6666
67-
if [ -z "$DIFF" ]; then
67+
if [ -z "$PATCH" ]; then
6868
echo "No changes to releases.properties detected"
6969
echo "Testing latest 5 stable versions as fallback"
7070
VERSIONS=$(grep -E "^[0-9]+\.[0-9]+" releases.properties | \
@@ -76,7 +76,7 @@ jobs:
7676
echo "Analyzing diff for added/modified versions..."
7777
7878
# Extract added lines (lines starting with +) that contain version numbers
79-
CHANGED_VERSIONS=$(echo "$DIFF" | \
79+
CHANGED_VERSIONS=$(echo "$PATCH" | \
8080
grep "^+" | \
8181
grep -v "^+++" | \
8282
grep -E "^\+[0-9]+\.[0-9]+" | \

0 commit comments

Comments
 (0)