summaryrefslogtreecommitdiff
path: root/plugins/code-modernization/workflows/harden-scan.js
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/code-modernization/workflows/harden-scan.js')
-rw-r--r--plugins/code-modernization/workflows/harden-scan.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/code-modernization/workflows/harden-scan.js b/plugins/code-modernization/workflows/harden-scan.js
index d068b213..750f63ed 100644
--- a/plugins/code-modernization/workflows/harden-scan.js
+++ b/plugins/code-modernization/workflows/harden-scan.js
@@ -10,7 +10,13 @@ export const meta = {
],
}
-const system = args && args.system
+// `args` may arrive as the caller's raw JSON string rather than the parsed
+// object, depending on the invoking runtime; normalize so both work. A string
+// that is not valid JSON falls through and the requires-args check reports it.
+const ARGS = typeof args === 'string' ? (() => { try { return JSON.parse(args) } catch (e) { return args } })() : args
+
+
+const system = ARGS && ARGS.system
if (!system) {
throw new Error('modernize-harden-scan workflow requires args: {system: "<system-dir>"}')
}