Configure
Google Drive
Connect Google Drive so reviews read the Docs, Sheets and PDFs a pull request links to or that you pin, read-only and cited in comments.
When a pull request, or the issue it implements, links to a Google Doc, Sheet or PDF, MergeHarbor reads the file and gives it to the review as the specification for the change. You can also pin files that every review of a repository should read, such as an API style guide.
What it does in reviews
- Reads only what is referenced. MergeHarbor looks for Google Drive links (
docs.google.com/document/…,/spreadsheets/…,/presentation/…,drive.google.com/file/…anddrive.google.com/open?id=…) in the pull request title, description and branch, and in the descriptions of its linked Jira, Linear and Asana issues, plus the files pinned for the repository. It never lists, searches or crawls your Drive. Folder links are ignored. - Converts the file to text. Google Docs are exported as Markdown, Sheets as CSV (the first sheet), Slides as plain text. PDFs and Word files stored in Drive are downloaded and converted with a size-limited text extractor. Each file is trimmed to about 8,000 characters, and at most two files are read per pull request and per issue by default.
- Uses it as the specification. Files linked from the pull request, and pinned files, are sent to the review as the documents describing the change; files linked from an issue are added to that issue alongside its acceptance criteria. Text that looks like a secret is redacted before it reaches the model.
- Costs no extra model call. The text is part of the review’s existing context budget (3,000 tokens by default).
- Cites what it used. A comment that relied on a file ends with a “Source used:” link to it, and the requirements check lists the files read under Docs read.
Connect
- In the console, open Integrations and choose Connect on Google Drive (under Docs & knowledge). You need the
settings.managepermission. - Sign in with Google and allow access. MergeHarbor asks for the
drive.filepermission: it can open only the files you choose for it, never the rest of your Drive. - Open Settings on Google Drive and choose Choose files in Google Drive. In the Google Picker, select the docs, sheets and PDFs your pull requests link to. For each file you can choose Read for all repositories or one repository: a file pinned for a repository is read by every review of it.
- Choose Test connection.
Why you pick files
With drive.file, Google lets MergeHarbor open a file only after someone picks it in the Google Picker (or pastes its link in Settings, if the file was already shared with the app). A pull request that links to a file nobody picked is reviewed without it. This keeps MergeHarbor away from everything else in your Drive, and it is the permission Google recommends.
Some self-hosted installations use the broader drive.readonly permission instead (see below). Then any file the connecting account can open is read when a pull request links to it, and picking files is only needed for pinning.
What is read and stored
- File name, link, last modified time and text, as described above. Text is cached for a short time (10 minutes by default; an unchanged file is reused without reading it again), deleted within 24 hours, and never written to logs. If an administrator turns on Keep linked documents in the knowledge base, text that issue triage reads is kept for the days they choose (1–365) after last use instead.
- The connection is named after the Google account that connected it. Tokens are encrypted at rest and never shown again.
- In Settings, you can limit the integration to some repositories. Reviews of other repositories never read Google Drive.
Disconnect
Open the integration in Integrations and choose Disconnect. MergeHarbor revokes its token with Google and deletes its tokens, pins and cached text.
Self-hosted installations
Create a Google Cloud OAuth client (step by step in docs/OAUTH_APPS.md, “Google Drive connections”):
- In a Google Cloud project, enable the Google Drive API and the Google Picker API, and configure the OAuth consent screen.
- Create an OAuth client ID of type Web application with the redirect URI
{PUBLIC_URL}/integrations/connect/google_drive/callback. SetGOOGLE_DRIVE_OAUTH_CLIENT_IDandGOOGLE_DRIVE_OAUTH_CLIENT_SECRET. - Create an API key restricted to the Google Picker API and to your console’s address, and set it as
GOOGLE_DRIVE_PICKER_API_KEY. SetGOOGLE_DRIVE_APP_IDto the project number.
GOOGLE_DRIVE_SCOPE=readonly switches to drive.readonly. Google treats it as a restricted scope: production use beyond 100 test users needs Google’s OAuth verification and an annual security assessment. Google Drive stays hidden in the console until the client ID and secret are set.