Add explicit path for dotenv#23
Merged
Merged
Conversation
| } catch (error) { | ||
| console.error(`Failed to fetch user details for ${username}:`, error); | ||
| try { | ||
| const { data } = await octokit.rest.users.getAuthenticated(); |
There was a problem hiding this comment.
Usage of top-level await requires that the module is run as an ES module or that the Node.js version supports top-level await. If this code may run in a CommonJS environment, consider wrapping it in an async function.
Owner
Author
There was a problem hiding this comment.
This is my prototyping workflow so I will kill this before I go live.
Comment on lines
+19
to
20
| dotenv.config({ path: 'src/.env' }); | ||
|
|
There was a problem hiding this comment.
Consider using path.join or path.resolve (with __dirname) to construct the .env file path for OS-independent path resolution.
Suggested change
| dotenv.config({ path: 'src/.env' }); | |
| dotenv.config({ path: path.resolve(__dirname, '../../.env') }); |
Owner
Author
There was a problem hiding this comment.
Good suggestion. For now, I'll leave it as is but will create an issue for this to ensure I tackle it eventually.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Due to issues with
dotenvresolving a path to our.envfile, considered turning most ofgithubClient.ts, including all of Octokit instantiation into a class to allow for easier passing around. This is most likely due to my own stupid misunderstanding of how node runs code.This PR updates our
startscript and passes an explicit path to dotenv.Note
I assumed this would be a bigger PR but it is not. I'm going through this motion to try out the Copilot code review.
Linked Issues
NA
Additional context
Code quality and cleanliness is poor. I will refactor this at some point but interested in what suggestions code reviewers will make.