Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions __tests__/misc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ describe('parseYamlConfig', () => {
reason: 'end of the stream or a document separator is expected',
mark: {
name: null,
buffer: 'Test1\nTest2: Test3\n\u0000',
buffer: 'Test1\nTest2: Test3\n',
position: 11,
line: 1,
column: 5,
snippet: ' 1 | Test1\n 2 | Test2: Test3\n----------^',
},
message: 'end of the stream or a document separator is expected at line 2, column 6:\n Test2: Test3\n ^',
message: 'end of the stream or a document separator is expected (2:6)\n\n 1 | Test1\n 2 | Test2: Test3\n----------^',
}, '__error__'),
]);
});
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@technote-space/github-action-config-helper",
"version": "2.0.19",
"version": "2.0.20",
"description": "Helper for GitHub Action to manage config.",
"keywords": [
"github",
Expand Down Expand Up @@ -36,17 +36,17 @@
"dependencies": {
"@actions/github": "^4.0.0",
"@octokit/plugin-rest-endpoint-methods": "^4.4.1",
"@technote-space/github-action-helper": "^4.4.7",
"js-yaml": "^3.14.1"
"@technote-space/github-action-helper": "^4.4.8",
"js-yaml": "^4.0.0"
},
"devDependencies": {
"@technote-space/github-action-test-helper": "^0.6.11",
"@technote-space/github-action-test-helper": "^0.6.12",
"@types/jest": "^26.0.19",
"@types/js-yaml": "^3.12.5",
"@types/node": "^14.14.17",
"@typescript-eslint/eslint-plugin": "^4.11.1",
"@typescript-eslint/parser": "^4.11.1",
"eslint": "^7.16.0",
"@types/node": "^14.14.20",
"@typescript-eslint/eslint-plugin": "^4.12.0",
"@typescript-eslint/parser": "^4.12.0",
"eslint": "^7.17.0",
"jest": "^26.6.3",
"jest-circus": "^26.6.3",
"nock": "^13.0.5",
Expand Down
4 changes: 2 additions & 2 deletions src/misc.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import yaml from 'js-yaml';
import {load} from 'js-yaml';

export const isYaml = (filename: string): boolean => ['yaml', 'yml'].includes(String(filename.split('.').pop()));

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const parseYamlConfig = (content: string): { [key: string]: any } => {
try {
const config = yaml.safeLoad(content);
const config = load(content);
if (!config || typeof config === 'string' || !Object.keys(config).length) {
return {};
}
Expand Down
Loading