This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 80c2953d20f8 CAMEL-23196: Fix PR test detection using GitHub API 
instead of unreliable proxy (#22062)
80c2953d20f8 is described below

commit 80c2953d20f89aa1b667541ac1e2e3b6d454c862
Author: Guillaume Nodet <[email protected]>
AuthorDate: Wed Mar 18 15:04:49 2026 +0100

    CAMEL-23196: Fix PR test detection using GitHub API instead of unreliable 
proxy (#22062)
    
    Replace patch-diff.githubusercontent.com (intermittent 503s) with the
    authenticated GitHub API for fetching PR diffs. Add HTTP status checking
    with a warning on failure.
    
    Co-authored-by: Claude Opus 4.6 <[email protected]>
---
 .github/actions/incremental-build/incremental-build.sh | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/.github/actions/incremental-build/incremental-build.sh 
b/.github/actions/incremental-build/incremental-build.sh
index e59634a1a79c..d04c64f5fe7e 100755
--- a/.github/actions/incremental-build/incremental-build.sh
+++ b/.github/actions/incremental-build/incremental-build.sh
@@ -55,7 +55,17 @@ function main() {
 
   echo "Searching for affected projects"
   local projects
-  projects=$(curl -s 
"https://patch-diff.githubusercontent.com/raw/${repository}/pull/${prId}.diff"; 
| sed -n -e '/^diff --git a/p' | awk '{print $3}' | cut -b 3- | sed 
's|\(.*\)/.*|\1|' | uniq | sort)
+  local diff_output
+  diff_output=$(curl -s -w "\n%{http_code}" -H "Authorization: Bearer 
${GITHUB_TOKEN}" -H "Accept: application/vnd.github.v3.diff" 
"https://api.github.com/repos/${repository}/pulls/${prId}";)
+  local http_code
+  http_code=$(echo "$diff_output" | tail -n 1)
+  local diff_body
+  diff_body=$(echo "$diff_output" | sed '$d')
+  if [[ "$http_code" -lt 200 || "$http_code" -ge 300 || -z "$diff_body" ]] ; 
then
+    echo "WARNING: Failed to fetch PR diff (HTTP $http_code). Falling back to 
full build."
+    diff_body=""
+  fi
+  projects=$(echo "$diff_body" | sed -n -e '/^diff --git a/p' | awk '{print 
$3}' | cut -b 3- | sed 's|\(.*\)/.*|\1|' | uniq | sort)
   local pl=""
   local lastProjectRoot=""
   local buildAll=false

Reply via email to