@@ -356,8 +356,16 @@ jobs:
356356 git commit -m "Create persistent storage"
357357 git push origin save_historical_data
358358 fi
359- git checkout $branch_name
360- git checkout save_historical_data -- TSF/MemoryEfficientTestResultData.db
359+ # Handle fork PRs by staying on current working branch instead of switching
360+ if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
361+ # For PRs, we're already on the right commit from actions/checkout
362+ # Just get the file from save_historical_data branch
363+ git checkout save_historical_data -- TSF/MemoryEfficientTestResultData.db
364+ else
365+ # For push events, switch to the branch and get the file
366+ git checkout $branch_name
367+ git checkout save_historical_data -- TSF/MemoryEfficientTestResultData.db
368+ fi
361369
362370 - name : append test data
363371 run : |
@@ -379,8 +387,15 @@ jobs:
379387 - name : Recover stash
380388 if : github.event_name == 'schedule' || (github.event_name == 'push' && github.ref_name == 'main')
381389 run : |
382- git checkout $branch_name
383- git stash apply
390+ # Handle fork PRs by staying on current working branch instead of switching
391+ if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
392+ # For PRs, we're already on the right branch/commit
393+ git stash apply
394+ else
395+ # For push events, switch back to the working branch
396+ git checkout $branch_name
397+ git stash apply
398+ fi
384399
385400 - name : Move test report
386401 run : |
@@ -441,8 +456,16 @@ jobs:
441456 git commit -m "Create persistent storage"
442457 git push origin save_historical_data
443458 fi
444- git checkout $branch_name
445- git checkout save_historical_data -- TSF/MemoryEfficientTestResultData.db
459+ # Handle fork PRs by staying on current working branch instead of switching
460+ if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
461+ # For PRs, we're already on the right commit from actions/checkout
462+ # Just get the file from save_historical_data branch
463+ git checkout save_historical_data -- TSF/MemoryEfficientTestResultData.db
464+ else
465+ # For push events, switch to the branch and get the file
466+ git checkout $branch_name
467+ git checkout save_historical_data -- TSF/MemoryEfficientTestResultData.db
468+ fi
446469
447470 - name : append test data
448471 run : |
@@ -464,8 +487,15 @@ jobs:
464487 - name : Recover stash
465488 if : github.event_name == 'schedule' || (github.event_name == 'push' && github.ref_name == 'main')
466489 run : |
467- git checkout $branch_name
468- git stash apply
490+ # Handle fork PRs by staying on current working branch instead of switching
491+ if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
492+ # For PRs, we're already on the right branch/commit
493+ git stash apply
494+ else
495+ # For push events, switch back to the working branch
496+ git checkout $branch_name
497+ git stash apply
498+ fi
469499
470500 - name : Move test report
471501 run : |
@@ -526,8 +556,16 @@ jobs:
526556 git commit -m "Create persistent storage"
527557 git push origin save_historical_data
528558 fi
529- git checkout $branch_name
530- git checkout save_historical_data -- TSF/MemoryEfficientTestResultData.db
559+ # Handle fork PRs by staying on current working branch instead of switching
560+ if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
561+ # For PRs, we're already on the right commit from actions/checkout
562+ # Just get the file from save_historical_data branch
563+ git checkout save_historical_data -- TSF/MemoryEfficientTestResultData.db
564+ else
565+ # For push events, switch to the branch and get the file
566+ git checkout $branch_name
567+ git checkout save_historical_data -- TSF/MemoryEfficientTestResultData.db
568+ fi
531569
532570 - name : append test data
533571 run : |
@@ -549,8 +587,15 @@ jobs:
549587 - name : Recover stash
550588 if : github.event_name == 'schedule' || (github.event_name == 'push' && github.ref_name == 'main')
551589 run : |
552- git checkout $branch_name
553- git stash apply
590+ # Handle fork PRs by staying on current working branch instead of switching
591+ if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
592+ # For PRs, we're already on the right branch/commit
593+ git stash apply
594+ else
595+ # For push events, switch back to the working branch
596+ git checkout $branch_name
597+ git stash apply
598+ fi
554599
555600 - name : Move test report
556601 run : |
0 commit comments