Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Google Sheets integration for GitHub user verification #4671

Merged
merged 16 commits into from
Nov 1, 2024

Conversation

rbren
Copy link
Collaborator

@rbren rbren commented Oct 31, 2024

This PR adds support for using Google Sheets as a source for allowed GitHub usernames.

Key changes:

  • Add Google Sheets client for fetching allowed usernames from a configured sheet
  • Modify GitHub authentication to support both text file and Google Sheets verification
  • Maintain backward compatibility with existing text file approach
  • Use workload identity for Google Sheets authentication when running in GCP

Setup instructions:

  1. Install required dependencies (already in pyproject.toml):
poetry install
  1. Configure environment variables:
# Existing variables remain unchanged
GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secret
GITHUB_USER_LIST_FILE=/path/to/users.txt  # Optional: Keep for backwards compatibility

# New variable for Google Sheets
GITHUB_USERS_SHEET_ID=your_google_sheet_id
  1. Set up Google Sheets:
    • Create a Google Sheet and note its ID from the URL
    • Put GitHub usernames in column A
    • Ensure the GCP service account has access to the sheet
    • Configure workload identity federation for your deployment environment

The system will check both text file (if configured) and Google Sheet for valid usernames.


To run this PR locally, use the following command:

docker run -it --rm   -p 3000:3000   -v /var/run/docker.sock:/var/run/docker.sock   --add-host host.docker.internal:host-gateway   -e SANDBOX_RUNTIME_CONTAINER_IMAGE=ghcr.io/all-hands-ai/runtime:9f26c52-nikolaik   --name openhands-app-9f26c52   ghcr.io/all-hands-ai/runtime:9f26c52

- Add Google Sheets client for fetching allowed usernames
- Modify GitHub authentication to support both text file and Google Sheets
- Add setup documentation for Google Sheets integration
- Maintain backward compatibility with existing text file approach
@rbren rbren marked this pull request as draft October 31, 2024 23:57
@rbren rbren marked this pull request as ready for review November 1, 2024 00:51
Copy link
Contributor

@neubig neubig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but we can remove some typing imports.

@@ -1,47 +1,104 @@
import os
from typing import List, Optional
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not necessary, just use list and | None.

@neubig neubig added fix-me Attempt to fix this issue with OpenHands and removed fix-me Attempt to fix this issue with OpenHands labels Nov 1, 2024
@neubig neubig self-requested a review November 1, 2024 21:11
@rbren rbren merged commit b27fabe into main Nov 1, 2024
@rbren rbren deleted the feature/google-sheets-auth branch November 1, 2024 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix-me Attempt to fix this issue with OpenHands
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants