Skip to content

Commit 2d74d3d

Browse files
Fix environment variable handling and update README
1 parent 5e9a70e commit 2d74d3d

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
# PR Viewer
23

34
This React application allows you to view open pull requests from GitHub repositories in the OpenDevin organization.
@@ -8,10 +9,10 @@ This React application allows you to view open pull requests from GitHub reposit
89
2. Install dependencies: `npm install`
910
3. Create a `.env` file in the root directory and add your GitHub token:
1011
```
11-
GITHUB_TOKEN=your_github_token_here
12+
VITE_GITHUB_TOKEN=your_github_token_here
1213
```
1314
4. Run the development server: `npm run dev`
14-
5. Open your browser and navigate to the URL provided by Vite
15+
5. Open your browser and navigate to the URL provided by Vite (usually http://localhost:5173)
1516

1617
## Running Tests
1718

@@ -21,3 +22,7 @@ To run the tests, use the command: `npm test`
2122

2223
To build the app for production, use: `npm run build`
2324

25+
## Note
26+
27+
Make sure to replace `your_github_token_here` with an actual GitHub personal access token that has the necessary permissions to read repository and pull request information from the OpenDevin organization.
28+

src/PullRequestViewer.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11

22

3+
34
import React, { useState, useEffect } from 'react';
45
import axios from 'axios';
56
import { Octokit } from '@octokit/rest';
67
import Select from 'react-select';
78

8-
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
9+
const octokit = new Octokit({ auth: import.meta.env.VITE_GITHUB_TOKEN });
910

1011
interface PullRequest {
1112
title: string;

vite.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
23
import { defineConfig } from 'vite'
34
import react from '@vitejs/plugin-react'
45

@@ -10,4 +11,7 @@ export default defineConfig({
1011
environment: 'jsdom',
1112
setupFiles: './src/setupTests.ts',
1213
},
14+
define: {
15+
'process.env.GITHUB_TOKEN': JSON.stringify(process.env.GITHUB_TOKEN)
16+
}
1317
})

0 commit comments

Comments
 (0)