From 3aac35d82a6d091b7f7fc3730dc71591f1c4bb8e Mon Sep 17 00:00:00 2001 From: MuriloChianfa Date: Fri, 8 Dec 2023 16:13:28 -0300 Subject: [PATCH] removing required flag for not required parameters --- .github/workflows/ci.yml | 2 ++ action.yml | 34 +++++++++++++------------- dist/index.js | 42 +++++++++++++------------------- src/inputs/architecture.js | 2 +- src/inputs/binary.js | 2 +- src/inputs/callback.js | 3 +-- src/inputs/check.js | 2 +- src/inputs/comments.js | 4 +-- src/inputs/encoder-version.js | 2 +- src/inputs/encrypt.js | 2 +- src/inputs/license.js | 2 +- src/inputs/loader.js | 4 +-- src/inputs/optimize.js | 2 +- src/inputs/passphrase.js | 2 +- src/inputs/php-target-version.js | 2 +- src/inputs/preamble.js | 3 +-- src/inputs/reflection.js | 6 ++--- src/inputs/template.js | 2 +- src/inputs/trial.js | 2 +- 19 files changed, 53 insertions(+), 67 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e976293..b611061 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,6 +56,8 @@ jobs: uses: ./ with: template: 'php' + source: '' + output: 'encrypted' - name: Print Output id: output diff --git a/action.yml b/action.yml index 18d90c4..e99b7cb 100644 --- a/action.yml +++ b/action.yml @@ -6,12 +6,12 @@ inputs: # Basic inputs trial: description: 'Encode file with trial version of ioncube' - required: true + required: false default: false type: boolean template: description: 'The template to choose the best parameters for type of projects' - required: true + required: false default: laravel type: choice options: @@ -21,7 +21,7 @@ inputs: # Encoder inputs encoder-version: description: 'Ioncube encoder version' - required: true + required: false default: 'current' type: choice options: @@ -30,7 +30,7 @@ inputs: - obsolete php-target-version: description: 'PHP encoded files target version' - required: true + required: false default: '8.2' type: choice options: @@ -39,7 +39,7 @@ inputs: - '8.0' arch: description: 'Architecture of target environment runner' - required: true + required: false default: 64 type: choice options: @@ -61,29 +61,29 @@ inputs: # Reflection API allow-reflection: description: 'Name or glob to funcions or classes for allow the reflection API' - required: true + required: false default: '' type: string allow-reflection-all: description: 'Allow the reflection API at all the PHP code' - required: true + required: false default: false type: boolean # Files customization encrypt: description: 'Name or glob to files to encrypt' - required: true + required: false default: '' type: string binary: description: 'Encode files in binary format' - required: true + required: false default: false type: boolean optimize: description: 'Level of encoding performance' - required: true + required: false default: 'more' type: choice options: @@ -93,29 +93,29 @@ inputs: # Output customizations no-doc-comments: description: 'Not allow doc comments on encoded files' - required: true + required: false default: true type: boolean without-loader-check: description: 'Disable the ioncube loader installation verification' - required: true + required: false default: true type: boolean preamble-file: description: 'File for insert into header of all encoded files' - required: true + required: false default: '' type: string # License options passphrase: description: 'Text to identify and encode the project unically' - required: true + required: false default: '' type: string license-check: description: 'Mode of license validation for encoded files' - required: true + required: false default: 'auto' type: choice options: @@ -123,12 +123,12 @@ inputs: - 'script' with-license: description: 'The license file path at runtime environment' - required: true + required: false default: '' type: string callback-file: description: 'File to validate manually when license is invalid' - required: true + required: false default: '' type: string diff --git a/dist/index.js b/dist/index.js index 038ef54..8dfdb7d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -12412,7 +12412,7 @@ const core = __nccwpck_require__(2186) * @returns {string} Returns a validated arch input. */ module.exports = function validateArchitecture(standard = '64') { - let arch = core.getInput('arch', { required: true }) ?? standard + let arch = core.getInput('arch', { required: false }) ?? standard if (arch === '86') { arch = 'x86' @@ -12438,7 +12438,7 @@ const core = __nccwpck_require__(2186) * @returns {bool|string} Returns a validated binary input. */ module.exports = function validateBinary(standard = false) { - const binary = core.getInput('binary', { required: true }) ?? standard + const binary = core.getInput('binary') ?? standard core.debug( binary === true ? 'Encoding into binary format' @@ -12460,8 +12460,7 @@ const core = __nccwpck_require__(2186) * @returns {bool|string} Returns a validated callback input. */ module.exports = function validateCallback(standard = '') { - const callback = - core.getInput('callback-file', { required: true }) ?? standard + const callback = core.getInput('callback-file') ?? standard core.debug( `Using callback file in runtime path: ${ callback === '' ? 'NONE' : callback @@ -12483,7 +12482,7 @@ const core = __nccwpck_require__(2186) * @returns {bool|string} Returns a validated check input. */ module.exports = function validateCheck(standard = 'auto') { - let check = core.getInput('license-check', { required: true }) ?? standard + let check = core.getInput('license-check') ?? standard if (check === 'auto') { check = 'auto' @@ -12508,9 +12507,7 @@ const core = __nccwpck_require__(2186) * @returns {bool|string} Returns a validated comments input. */ module.exports = function validateComments(standard = true) { - const comments = !( - core.getInput('no-doc-comments', { required: true }) ?? standard - ) + const comments = !(core.getInput('no-doc-comments') ?? standard) core.debug( comments === true ? 'Allowing doc comments' : 'Now allow doc comments' ) @@ -12531,7 +12528,7 @@ const core = __nccwpck_require__(2186) */ module.exports = function validateEncoderVersion(standard = 'current') { let encoderVersion = - core.getInput('encoder-version', { required: true }) ?? standard + core.getInput('encoder-version', { required: false }) ?? standard core.debug(`Using encoder version: ${encoderVersion}`) @@ -12559,7 +12556,7 @@ const core = __nccwpck_require__(2186) * @returns {bool|string} Returns a validated encrypt input. */ module.exports = function validateEncrypt(standard = '') { - const encrypt = core.getInput('encrypt', { required: true }) ?? standard + const encrypt = core.getInput('encrypt') ?? standard core.debug(`Encrypting files: ${encrypt === '' ? 'NONE' : encrypt}`) return encrypt } @@ -12601,7 +12598,7 @@ const core = __nccwpck_require__(2186) * @returns {bool|string} Returns a validated license input. */ module.exports = function validateLicense(standard = '') { - const license = core.getInput('with-license', { required: true }) ?? standard + const license = core.getInput('with-license') ?? standard core.debug( `Using license file in runtime path: ${license === '' ? 'NONE' : license}` ) @@ -12621,9 +12618,7 @@ const core = __nccwpck_require__(2186) * @returns {bool|string} Returns a validated loader input. */ module.exports = function validateLoader(standard = true) { - const loader = !( - core.getInput('without-loader-check', { required: true }) ?? standard - ) + const loader = !(core.getInput('without-loader-check') ?? standard) core.debug( loader === true ? 'Checking for loader in environment' @@ -12645,7 +12640,7 @@ const core = __nccwpck_require__(2186) * @returns {bool|string} Returns a validated optimize input. */ module.exports = function validateOptimize(standard = 'more') { - let optimize = core.getInput('optimize', { required: true }) ?? standard + let optimize = core.getInput('optimize') ?? standard if (optimize === 'more') { optimize = 'more' @@ -12690,7 +12685,7 @@ const core = __nccwpck_require__(2186) * @returns {bool|string} Returns a validated passphrase input. */ module.exports = function validatePassphrase(standard = '') { - const passphrase = core.getInput('passphrase', { required: true }) ?? standard + const passphrase = core.getInput('passphrase') ?? standard core.debug(`Using passphrase: ${passphrase === '' ? 'NONE' : passphrase}`) return passphrase } @@ -12709,7 +12704,7 @@ const core = __nccwpck_require__(2186) */ module.exports = function validatePhpTargetVersion(standard = '8.2') { let phpTargetVersion = - core.getInput('php-target-version', { required: true }) ?? standard + core.getInput('php-target-version', { required: false }) ?? standard core.debug(`Using PHP target version: ${phpTargetVersion}`) @@ -12737,8 +12732,7 @@ const core = __nccwpck_require__(2186) * @returns {bool|string} Returns a validated preamble input. */ module.exports = function validatePreamble(standard = '') { - const preamble = - core.getInput('preamble-file', { required: true }) ?? standard + const preamble = core.getInput('preamble-file') ?? standard core.debug(`Adding preamble file: ${preamble === '' ? 'NONE' : preamble}`) return preamble } @@ -12756,8 +12750,7 @@ const core = __nccwpck_require__(2186) * @returns {bool|string} Returns a validated reflection input. */ module.exports = function validateReflection(standard = false) { - const reflectionAll = - core.getInput('allow-reflection-all', { required: true }) ?? standard + const reflectionAll = core.getInput('allow-reflection-all') ?? standard if (reflectionAll === true) { core.debug('Allowing reflection for all') @@ -12765,8 +12758,7 @@ module.exports = function validateReflection(standard = false) { } const reflection = - core.getInput('allow-reflection', { required: true }) ?? - (standard === false ? '' : standard) + core.getInput('allow-reflection') ?? (standard === false ? '' : standard) core.debug(`Using reflection for: ${reflection === '' ? 'NONE' : reflection}`) return reflection } @@ -12784,7 +12776,7 @@ const core = __nccwpck_require__(2186) * @returns {string} Returns a validated template input. */ module.exports = function validateTemplate() { - const template = core.getInput('template', { required: true }) ?? 'php' + const template = core.getInput('template', { required: false }) ?? 'php' core.debug(`Encoding files using template: ${template}`) // TODO: validate template values @@ -12806,7 +12798,7 @@ const evaluation = __nccwpck_require__(5431) * @returns {Promise} Returns a validated trial input. */ module.exports = async function validateTrial() { - const trial = core.getInput('trial', { required: true }) ?? true + const trial = core.getInput('trial', { required: false }) ?? true if (trial) { return await evaluation() diff --git a/src/inputs/architecture.js b/src/inputs/architecture.js index 215993a..f46b45a 100644 --- a/src/inputs/architecture.js +++ b/src/inputs/architecture.js @@ -5,7 +5,7 @@ const core = require('@actions/core') * @returns {string} Returns a validated arch input. */ module.exports = function validateArchitecture(standard = '64') { - let arch = core.getInput('arch', { required: true }) ?? standard + let arch = core.getInput('arch', { required: false }) ?? standard if (arch === '86') { arch = 'x86' diff --git a/src/inputs/binary.js b/src/inputs/binary.js index e36e403..d322e5d 100644 --- a/src/inputs/binary.js +++ b/src/inputs/binary.js @@ -5,7 +5,7 @@ const core = require('@actions/core') * @returns {bool|string} Returns a validated binary input. */ module.exports = function validateBinary(standard = false) { - const binary = core.getInput('binary', { required: true }) ?? standard + const binary = core.getInput('binary') ?? standard core.debug( binary === true ? 'Encoding into binary format' diff --git a/src/inputs/callback.js b/src/inputs/callback.js index c30a6b8..a4032a4 100644 --- a/src/inputs/callback.js +++ b/src/inputs/callback.js @@ -5,8 +5,7 @@ const core = require('@actions/core') * @returns {bool|string} Returns a validated callback input. */ module.exports = function validateCallback(standard = '') { - const callback = - core.getInput('callback-file', { required: true }) ?? standard + const callback = core.getInput('callback-file') ?? standard core.debug( `Using callback file in runtime path: ${ callback === '' ? 'NONE' : callback diff --git a/src/inputs/check.js b/src/inputs/check.js index 981710a..4da9104 100644 --- a/src/inputs/check.js +++ b/src/inputs/check.js @@ -5,7 +5,7 @@ const core = require('@actions/core') * @returns {bool|string} Returns a validated check input. */ module.exports = function validateCheck(standard = 'auto') { - let check = core.getInput('license-check', { required: true }) ?? standard + let check = core.getInput('license-check') ?? standard if (check === 'auto') { check = 'auto' diff --git a/src/inputs/comments.js b/src/inputs/comments.js index b5e9e13..d8e1ca8 100644 --- a/src/inputs/comments.js +++ b/src/inputs/comments.js @@ -5,9 +5,7 @@ const core = require('@actions/core') * @returns {bool|string} Returns a validated comments input. */ module.exports = function validateComments(standard = true) { - const comments = !( - core.getInput('no-doc-comments', { required: true }) ?? standard - ) + const comments = !(core.getInput('no-doc-comments') ?? standard) core.debug( comments === true ? 'Allowing doc comments' : 'Now allow doc comments' ) diff --git a/src/inputs/encoder-version.js b/src/inputs/encoder-version.js index 8e95c24..d4ed472 100644 --- a/src/inputs/encoder-version.js +++ b/src/inputs/encoder-version.js @@ -6,7 +6,7 @@ const core = require('@actions/core') */ module.exports = function validateEncoderVersion(standard = 'current') { let encoderVersion = - core.getInput('encoder-version', { required: true }) ?? standard + core.getInput('encoder-version', { required: false }) ?? standard core.debug(`Using encoder version: ${encoderVersion}`) diff --git a/src/inputs/encrypt.js b/src/inputs/encrypt.js index 4e82ae0..8416e3f 100644 --- a/src/inputs/encrypt.js +++ b/src/inputs/encrypt.js @@ -5,7 +5,7 @@ const core = require('@actions/core') * @returns {bool|string} Returns a validated encrypt input. */ module.exports = function validateEncrypt(standard = '') { - const encrypt = core.getInput('encrypt', { required: true }) ?? standard + const encrypt = core.getInput('encrypt') ?? standard core.debug(`Encrypting files: ${encrypt === '' ? 'NONE' : encrypt}`) return encrypt } diff --git a/src/inputs/license.js b/src/inputs/license.js index fa172dd..58e48b3 100644 --- a/src/inputs/license.js +++ b/src/inputs/license.js @@ -5,7 +5,7 @@ const core = require('@actions/core') * @returns {bool|string} Returns a validated license input. */ module.exports = function validateLicense(standard = '') { - const license = core.getInput('with-license', { required: true }) ?? standard + const license = core.getInput('with-license') ?? standard core.debug( `Using license file in runtime path: ${license === '' ? 'NONE' : license}` ) diff --git a/src/inputs/loader.js b/src/inputs/loader.js index 96e71c5..bcebb5e 100644 --- a/src/inputs/loader.js +++ b/src/inputs/loader.js @@ -5,9 +5,7 @@ const core = require('@actions/core') * @returns {bool|string} Returns a validated loader input. */ module.exports = function validateLoader(standard = true) { - const loader = !( - core.getInput('without-loader-check', { required: true }) ?? standard - ) + const loader = !(core.getInput('without-loader-check') ?? standard) core.debug( loader === true ? 'Checking for loader in environment' diff --git a/src/inputs/optimize.js b/src/inputs/optimize.js index dc2ff2b..4dc915a 100644 --- a/src/inputs/optimize.js +++ b/src/inputs/optimize.js @@ -5,7 +5,7 @@ const core = require('@actions/core') * @returns {bool|string} Returns a validated optimize input. */ module.exports = function validateOptimize(standard = 'more') { - let optimize = core.getInput('optimize', { required: true }) ?? standard + let optimize = core.getInput('optimize') ?? standard if (optimize === 'more') { optimize = 'more' diff --git a/src/inputs/passphrase.js b/src/inputs/passphrase.js index 3eb459f..952e975 100644 --- a/src/inputs/passphrase.js +++ b/src/inputs/passphrase.js @@ -5,7 +5,7 @@ const core = require('@actions/core') * @returns {bool|string} Returns a validated passphrase input. */ module.exports = function validatePassphrase(standard = '') { - const passphrase = core.getInput('passphrase', { required: true }) ?? standard + const passphrase = core.getInput('passphrase') ?? standard core.debug(`Using passphrase: ${passphrase === '' ? 'NONE' : passphrase}`) return passphrase } diff --git a/src/inputs/php-target-version.js b/src/inputs/php-target-version.js index 7586f33..863a2e2 100644 --- a/src/inputs/php-target-version.js +++ b/src/inputs/php-target-version.js @@ -6,7 +6,7 @@ const core = require('@actions/core') */ module.exports = function validatePhpTargetVersion(standard = '8.2') { let phpTargetVersion = - core.getInput('php-target-version', { required: true }) ?? standard + core.getInput('php-target-version', { required: false }) ?? standard core.debug(`Using PHP target version: ${phpTargetVersion}`) diff --git a/src/inputs/preamble.js b/src/inputs/preamble.js index 423292c..bd44b5e 100644 --- a/src/inputs/preamble.js +++ b/src/inputs/preamble.js @@ -5,8 +5,7 @@ const core = require('@actions/core') * @returns {bool|string} Returns a validated preamble input. */ module.exports = function validatePreamble(standard = '') { - const preamble = - core.getInput('preamble-file', { required: true }) ?? standard + const preamble = core.getInput('preamble-file') ?? standard core.debug(`Adding preamble file: ${preamble === '' ? 'NONE' : preamble}`) return preamble } diff --git a/src/inputs/reflection.js b/src/inputs/reflection.js index cae75f9..5df5bdd 100644 --- a/src/inputs/reflection.js +++ b/src/inputs/reflection.js @@ -5,8 +5,7 @@ const core = require('@actions/core') * @returns {bool|string} Returns a validated reflection input. */ module.exports = function validateReflection(standard = false) { - const reflectionAll = - core.getInput('allow-reflection-all', { required: true }) ?? standard + const reflectionAll = core.getInput('allow-reflection-all') ?? standard if (reflectionAll === true) { core.debug('Allowing reflection for all') @@ -14,8 +13,7 @@ module.exports = function validateReflection(standard = false) { } const reflection = - core.getInput('allow-reflection', { required: true }) ?? - (standard === false ? '' : standard) + core.getInput('allow-reflection') ?? (standard === false ? '' : standard) core.debug(`Using reflection for: ${reflection === '' ? 'NONE' : reflection}`) return reflection } diff --git a/src/inputs/template.js b/src/inputs/template.js index a7da000..b2465a7 100644 --- a/src/inputs/template.js +++ b/src/inputs/template.js @@ -5,7 +5,7 @@ const core = require('@actions/core') * @returns {string} Returns a validated template input. */ module.exports = function validateTemplate() { - const template = core.getInput('template', { required: true }) ?? 'php' + const template = core.getInput('template', { required: false }) ?? 'php' core.debug(`Encoding files using template: ${template}`) // TODO: validate template values diff --git a/src/inputs/trial.js b/src/inputs/trial.js index a48273b..ba01214 100644 --- a/src/inputs/trial.js +++ b/src/inputs/trial.js @@ -6,7 +6,7 @@ const evaluation = require('../evaluation') * @returns {Promise} Returns a validated trial input. */ module.exports = async function validateTrial() { - const trial = core.getInput('trial', { required: true }) ?? true + const trial = core.getInput('trial', { required: false }) ?? true if (trial) { return await evaluation()