Fixed error with output
This commit is contained in:
parent
7f23de0848
commit
e04f5bc36a
@ -92,10 +92,6 @@ inputs:
|
||||
description: "Output list of changed files in a JSON formatted string which can be used for matrix jobs."
|
||||
required: false
|
||||
default: "false"
|
||||
json_raw_format:
|
||||
description: "Output list of changed files in [jq](https://devdocs.io/jq/) raw output format which means that the output will not be surrounded by quotes and special characters will not be escaped."
|
||||
required: false
|
||||
default: "false"
|
||||
fetch_depth:
|
||||
description: "Depth of additional branch history fetched. **NOTE**: This can be adjusted to resolve errors with insufficient history."
|
||||
required: false
|
||||
|
15
dist/index.js
generated
vendored
15
dist/index.js
generated
vendored
@ -83,7 +83,7 @@ const getRenamedFiles = ({ inputs, workingDirectory, hasSubmodule, shaResult })
|
||||
}));
|
||||
}
|
||||
if (inputs.json) {
|
||||
return (0, utils_1.jsonOutput)({ value: renamedFiles, rawFormat: inputs.jsonRawFormat });
|
||||
return (0, utils_1.jsonOutput)({ value: renamedFiles });
|
||||
}
|
||||
return renamedFiles.join(inputs.oldNewFilesSeparator);
|
||||
});
|
||||
@ -131,7 +131,7 @@ const getDiffFiles = ({ inputs, workingDirectory, hasSubmodule, shaResult, diffF
|
||||
}));
|
||||
}
|
||||
if (inputs.json) {
|
||||
return (0, utils_1.jsonOutput)({ value: files, rawFormat: inputs.jsonRawFormat });
|
||||
return (0, utils_1.jsonOutput)({ value: files });
|
||||
}
|
||||
return files.join(inputs.separator);
|
||||
});
|
||||
@ -633,9 +633,6 @@ const getInputs = () => {
|
||||
required: false
|
||||
});
|
||||
const json = core.getBooleanInput('json', { required: false });
|
||||
const jsonRawFormat = core.getBooleanInput('json_raw_format', {
|
||||
required: false
|
||||
});
|
||||
const fetchDepth = core.getInput('fetch_depth', { required: false });
|
||||
const sinceLastRemoteCommit = core.getBooleanInput('since_last_remote_commit', { required: false });
|
||||
const writeOutputFiles = core.getBooleanInput('write_output_files', {
|
||||
@ -668,7 +665,6 @@ const getInputs = () => {
|
||||
dirNames,
|
||||
dirNamesExcludeRoot,
|
||||
json,
|
||||
jsonRawFormat,
|
||||
sinceLastRemoteCommit,
|
||||
writeOutputFiles,
|
||||
outputDir,
|
||||
@ -1513,13 +1509,8 @@ const getDirnameMaxDepth = ({ pathStr, dirNamesMaxDepth, excludeRoot }) => {
|
||||
return output;
|
||||
};
|
||||
exports.getDirnameMaxDepth = getDirnameMaxDepth;
|
||||
const jsonOutput = ({ value, rawFormat }) => {
|
||||
if (rawFormat) {
|
||||
const jsonOutput = ({ value }) => {
|
||||
return JSON.stringify(value);
|
||||
}
|
||||
else {
|
||||
return JSON.stringify(value, null, 2);
|
||||
}
|
||||
};
|
||||
exports.jsonOutput = jsonOutput;
|
||||
const getFilePatterns = ({ inputs }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
|
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@ -14,7 +14,7 @@
|
||||
"lint:fix": "eslint --fix src/**/*.ts",
|
||||
"package": "ncc build lib/main.js --source-map --license licenses.txt",
|
||||
"test": "jest --coverage",
|
||||
"all": "yarn build && yarn format && yarn lint && yarn package && yarn test"
|
||||
"all": "yarn build && yarn format && yarn lint:fix && yarn lint && yarn package && yarn test"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -73,7 +73,7 @@ export const getRenamedFiles = async ({
|
||||
}
|
||||
|
||||
if (inputs.json) {
|
||||
return jsonOutput({value: renamedFiles, rawFormat: inputs.jsonRawFormat})
|
||||
return jsonOutput({value: renamedFiles})
|
||||
}
|
||||
|
||||
return renamedFiles.join(inputs.oldNewFilesSeparator)
|
||||
@ -146,7 +146,7 @@ export const getDiffFiles = async ({
|
||||
}
|
||||
|
||||
if (inputs.json) {
|
||||
return jsonOutput({value: files, rawFormat: inputs.jsonRawFormat})
|
||||
return jsonOutput({value: files})
|
||||
}
|
||||
|
||||
return files.join(inputs.separator)
|
||||
|
@ -24,7 +24,6 @@ export type Inputs = {
|
||||
dirNamesMaxDepth?: number
|
||||
dirNamesExcludeRoot: boolean
|
||||
json: boolean
|
||||
jsonRawFormat: boolean
|
||||
fetchDepth?: number
|
||||
sinceLastRemoteCommit: boolean
|
||||
writeOutputFiles: boolean
|
||||
@ -95,9 +94,6 @@ export const getInputs = (): Inputs => {
|
||||
required: false
|
||||
})
|
||||
const json = core.getBooleanInput('json', {required: false})
|
||||
const jsonRawFormat = core.getBooleanInput('json_raw_format', {
|
||||
required: false
|
||||
})
|
||||
const fetchDepth = core.getInput('fetch_depth', {required: false})
|
||||
const sinceLastRemoteCommit = core.getBooleanInput(
|
||||
'since_last_remote_commit',
|
||||
@ -134,7 +130,6 @@ export const getInputs = (): Inputs => {
|
||||
dirNames,
|
||||
dirNamesExcludeRoot,
|
||||
json,
|
||||
jsonRawFormat,
|
||||
sinceLastRemoteCommit,
|
||||
writeOutputFiles,
|
||||
outputDir,
|
||||
|
12
src/utils.ts
12
src/utils.ts
@ -650,18 +650,8 @@ export const getDirnameMaxDepth = ({
|
||||
return output
|
||||
}
|
||||
|
||||
export const jsonOutput = ({
|
||||
value,
|
||||
rawFormat
|
||||
}: {
|
||||
value: string | string[]
|
||||
rawFormat: boolean
|
||||
}): string => {
|
||||
if (rawFormat) {
|
||||
export const jsonOutput = ({value}: {value: string | string[]}): string => {
|
||||
return JSON.stringify(value)
|
||||
} else {
|
||||
return JSON.stringify(value, null, 2)
|
||||
}
|
||||
}
|
||||
|
||||
export const getFilePatterns = async ({
|
||||
|
Loading…
x
Reference in New Issue
Block a user