From c557ed066346fa7b3b9ebc013ae1a872190c066c Mon Sep 17 00:00:00 2001 From: Keat Tang Date: Fri, 8 Sep 2023 14:57:05 +1000 Subject: [PATCH] Use normalizeOutputKey in action.js --- src/action.js | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/action.js b/src/action.js index b6fd7c3..d504b1c 100644 --- a/src/action.js +++ b/src/action.js @@ -3,24 +3,12 @@ const core = require('@actions/core'); const command = require('@actions/core/lib/command'); const got = require('got').default; const jsonata = require('jsonata'); +const { normalizeOutputKey } = require('./utils'); + module.exports = {}; const wildcard = '*'; module.exports.wildcard = wildcard; -/** - * Replaces any dot chars to __ and removes non-ascii charts - * @param {string} dataKey - * @param {boolean=} isEnvVar - */ -function normalizeOutputKey(dataKey, isEnvVar = false) { - let outputKey = dataKey - .replace('.', '__').replace(new RegExp('-', 'g'), '').replace(/[^\p{L}\p{N}_-]/gu, ''); - if (isEnvVar) { - outputKey = outputKey.toUpperCase(); - } - return outputKey; -} -module.exports.normalizeOutputKey = normalizeOutputKey; const { auth: { retrieveToken }, secrets: { getSecrets } } = require('./index');