You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# For direct pushes, find the common ancestor branch
224
226
echo "Not a PR, finding base branch via merge-base"
225
227
226
-
# Get all remote branches and find the one with closest common ancestor
228
+
# Get all remote branches sorted by commit date (most recent first)
229
+
# This ensures we check actively developed branches first
227
230
CURRENT_COMMIT=$(git rev-parse HEAD)
228
231
BEST_BRANCH=""
229
232
CLOSEST_DISTANCE=999999
230
233
231
-
for remote_branch in $(git for-each-ref --format='%(refname:short)' refs/remotes/origin/ | grep -v 'HEAD\|PR-CHECKER'); do
234
+
# Only check the 30 most recently updated branches for performance
235
+
for remote_branch in $(git for-each-ref --sort=-committerdate --format='%(refname:short)' refs/remotes/origin/ | grep -v 'HEAD\|PR-CHECKER' | head -30); do
232
236
branch_name=$(echo "$remote_branch" | sed 's|^origin/||')
233
237
234
238
# Skip if it's the current branch
@@ -368,7 +372,7 @@ jobs:
368
372
- name: Checkout kernel source
369
373
uses: actions/checkout@v4
370
374
with:
371
-
fetch-depth: 0
375
+
fetch-depth: 50# Shallow clone: enough for commit messages and logs
372
376
token: ${{ secrets.GITHUB_TOKEN }}
373
377
374
378
- name: Download kernel compilation logs
@@ -442,52 +446,11 @@ jobs:
442
446
env:
443
447
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
444
448
run: |
445
-
BASE_BRANCH=""
446
-
447
-
# For PRs, use the base branch directly
448
-
if [ -n "${{ github.base_ref }}" ]; then
449
-
BASE_BRANCH="${{ github.base_ref }}"
450
-
echo "Using PR base branch: $BASE_BRANCH"
451
-
else
452
-
# For direct pushes, find the common ancestor branch
453
-
echo "Not a PR, finding base branch via merge-base"
454
-
455
-
# Get all remote branches and find the one with closest common ancestor
456
-
CURRENT_COMMIT=$(git rev-parse HEAD)
457
-
BEST_BRANCH=""
458
-
CLOSEST_DISTANCE=999999
459
-
460
-
for remote_branch in $(git for-each-ref --format='%(refname:short)' refs/remotes/origin/ | grep -v 'HEAD\|PR-CHECKER'); do
461
-
branch_name=$(echo "$remote_branch" | sed 's|^origin/||')
462
-
463
-
# Skip if it's the current branch
464
-
if [ "$branch_name" = "${{ github.ref_name }}" ]; then
465
-
continue
466
-
fi
467
-
468
-
MERGE_BASE=$(git merge-base HEAD "$remote_branch" 2>/dev/null || echo "")
469
-
470
-
# Check if this branch shares history and isn't the current commit
471
-
if [ -n "$MERGE_BASE" ] && [ "$MERGE_BASE" != "$CURRENT_COMMIT" ]; then
472
-
# Calculate distance (number of commits) from merge-base to current HEAD
0 commit comments