Skip to content

Commit

Permalink
chore: test with js-yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed Jan 15, 2025
1 parent 2e489c0 commit a3820fa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"console-log-level": "^1.4.1",
"dotenv": "16.4.5",
"hono": "^4.6.12",
"js-yaml": "^4.1.0",
"openai": "^4.70.2",
"typebox-validators": "0.3.5",
"yaml": "^2.7.0"
Expand All @@ -87,6 +88,7 @@
"@swc/jest": "0.2.36",
"@types/console-log-level": "^1.4.5",
"@types/jest": "29.5.12",
"@types/js-yaml": "^4.0.9",
"@types/node": "20.14.10",
"@types/node-rsa": "^1.1.4",
"azure-functions-core-tools": "^4.0.6610",
Expand Down
7 changes: 4 additions & 3 deletions src/github/utils/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { TransformDecodeCheckError, Value, ValueError } from "@sinclair/typebox/value";
import YAML, { YAMLError } from "yaml";
import YAML from "js-yaml";
import { YAMLError } from "yaml";
import { GitHubContext } from "../github-context";
import { expressionRegex } from "../types/plugin";
import { configSchema, configSchemaValidator, PluginConfiguration } from "../types/plugin-configuration";
Expand All @@ -23,7 +24,7 @@ export async function getConfigurationFromRepo(context: GitHubContext, repositor
}

const { yaml, errors } = parseYaml(rawData);
const targetRepoConfiguration: PluginConfiguration | null = yaml;
const targetRepoConfiguration: PluginConfiguration | null = yaml as PluginConfiguration;
console.log(`Will attempt to decode configuration for ${owner}/${repository}`);
if (targetRepoConfiguration) {
try {
Expand Down Expand Up @@ -188,7 +189,7 @@ export function parseYaml(data: null | string) {
try {
if (data) {
console.log("Before parsing", data);
const parsedData = YAML.parse(data);
const parsedData = YAML.load(data);
console.log("Parsed YAML data", parsedData);
return { yaml: parsedData ?? null, errors: null };
}
Expand Down

0 comments on commit a3820fa

Please sign in to comment.