Skip to content

Commit

Permalink
Upgrade js-yaml dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
TimonVS committed Nov 15, 2022
1 parent adbeb0d commit b7e7b3e
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 43 deletions.
103 changes: 69 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -17,11 +17,11 @@
},
"devDependencies": {
"@types/jest": "^29.2.2",
"@types/js-yaml": "^3.12.1",
"@types/js-yaml": "^4.0.5",
"@types/node": "^16.18.3",
"@vercel/ncc": "^0.34.0",
"jest": "^29.3.1",
"js-yaml": "^3.13.1",
"js-yaml": "^4.1.0",
"nock": "^13.2.9",
"prettier": "^2.4.1",
"ts-jest": "^29.0.3",
Expand Down
13 changes: 6 additions & 7 deletions src/utils/config.ts
Expand Up @@ -6,9 +6,7 @@ interface RepoInfo {
repo: string;
}

export interface Config {
[k: string]: string | string[];
}
export type Config = Record<string, string | string[]>;

export default async function getConfig(
github: ReturnType<typeof getOctokit>['rest'],
Expand Down Expand Up @@ -40,8 +38,9 @@ export default async function getConfig(
}
}

function parseConfig(content: string): { [key: string]: string | string[] } {
return yaml.safeLoad(Buffer.from(content, 'base64').toString()) || {};
function parseConfig(content: string): Config {
const decodedContent = Buffer.from(content, 'base64').toString();
const parsedConfig = yaml.load(decodedContent);
// TODO: validate config
return parsedConfig as Config;
}

function err() {}

0 comments on commit b7e7b3e

Please sign in to comment.