Clone packs from configuration to prevent modifications
This commit is contained in:
parent
7be3a64c02
commit
ba3ac6f096
3 changed files with 14 additions and 7 deletions
8
lib/init-action.js
generated
8
lib/init-action.js
generated
|
|
@ -87,12 +87,14 @@ async function sendCompletedStatusReport(startedAt, config, toolsDownloadDuratio
|
||||||
if ((config.augmentationProperties.packsInputCombines ||
|
if ((config.augmentationProperties.packsInputCombines ||
|
||||||
!config.augmentationProperties.packsInput) &&
|
!config.augmentationProperties.packsInput) &&
|
||||||
config.originalUserInput.packs) {
|
config.originalUserInput.packs) {
|
||||||
|
// Make a copy, because we might modify `packs`.
|
||||||
|
const copyPacksFromOriginalUserInput = (0, util_1.cloneObject)(config.originalUserInput.packs);
|
||||||
// If it is an array, then assume there is only a single language being analyzed.
|
// If it is an array, then assume there is only a single language being analyzed.
|
||||||
if (Array.isArray(config.originalUserInput.packs)) {
|
if (Array.isArray(copyPacksFromOriginalUserInput)) {
|
||||||
packs[config.languages[0]] = config.originalUserInput.packs;
|
packs[config.languages[0]] = copyPacksFromOriginalUserInput;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
packs = config.originalUserInput.packs;
|
packs = copyPacksFromOriginalUserInput;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (config.augmentationProperties.packsInput) {
|
if (config.augmentationProperties.packsInput) {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -60,6 +60,7 @@ import {
|
||||||
ConfigurationError,
|
ConfigurationError,
|
||||||
wrapError,
|
wrapError,
|
||||||
checkActionVersion,
|
checkActionVersion,
|
||||||
|
cloneObject,
|
||||||
} from "./util";
|
} from "./util";
|
||||||
import { validateWorkflow } from "./workflow";
|
import { validateWorkflow } from "./workflow";
|
||||||
|
|
||||||
|
|
@ -187,11 +188,15 @@ async function sendCompletedStatusReport(
|
||||||
!config.augmentationProperties.packsInput) &&
|
!config.augmentationProperties.packsInput) &&
|
||||||
config.originalUserInput.packs
|
config.originalUserInput.packs
|
||||||
) {
|
) {
|
||||||
|
// Make a copy, because we might modify `packs`.
|
||||||
|
const copyPacksFromOriginalUserInput = cloneObject(
|
||||||
|
config.originalUserInput.packs,
|
||||||
|
);
|
||||||
// If it is an array, then assume there is only a single language being analyzed.
|
// If it is an array, then assume there is only a single language being analyzed.
|
||||||
if (Array.isArray(config.originalUserInput.packs)) {
|
if (Array.isArray(copyPacksFromOriginalUserInput)) {
|
||||||
packs[config.languages[0]] = config.originalUserInput.packs;
|
packs[config.languages[0]] = copyPacksFromOriginalUserInput;
|
||||||
} else {
|
} else {
|
||||||
packs = config.originalUserInput.packs;
|
packs = copyPacksFromOriginalUserInput;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue