Skip to content

Commit 6e22e62

Browse files
Fix PR creation system to use fallback repository
- Complete fallback logic when primary target repository doesn't exist - Use accessible fallback repository ChrisRackauckas-Claude/LinearSolveAutotuneResults.jl - Add detailed logging for repository selection process - Update PR body to show which repository is being used - Fix GitHub API calls to use proper repository references 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent baa3b1d commit 6e22e62

File tree

1 file changed

+33
-11
lines changed

1 file changed

+33
-11
lines changed

lib/LinearSolveAutotune/src/telemetry.jl

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ function upload_to_github(content::String, plot_files::Union{Nothing, Tuple, Dic
380380

381381
# Fork the repository if needed and create branch
382382
target_repo = "SciML/LinearSolveAutotuneResults.jl"
383+
fallback_repo = "ChrisRackauckas-Claude/LinearSolveAutotuneResults.jl"
383384
branch_name = "autotune-results-$(folder_name)"
384385

385386
@info "📋 Creating result folder: results/$folder_name"
@@ -388,7 +389,7 @@ function upload_to_github(content::String, plot_files::Union{Nothing, Tuple, Dic
388389
files_to_create = create_result_files(folder_name, content, plot_files, results_df, system_info, categories)
389390

390391
# Create pull request with all files
391-
pr_result = create_results_pr(target_repo, branch_name, folder_name, files_to_create, auth)
392+
pr_result = create_results_pr(target_repo, fallback_repo, branch_name, folder_name, files_to_create, auth)
392393

393394
if pr_result !== nothing
394395
@info "✅ Successfully created pull request: $(pr_result["html_url"])"
@@ -529,21 +530,40 @@ end
529530
530531
Create a pull request with the benchmark results.
531532
"""
532-
function create_results_pr(target_repo, branch_name, folder_name, files, auth)
533+
function create_results_pr(target_repo, fallback_repo, branch_name, folder_name, files, auth)
533534
try
534535
@info "🚧 Creating pull request with benchmark results..."
535536
@info "📋 Target: $target_repo, Branch: $branch_name"
536537
@info "📋 Files to include: $(length(files)) files"
537538

538-
# Split the target repo name
539-
repo_parts = split(target_repo, "/")
540-
if length(repo_parts) != 2
541-
error("Invalid repository format: $target_repo")
542-
end
543-
repo_owner, repo_name = repo_parts
539+
# Try target repository first, fallback if it doesn't exist
540+
actual_target_repo = target_repo
541+
target_repo_obj = nothing
542+
repo_owner = ""
543+
repo_name = ""
544544

545-
# Get the target repository
546-
target_repo_obj = GitHub.repo(repo_owner * "/" * repo_name, auth=auth)
545+
try
546+
@info "📋 Trying primary target: $target_repo"
547+
repo_parts = split(target_repo, "/")
548+
if length(repo_parts) != 2
549+
error("Invalid repository format: $target_repo")
550+
end
551+
repo_owner, repo_name = repo_parts
552+
target_repo_obj = GitHub.repo(target_repo, auth=auth)
553+
@info "✅ Primary target accessible: $target_repo"
554+
catch e
555+
@warn "Primary target $target_repo not accessible: $e"
556+
@info "📋 Using fallback repository: $fallback_repo"
557+
actual_target_repo = fallback_repo
558+
559+
repo_parts = split(fallback_repo, "/")
560+
if length(repo_parts) != 2
561+
error("Invalid fallback repository format: $fallback_repo")
562+
end
563+
repo_owner, repo_name = repo_parts
564+
target_repo_obj = GitHub.repo(fallback_repo, auth=auth)
565+
@info "✅ Fallback target accessible: $fallback_repo"
566+
end
547567

548568
# Get authenticated user to determine source repo
549569
user = GitHub.whoami(auth=auth)
@@ -624,14 +644,15 @@ function create_results_pr(target_repo, branch_name, folder_name, files, auth)
624644
end
625645
end
626646

627-
# Create pull request
647+
# Create pull request to the actual accessible repository
628648
pr_title = "Add benchmark results: $folder_name"
629649
pr_body = """
630650
# LinearSolve.jl Benchmark Results
631651
632652
Automated submission of benchmark results from the LinearSolve.jl autotune system.
633653
634654
## System Information
655+
- **Repository**: $actual_target_repo
635656
- **Folder**: `results/$folder_name`
636657
- **Files**: $(length(files)) files including CSV data, plots, and system info
637658
- **Timestamp**: $(Dates.now())
@@ -650,6 +671,7 @@ The benchmark data will help improve algorithm selection for the community.
650671
🤖 Generated by LinearSolve.jl autotune system
651672
"""
652673

674+
@info "📋 Creating PR to $actual_target_repo from $(user.login):$branch_name to $default_branch"
653675
pr_result = GitHub.create_pull_request(target_repo_obj,
654676
title=pr_title,
655677
body=pr_body,

0 commit comments

Comments
 (0)