Skip to main content
Unlisted page
This page is unlisted. Search engines will not index it, and only users having a direct link can access it.

Configuration Verification Report

GitHub Secret to Code Flow

This document verifies the correct configuration of the GEMINI_API_KEY from GitHub Secrets to the chatbot code.

Configuration Chain

GitHub Repository Secret: GEMINI_API_KEY

GitHub Actions Workflow: secrets.GEMINI_API_KEY

Environment Variable (Build): GEMINI_API_KEY

Docusaurus Config: process.env.GEMINI_API_KEY

Custom Fields: customFields.GEMINI_API_KEY

AutoBot Component: siteConfig.customFields?.GEMINI_API_KEY

Verification Results

✅ 1. GitHub Workflows (.github/workflows/)

deploy.yml:

- name: Build
run: yarn build
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}

test.yml:

- name: Build
run: yarn build
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}

Status: ✅ Correctly references secrets.GEMINI_API_KEY


✅ 2. Docusaurus Configuration (docusaurus.config.js)

customFields: {
GEMINI_API_KEY: process.env.GEMINI_API_KEY || '',
},

Status: ✅ Correctly reads from process.env.GEMINI_API_KEY


✅ 3. AutoBot Component (src/components/AutoBot/index.tsx)

const apiKey = (siteConfig.customFields?.GEMINI_API_KEY as string) || '';

if (!apiKey || !apiKey.trim()) {
console.error('[AutoBot] Gemini API key not configured.');
console.error('[AutoBot] For local development: Set GEMINI_API_KEY in .env file');
console.error('[AutoBot] For production: Add GEMINI_API_KEY to GitHub Secrets');
return null;
}

Status: ✅ Correctly reads from siteConfig.customFields?.GEMINI_API_KEY


✅ 4. Environment File (.env.example)

# Gemini API Key for AutoBot chatbot
# Get your API key from: https://ai.google.dev/gemini-api/docs/api-key
GEMINI_API_KEY=your_api_key_here

Status: ✅ Uses consistent name GEMINI_API_KEY


✅ 5. Test Files

chatbot-api.test.js:

const apiKey = process.env.GEMINI_API_KEY;

Status: ✅ Correctly reads from process.env.GEMINI_API_KEY


Configuration Summary

ComponentVariable NameSourceStatus
GitHub SecretGEMINI_API_KEYRepository Settings → Secrets
Deploy Workflowsecrets.GEMINI_API_KEY.github/workflows/deploy.yml
Test Workflowsecrets.GEMINI_API_KEY.github/workflows/test.yml
Build EnvironmentGEMINI_API_KEYWorkflow env variable
Docusaurus Configprocess.env.GEMINI_API_KEYdocusaurus.config.js
Custom FieldscustomFields.GEMINI_API_KEYDocusaurus runtime
AutoBot ComponentsiteConfig.customFields?.GEMINI_API_KEYsrc/components/AutoBot/index.tsx
Local DevelopmentGEMINI_API_KEY.env file
API Testsprocess.env.GEMINI_API_KEYtests/chatbot-api.test.js

How to Set Up

For Local Development

  1. Copy .env.example to .env:

    cp .env.example .env
  2. Edit .env and add your API key:

    GEMINI_API_KEY=your_actual_api_key_here
  3. Restart the development server

For Production (GitHub Pages)

  1. Go to Repository Settings → Secrets and variables → Actions
  2. Click "New repository secret"
  3. Name: GEMINI_API_KEY
  4. Value: Your Gemini API key
  5. Click "Add secret"

The deployment workflow will automatically use this secret during the build process.


Verification Tests

Run the following commands to verify the configuration:

# Verify model configuration
npm run verify-models

# Test chat history (no API key needed)
npm run test:history

# Test API functionality (requires GEMINI_API_KEY)
GEMINI_API_KEY=your_key npm run test:api

# Run all tests with report
npm test

Conclusion

All configuration is correct and consistent.

The GEMINI_API_KEY is used with the exact same name throughout the entire stack:

  • GitHub Secret name: GEMINI_API_KEY
  • Environment variable name: GEMINI_API_KEY
  • No legacy REACT_APP_GEMINI_API_KEY references remain

The chatbot will correctly read the API key from GitHub Secrets when deployed.