microsoft / genaiscript

Automatable GenAI Scripting
https://microsoft.github.io/genaiscript/
MIT License
2k stars 113 forks source link

Introduce configuration file support #858

Closed pelikhan closed 1 week ago

pelikhan commented 1 week ago

Add support for a configuration file and custom .env file location, enhancing flexibility in environment management.

github-actions[bot] commented 1 week ago

Investigator report

, 1fd7c5c

LOG_DIFF

< $ node built/genaiscript.cjs info help > ../../docs/src/content/docs/reference/cli/commands.md
< (node:2868) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
< (Use `node --trace-deprecation ...` to show where the warning was created)
< $ node packages/cli/built/genaiscript.cjs scripts fix
< (node:2888) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
< (Use `node --trace-deprecation ...` to show where the warning was created)
< .env file not found at .env.local
< error Command failed with exit code 255.
< info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
< error Command failed with exit code 255.
< info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
< ##[error]Process completed with exit code 255.

Root Cause Analysis

The failure in the log is due to missing .env file which results in a command exiting with code 255. The specific lines in the log indicating the issue are:

.env file not found at .env.local
error Command failed with exit code 255.

Suggested Fix

A possible fix is to ensure that the .env.local file is present or the command is modified to handle the absence of the file gracefully.

Here is a suggested diff to handle the absence of .env.local:

- require('dotenv').config({ path: '.env.local' });
+ const dotenv = require('dotenv');
+ const fs = require('fs');

+ const envPath = '.env.local';
+ if (fs.existsSync(envPath)) {
+   dotenv.config({ path: envPath });
+ } else {
+   console.warn(`Warning: ${envPath} not found. Using default environment variables.`);
+ }

This change checks for the existence of the .env.local file before attempting to load it and logs a warning if the file is not found, instead of allowing the process to fail.

generated by gai

github-actions[bot] commented 1 week ago

I encountered an issue retrieving the last successful run before the failed run for the specified workflow and branch. To proceed, could you please verify the workflow and branch details or check if there are any access restrictions?

generated by github-agent

github-actions[bot] commented 1 week ago

It seems there are currently no successful runs for the workflow on the globalenv branch preceding the failed run with ID 11826462769.

Since the next steps require comparing the failed run to a prior successful run, we need at least one successful instance to proceed with the analysis you requested. Here's what we can do:

  1. Verify if there are any runs other than failures for the specific workflow and branch.
  2. If no successful run is available, investigate access to other branches or workflows for potential successful runs that might be relevant.

Would you like me to proceed with any alternative analysis, such as checking different branches or workflows?

generated by github-one