Files
wehub-resource-sync 4b6817381b
CI (OpenClaw E2E) / openclaw test (push) Has been cancelled
CI / coverage-report (push) Has been cancelled
CI / test-kubernetes (push) Has been cancelled
CI / should-run-thorough (push) Has been cancelled
CI / test-thorough (cloudwatch-demo) (push) Has been cancelled
CI / test-thorough (flink-ecs) (push) Has been cancelled
CI / test-thorough (upstream-lambda) (push) Has been cancelled
CI / test-thorough (prefect-ecs-fargate) (push) Has been cancelled
Release / build-binaries (zip, opensre.exe, onefile, windows-latest, windows-x64) (push) Has been cancelled
Benchmark image — build + push to ECR (any adapter) / build + push (push) Has been cancelled
CI / quality (ubuntu-latest) (push) Has been cancelled
CI / test (tools-runtime) (push) Has been cancelled
CI / test (e2e-general) (push) Has been cancelled
CI / test (cli-runtime) (push) Has been cancelled
CI / test (e2e-provider-and-openclaw) (push) Has been cancelled
CI / test (integrations-and-misc) (push) Has been cancelled
Release / verify (push) Has been cancelled
Release / build-python-dist (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, macos-15-intel, darwin-x64) (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, macos-latest, darwin-arm64) (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04, linux-x64) (push) Has been cancelled
Release / publish-release (push) Has been cancelled
Release / publish-main-release (push) Has been cancelled
Interactive Shell Live (PR + post-merge) / turn-checks (no-LLM) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Interactive Shell Live (PR + post-merge) / turn-live shard ${{ matrix.shard_index }} (push) Has been cancelled
Release / prepare (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04-arm, linux-arm64) (push) Has been cancelled
Synthetic Deterministic Tests / Synthetic offline (deterministic) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:10:45 +08:00

105 lines
3.0 KiB
Plaintext

---
title: "Google Docs"
description: "Connect Google Docs so OpenSRE can write investigation reports to your Google Drive"
---
OpenSRE can write investigation findings directly to Google Drive as formatted Google Docs — creating a persistent, shareable record of each incident investigation linked to your team's existing Drive folder.
## Prerequisites
- Google Cloud project with the Google Drive API enabled
- Service account with access to a shared Drive folder
## Setup
### Option 1: Interactive CLI
```bash
opensre integrations setup
```
Select **Google Docs** when prompted and provide your credentials file path and folder ID.
### Option 2: Environment variables
Add to your `.env`:
```bash
GOOGLE_CREDENTIALS_FILE=/path/to/service-account.json
GOOGLE_DRIVE_FOLDER_ID=your-google-drive-folder-id
```
| Variable | Default | Description |
| --- | --- | --- |
| `GOOGLE_CREDENTIALS_FILE` | — | **Required.** Path to the service account JSON file |
| `GOOGLE_DRIVE_FOLDER_ID` | — | **Required.** Google Drive folder ID for investigation reports |
### Option 3: Persistent store
```json
{
"version": 1,
"integrations": [
{
"id": "google-docs-prod",
"service": "google_docs",
"status": "active",
"credentials": {
"credentials_file": "/path/to/service-account.json",
"folder_id": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgVE2upms"
}
}
]
}
```
## Creating a service account
1. In Google Cloud Console, go to **IAM & Admin** → **Service Accounts**
2. Click **Create Service Account**
3. Give it a name (e.g., `opensre-docs`) and click **Create**
4. Skip role assignment and click **Done**
5. Click on the service account → **Keys** → **Add Key** → **Create new key** (JSON)
6. Download the JSON file
## Granting Drive folder access
1. In Google Drive, open the folder where reports should be saved
2. Click **Share**
3. Add the service account email (e.g., `opensre-docs@your-project.iam.gserviceaccount.com`)
4. Set the permission to **Editor**
## Finding the folder ID
The folder ID appears in the Drive URL:
`https://drive.google.com/drive/folders/<folder-id>`
## Verify
```bash
opensre integrations verify google_docs
```
Expected output:
```
Service: google_docs
Status: passed
Detail: Connected to Drive folder 1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgVE2upms (3 items in folder)
```
## Troubleshooting
| Symptom | Fix |
| --- | --- |
| **Credentials file not found** | Check the path in `GOOGLE_CREDENTIALS_FILE` — use an absolute path |
| **403 Forbidden** | The service account hasn't been added to the Drive folder with Editor access |
| **Drive API not enabled** | Enable the **Google Drive API** in your Google Cloud project |
| **Folder not found** | Confirm the folder ID and that the service account has access |
## Security best practices
- Keep the service account JSON file outside of your repository — add it to `.gitignore`.
- Grant the service account access **only** to the specific Drive folder it needs.
- Rotate the service account key periodically via Google Cloud Console.