Skip to content

Conversation

ChrisRackauckas-Claude
Copy link
Contributor

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Aug 8, 2025

Summary

This PR adds an automatic authentication prompt to LinearSolveAutotune's share_results() function, making it much easier for users to share their benchmark results with the community. When users try to share results without being authenticated, the function now offers to run gh auth login interactively, using either the system gh CLI or the JLL-provided version.

Key Feature: gh_cli_jll Integration

The implementation uses gh_cli_jll to ensure the auto-authentication feature works on all systems:

  • System gh preferred: Uses system gh if installed for better performance
  • Automatic fallback: Uses JLL-provided gh if system gh is not available
  • Zero dependencies: Users don't need to install gh CLI manually
  • Universal compatibility: Works on all platforms Julia supports

Changes

Core Implementation

  • Added gh_cli_jll as a dependency to LinearSolveAutotune
  • Implemented get_gh_command() helper that intelligently selects between system gh and JLL gh
  • Modified setup_github_authentication() to accept an auto_login parameter
  • Updated all gh CLI operations to use the wrapper function

Authentication Flow

When auto_login=true and no authentication is found, the function:

  1. Prompts the user if they want to authenticate
  2. Runs gh auth login interactively (using system gh or JLL)
  3. Guides user through browser-based authentication
  4. Verifies authentication succeeded
  5. Returns to normal flow if authenticated

Fallback Behavior

  • If authentication is skipped or fails, results are saved locally
  • Users get clear instructions on how to share manually
  • Link to the community issue is provided

User Experience

Before (current behavior):

julia> share_results(results)
[ Info: 📤 Preparing to share benchmark results with the community...
[ Info: 🔗 Setting up GitHub authentication...
┌ Warning: ❌ GitHub authentication not available.
[ Info: 📝 To share results, please set up authentication:
[ Info:     Option 1: Install gh CLI and run: gh auth login
[ Info:     Option 2: Create a GitHub token and set: ENV["GITHUB_TOKEN"] = "your_token"
[ Info: 📁 Results saved locally to autotune_results_2024-12-08T10-30-45.md

After (with this PR):

julia> share_results(results)
[ Info: 📤 Preparing to share benchmark results with the community...
[ Info: 🔗 Checking GitHub authentication...

🔐 GitHub authentication not found.
   To share results with the community, authentication is required.

Would you like to authenticate with GitHub now? (y/n)
> y

📝 Starting GitHub authentication...
   This will open your browser to authenticate with GitHub.
   Please follow the prompts to complete authentication.

[Interactive gh auth login process]

✅ Authentication successful\! You can now share results.
[ Info: ✅ Results posted to issue #669

Implementation Details

gh Command Selection

function get_gh_command()
    if \!isnothing(Sys.which("gh"))
        return `gh`  # Use system gh if available
    else
        return `$(gh_cli_jll.gh())`  # Use JLL-provided gh
    end
end

Unified CLI Operations

All gh operations now use the same wrapper:

  • setup_github_authentication() - auth status checks
  • upload_plots_to_gist_gh() - creating gists
  • comment_on_issue_gh() - posting comments
  • create_benchmark_issue_gh() - creating issues

Features

  • Zero-friction sharing: Users are guided through authentication when needed
  • No manual installation: Works even without gh CLI installed
  • Intelligent fallback: Prefers system gh, falls back to JLL
  • Optional: Users can skip authentication by typing 'n' at the prompt
  • Backward compatible: Can be disabled with share_results(results; auto_login=false)
  • Graceful degradation: If authentication fails, results are saved locally
  • Clear messaging: Users understand what's happening at each step

Testing

Tested the following scenarios:

  • ✅ System gh installed + authenticated: Uses system gh
  • ✅ System gh installed + not authenticated: Prompts for auth using system gh
  • ✅ System gh not installed: Uses JLL gh for all operations
  • ✅ User agrees to authenticate: Runs gh auth login successfully
  • ✅ User declines authentication: Saves results locally
  • ✅ GITHUB_TOKEN set: Uses token without prompting
  • ✅ auto_login=false: Never prompts, saves locally if not authenticated

Benefits

  • Improved accessibility: No need to install gh CLI manually
  • Better user experience: Guided authentication process
  • Wider adoption: Lower barrier to sharing benchmark results
  • Platform independence: Works on all systems Julia supports
  • Maintains performance: Uses system gh when available

Documentation

Updated the docstring for share_results() to document:

  • The new auto_login parameter
  • The automatic authentication feature
  • Both system and JLL gh support
  • Examples of both usage modes

This change significantly improves the user experience for contributing benchmark results to the LinearSolve.jl community by removing all manual setup requirements.

🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]

- Modified setup_github_authentication to offer interactive gh auth login
- Added auto_login parameter to control whether to prompt for authentication
- If gh is not authenticated, prompts user to run gh auth login
- Runs gh auth login interactively if user agrees
- Updated share_results to pass through auto_login parameter
- Falls back to saving results locally if authentication fails or is skipped

This makes sharing results much easier - users no longer need to manually set up authentication beforehand. The function will guide them through the process when needed.
- Added gh_cli_jll as a dependency
- Implemented get_gh_command() to select between system gh and JLL gh
- Updated all gh CLI calls to use the wrapper function
- Auto-login now works even when gh is not installed on the system
- Falls back to JLL-provided gh binary automatically

This ensures the auto-authentication feature works on all systems, regardless of whether gh CLI is installed.
@ChrisRackauckas ChrisRackauckas merged commit 0d99660 into SciML:main Aug 8, 2025
107 of 118 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants