From 2db24fa1c6f86eaf071d387bfd88d4c0097a01a1 Mon Sep 17 00:00:00 2001 From: Jamie Briers Date: Mon, 22 Mar 2021 11:25:52 +0000 Subject: [PATCH 1/9] take a version --- index.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 66f3b4f..6c30c10 100644 --- a/index.js +++ b/index.js @@ -2,16 +2,17 @@ const core = require('@actions/core') const exec = require('child_process').exec try { - installPMD() + let version = core.getInput('pmd-version'); + installPMD(version) } catch (error) { core.setFailed(error.message) } -function installPMD(){ - var download = 'wget https://github.com/pmd/pmd/releases/download/pmd_releases%2F6.19.0/pmd-bin-6.19.0.zip -P /tmp' - var unzip = 'unzip /tmp/pmd-bin-6.19.0.zip -d /tmp' +function installPMD(version){ + var download = `wget https://github.com/pmd/pmd/releases/download/pmd_releases%2F${version}/pmd-bin-${version}.zip -P /tmp -O pmd.zip` + var unzip = 'unzip /tmp/pmd.zip -d /tmp' var mk = 'mkdir $HOME/pmd' - var mv = 'mv /tmp/pmd-bin-6.19.0/* $HOME/pmd' + var mv = 'mv /tmp/pmd/* $HOME/pmd' exec(download+' && '+unzip+' && '+mk+' && '+mv, function(error, stdout, stderr){ if(error) core.setFailed(stderr) core.debug(stdout) From 3ae450ee4373ceb4366ce64fe3a6deef576b1655 Mon Sep 17 00:00:00 2001 From: Jamie Briers Date: Mon, 22 Mar 2021 11:26:02 +0000 Subject: [PATCH 2/9] remove node-modules --- node_modules/@actions/core/README.md | 140 ------------- node_modules/@actions/core/lib/command.d.ts | 16 -- node_modules/@actions/core/lib/command.js | 66 ------ node_modules/@actions/core/lib/command.js.map | 1 - node_modules/@actions/core/lib/core.d.ts | 112 ---------- node_modules/@actions/core/lib/core.js | 195 ------------------ node_modules/@actions/core/lib/core.js.map | 1 - node_modules/@actions/core/package.json | 64 ------ 8 files changed, 595 deletions(-) delete mode 100644 node_modules/@actions/core/README.md delete mode 100644 node_modules/@actions/core/lib/command.d.ts delete mode 100644 node_modules/@actions/core/lib/command.js delete mode 100644 node_modules/@actions/core/lib/command.js.map delete mode 100644 node_modules/@actions/core/lib/core.d.ts delete mode 100644 node_modules/@actions/core/lib/core.js delete mode 100644 node_modules/@actions/core/lib/core.js.map delete mode 100644 node_modules/@actions/core/package.json diff --git a/node_modules/@actions/core/README.md b/node_modules/@actions/core/README.md deleted file mode 100644 index 40649f1..0000000 --- a/node_modules/@actions/core/README.md +++ /dev/null @@ -1,140 +0,0 @@ -# `@actions/core` - -> Core functions for setting results, logging, registering secrets and exporting variables across actions - -## Usage - -### Import the package - -```js -// javascript -const core = require('@actions/core'); - -// typescript -import * as core from '@actions/core'; -``` - -#### Inputs/Outputs - -Action inputs can be read with `getInput`. Outputs can be set with `setOutput` which makes them available to be mapped into inputs of other actions to ensure they are decoupled. - -```js -const myInput = core.getInput('inputName', { required: true }); - -core.setOutput('outputKey', 'outputVal'); -``` - -#### Exporting variables - -Since each step runs in a separate process, you can use `exportVariable` to add it to this step and future steps environment blocks. - -```js -core.exportVariable('envVar', 'Val'); -``` - -#### Setting a secret - -Setting a secret registers the secret with the runner to ensure it is masked in logs. - -```js -core.setSecret('myPassword'); -``` - -#### PATH Manipulation - -To make a tool's path available in the path for the remainder of the job (without altering the machine or containers state), use `addPath`. The runner will prepend the path given to the jobs PATH. - -```js -core.addPath('/path/to/mytool'); -``` - -#### Exit codes - -You should use this library to set the failing exit code for your action. If status is not set and the script runs to completion, that will lead to a success. - -```js -const core = require('@actions/core'); - -try { - // Do stuff -} -catch (err) { - // setFailed logs the message and sets a failing exit code - core.setFailed(`Action failed with error ${err}`); -} - -Note that `setNeutral` is not yet implemented in actions V2 but equivalent functionality is being planned. - -``` - -#### Logging - -Finally, this library provides some utilities for logging. Note that debug logging is hidden from the logs by default. This behavior can be toggled by enabling the [Step Debug Logs](../../docs/action-debugging.md#step-debug-logs). - -```js -const core = require('@actions/core'); - -const myInput = core.getInput('input'); -try { - core.debug('Inside try block'); - - if (!myInput) { - core.warning('myInput was not set'); - } - - // Do stuff -} -catch (err) { - core.error(`Error ${err}, action may still succeed though`); -} -``` - -This library can also wrap chunks of output in foldable groups. - -```js -const core = require('@actions/core') - -// Manually wrap output -core.startGroup('Do some function') -doSomeFunction() -core.endGroup() - -// Wrap an asynchronous function call -const result = await core.group('Do something async', async () => { - const response = await doSomeHTTPRequest() - return response -}) -``` - -#### Action state - -You can use this library to save state and get state for sharing information between a given wrapper action: - -**action.yml** -```yaml -name: 'Wrapper action sample' -inputs: - name: - default: 'GitHub' -runs: - using: 'node12' - main: 'main.js' - post: 'cleanup.js' -``` - -In action's `main.js`: - -```js -const core = require('@actions/core'); - -core.saveState("pidToKill", 12345); -``` - -In action's `cleanup.js`: -```js -const core = require('@actions/core'); - -var pid = core.getState("pidToKill"); - -process.kill(pid); -``` \ No newline at end of file diff --git a/node_modules/@actions/core/lib/command.d.ts b/node_modules/@actions/core/lib/command.d.ts deleted file mode 100644 index 7cdfb74..0000000 --- a/node_modules/@actions/core/lib/command.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -interface CommandProperties { - [key: string]: string; -} -/** - * Commands - * - * Command Format: - * ##[name key=value;key=value]message - * - * Examples: - * ##[warning]This is the user warning message - * ##[set-secret name=mypassword]definitelyNotAPassword! - */ -export declare function issueCommand(command: string, properties: CommandProperties, message: string): void; -export declare function issue(name: string, message?: string): void; -export {}; diff --git a/node_modules/@actions/core/lib/command.js b/node_modules/@actions/core/lib/command.js deleted file mode 100644 index afad2f6..0000000 --- a/node_modules/@actions/core/lib/command.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const os = require("os"); -/** - * Commands - * - * Command Format: - * ##[name key=value;key=value]message - * - * Examples: - * ##[warning]This is the user warning message - * ##[set-secret name=mypassword]definitelyNotAPassword! - */ -function issueCommand(command, properties, message) { - const cmd = new Command(command, properties, message); - process.stdout.write(cmd.toString() + os.EOL); -} -exports.issueCommand = issueCommand; -function issue(name, message = '') { - issueCommand(name, {}, message); -} -exports.issue = issue; -const CMD_STRING = '::'; -class Command { - constructor(command, properties, message) { - if (!command) { - command = 'missing.command'; - } - this.command = command; - this.properties = properties; - this.message = message; - } - toString() { - let cmdStr = CMD_STRING + this.command; - if (this.properties && Object.keys(this.properties).length > 0) { - cmdStr += ' '; - for (const key in this.properties) { - if (this.properties.hasOwnProperty(key)) { - const val = this.properties[key]; - if (val) { - // safely append the val - avoid blowing up when attempting to - // call .replace() if message is not a string for some reason - cmdStr += `${key}=${escape(`${val || ''}`)},`; - } - } - } - } - cmdStr += CMD_STRING; - // safely append the message - avoid blowing up when attempting to - // call .replace() if message is not a string for some reason - const message = `${this.message || ''}`; - cmdStr += escapeData(message); - return cmdStr; - } -} -function escapeData(s) { - return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A'); -} -function escape(s) { - return s - .replace(/\r/g, '%0D') - .replace(/\n/g, '%0A') - .replace(/]/g, '%5D') - .replace(/;/g, '%3B'); -} -//# sourceMappingURL=command.js.map \ No newline at end of file diff --git a/node_modules/@actions/core/lib/command.js.map b/node_modules/@actions/core/lib/command.js.map deleted file mode 100644 index 918ab25..0000000 --- a/node_modules/@actions/core/lib/command.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;AAAA,yBAAwB;AAQxB;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAe;IAEf,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,UAAkB,EAAE;IACtD,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,C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CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AACtD,CAAC;AAED,SAAS,MAAM,CAAC,CAAS;IACvB,OAAO,CAAC;SACL,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"} \ No newline at end of file diff --git a/node_modules/@actions/core/lib/core.d.ts b/node_modules/@actions/core/lib/core.d.ts deleted file mode 100644 index 2bd238d..0000000 --- a/node_modules/@actions/core/lib/core.d.ts +++ /dev/null @@ -1,112 +0,0 @@ -/** - * Interface for getInput options - */ -export interface InputOptions { - /** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */ - required?: boolean; -} -/** - * The code to exit an action - */ -export declare enum ExitCode { - /** - * A code indicating that the action was successful - */ - Success = 0, - /** - * A code indicating that the action was a failure - */ - Failure = 1 -} -/** - * Sets env variable for this action and future actions in the job - * @param name the name of the variable to set - * @param val the value of the variable - */ -export declare function exportVariable(name: string, val: string): void; -/** - * Registers a secret which will get masked from logs - * @param secret value of the secret - */ -export declare function setSecret(secret: string): void; -/** - * Prepends inputPath to the PATH (for this action and future actions) - * @param inputPath - */ -export declare function addPath(inputPath: string): void; -/** - * Gets the value of an input. The value is also trimmed. - * - * @param name name of the input to get - * @param options optional. See InputOptions. - * @returns string - */ -export declare function getInput(name: string, options?: InputOptions): string; -/** - * Sets the value of an output. - * - * @param name name of the output to set - * @param value value to store - */ -export declare function setOutput(name: string, value: string): void; -/** - * Sets the action status to failed. - * When the action exits it will be with an exit code of 1 - * @param message add error issue message - */ -export declare function setFailed(message: string): void; -/** - * Writes debug message to user log - * @param message debug message - */ -export declare function debug(message: string): void; -/** - * Adds an error issue - * @param message error issue message - */ -export declare function error(message: string): void; -/** - * Adds an warning issue - * @param message warning issue message - */ -export declare function warning(message: string): void; -/** - * Writes info to log with console.log. - * @param message info message - */ -export declare function info(message: string): void; -/** - * Begin an output group. - * - * Output until the next `groupEnd` will be foldable in this group - * - * @param name The name of the output group - */ -export declare function startGroup(name: string): void; -/** - * End an output group. - */ -export declare function endGroup(): void; -/** - * Wrap an asynchronous function call in a group. - * - * Returns the same type as the function itself. - * - * @param name The name of the group - * @param fn The function to wrap in the group - */ -export declare function group(name: string, fn: () => Promise): Promise; -/** - * Saves state for current action, the state can only be retrieved by this action's post job execution. - * - * @param name name of the state to store - * @param value value to store - */ -export declare function saveState(name: string, value: string): void; -/** - * Gets the value of an state set by this action's main execution. - * - * @param name name of the state to get - * @returns string - */ -export declare function getState(name: string): string; diff --git a/node_modules/@actions/core/lib/core.js b/node_modules/@actions/core/lib/core.js deleted file mode 100644 index 9d08e3f..0000000 --- a/node_modules/@actions/core/lib/core.js +++ /dev/null @@ -1,195 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const command_1 = require("./command"); -const os = require("os"); -const path = require("path"); -/** - * The code to exit an action - */ -var ExitCode; -(function (ExitCode) { - /** - * A code indicating that the action was successful - */ - ExitCode[ExitCode["Success"] = 0] = "Success"; - /** - * A code indicating that the action was a failure - */ - ExitCode[ExitCode["Failure"] = 1] = "Failure"; -})(ExitCode = exports.ExitCode || (exports.ExitCode = {})); -//----------------------------------------------------------------------- -// Variables -//----------------------------------------------------------------------- -/** - * Sets env variable for this action and future actions in the job - * @param name the name of the variable to set - * @param val the value of the variable - */ -function exportVariable(name, val) { - process.env[name] = val; - command_1.issueCommand('set-env', { name }, val); -} -exports.exportVariable = exportVariable; -/** - * Registers a secret which will get masked from logs - * @param secret value of the secret - */ -function setSecret(secret) { - command_1.issueCommand('add-mask', {}, secret); -} -exports.setSecret = setSecret; -/** - * Prepends inputPath to the PATH (for this action and future actions) - * @param inputPath - */ -function addPath(inputPath) { - command_1.issueCommand('add-path', {}, inputPath); - process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; -} -exports.addPath = addPath; -/** - * Gets the value of an input. The value is also trimmed. - * - * @param name name of the input to get - * @param options optional. See InputOptions. - * @returns string - */ -function getInput(name, options) { - const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || ''; - if (options && options.required && !val) { - throw new Error(`Input required and not supplied: ${name}`); - } - return val.trim(); -} -exports.getInput = getInput; -/** - * Sets the value of an output. - * - * @param name name of the output to set - * @param value value to store - */ -function setOutput(name, value) { - command_1.issueCommand('set-output', { name }, value); -} -exports.setOutput = setOutput; -//----------------------------------------------------------------------- -// Results -//----------------------------------------------------------------------- -/** - * Sets the action status to failed. - * When the action exits it will be with an exit code of 1 - * @param message add error issue message - */ -function setFailed(message) { - process.exitCode = ExitCode.Failure; - error(message); -} -exports.setFailed = setFailed; -//----------------------------------------------------------------------- -// Logging Commands -//----------------------------------------------------------------------- -/** - * Writes debug message to user log - * @param message debug message - */ -function debug(message) { - command_1.issueCommand('debug', {}, message); -} -exports.debug = debug; -/** - * Adds an error issue - * @param message error issue message - */ -function error(message) { - command_1.issue('error', message); -} -exports.error = error; -/** - * Adds an warning issue - * @param message warning issue message - */ -function warning(message) { - command_1.issue('warning', message); -} -exports.warning = warning; -/** - * Writes info to log with console.log. - * @param message info message - */ -function info(message) { - process.stdout.write(message + os.EOL); -} -exports.info = info; -/** - * Begin an output group. - * - * Output until the next `groupEnd` will be foldable in this group - * - * @param name The name of the output group - */ -function startGroup(name) { - command_1.issue('group', name); -} -exports.startGroup = startGroup; -/** - * End an output group. - */ -function endGroup() { - command_1.issue('endgroup'); -} -exports.endGroup = endGroup; -/** - * Wrap an asynchronous function call in a group. - * - * Returns the same type as the function itself. - * - * @param name The name of the group - * @param fn The function to wrap in the group - */ -function group(name, fn) { - return __awaiter(this, void 0, void 0, function* () { - startGroup(name); - let result; - try { - result = yield fn(); - } - finally { - endGroup(); - } - return result; - }); -} -exports.group = group; -//----------------------------------------------------------------------- -// Wrapper action state -//----------------------------------------------------------------------- -/** - * Saves state for current action, the state can only be retrieved by this action's post job execution. - * - * @param name name of the state to store - * @param value value to store - */ -function saveState(name, value) { - command_1.issueCommand('save-state', { name }, value); -} -exports.saveState = saveState; -/** - * Gets the value of an state set by this action's main execution. - * - * @param name name of the state to get - * @returns string - */ -function getState(name) { - return process.env[`STATE_${name}`] || ''; -} -exports.getState = getState; -//# sourceMappingURL=core.js.map \ No newline at end of file diff --git a/node_modules/@actions/core/lib/core.js.map b/node_modules/@actions/core/lib/core.js.map deleted file mode 100644 index 6eda8da..0000000 --- a/node_modules/@actions/core/lib/core.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uCAA6C;AAE7C,yBAAwB;AACxB,6BAA4B;AAU5B;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;AACb,CAAC,EAVW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAUnB;AAED,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAW;IACtD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;IACvB,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,GAAG,CAAC,CAAA;AACtC,CAAC;AAHD,wCAGC;AAED;;;GAG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nC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,EAAE,CAAA;AAC3C,CAAC;AAFD,4BAEC"} \ No newline at end of file diff --git a/node_modules/@actions/core/package.json b/node_modules/@actions/core/package.json deleted file mode 100644 index e24efdd..0000000 --- a/node_modules/@actions/core/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "_from": "@actions/core@^1.2.0", - "_id": "@actions/core@1.2.0", - "_inBundle": false, - "_integrity": "sha512-ZKdyhlSlyz38S6YFfPnyNgCDZuAF2T0Qv5eHflNWytPS8Qjvz39bZFMry9Bb/dpSnqWcNeav5yM2CTYpJeY+Dw==", - "_location": "/@actions/core", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "@actions/core@^1.2.0", - "name": "@actions/core", - "escapedName": "@actions%2fcore", - "scope": "@actions", - "rawSpec": "^1.2.0", - "saveSpec": null, - "fetchSpec": "^1.2.0" - }, - "_requiredBy": [ - "/" - ], - "_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.0.tgz", - "_shasum": "aa5f52b26c362c821d41557e599371a42f6c0b3d", - "_spec": "@actions/core@^1.2.0", - "_where": "C:\\Users\\Felipe\\Dropbox\\workspace\\cli", - "bugs": { - "url": "https://github.com/actions/toolkit/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Actions core lib", - "devDependencies": { - "@types/node": "^12.0.2" - }, - "directories": { - "lib": "lib", - "test": "__tests__" - }, - "files": [ - "lib" - ], - "homepage": "https://github.com/actions/toolkit/tree/master/packages/core", - "keywords": [ - "github", - "actions", - "core" - ], - "license": "MIT", - "main": "lib/core.js", - "name": "@actions/core", - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/actions/toolkit.git", - "directory": "packages/core" - }, - "scripts": { - "test": "echo \"Error: run tests from root\" && exit 1", - "tsc": "tsc" - }, - "version": "1.2.0" -} From 136254ac168986a852b66777d28d0de53ff9c14e Mon Sep 17 00:00:00 2001 From: Jamie Briers Date: Mon, 22 Mar 2021 11:33:58 +0000 Subject: [PATCH 3/9] update action.yml --- action.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/action.yml b/action.yml index 476541a..7d7fdd0 100644 --- a/action.yml +++ b/action.yml @@ -1,9 +1,13 @@ -name: 'PMD Source Code Analyzer Action' +name: "PMD Source Code Analyzer Action" author: Felipe Echanique Torres -description: 'This action allows to use PMD Source Code Analyzer from GitHub Actions' +description: "This action allows to use PMD Source Code Analyzer from GitHub Actions" +inputs: + pmd-version: + description: "Version of PMD to download from https://github.com/pmd/pmd/releases i.e. 6.32.0" + required: true runs: - using: 'node12' - main: 'index.js' + using: "node12" + main: "index.js" branding: - icon: 'award' - color: 'red' + icon: "award" + color: "red" From d9f723f8a28d58abbd516b18855c60026880df11 Mon Sep 17 00:00:00 2001 From: Jamie Briers Date: Mon, 22 Mar 2021 11:43:11 +0000 Subject: [PATCH 4/9] pack --- action.yml | 2 +- dist/index.js | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 dist/index.js diff --git a/action.yml b/action.yml index 7d7fdd0..a5a1d74 100644 --- a/action.yml +++ b/action.yml @@ -7,7 +7,7 @@ inputs: required: true runs: using: "node12" - main: "index.js" + main: "dist/index.js" branding: icon: "award" color: "red" diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..45cd492 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,101 @@ +module.exports = +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ 690: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __nccwpck_require__) => { + +const core = __nccwpck_require__(389) +const exec = __nccwpck_require__(129).exec + +try { + let version = core.getInput('pmd-version'); + installPMD(version) +} catch (error) { + core.setFailed(error.message) +} + +function installPMD(version){ + var download = `wget https://github.com/pmd/pmd/releases/download/pmd_releases%2F${version}/pmd-bin-${version}.zip -P /tmp -O pmd.zip` + var unzip = 'unzip /tmp/pmd.zip -d /tmp' + var mk = 'mkdir $HOME/pmd' + var mv = 'mv /tmp/pmd/* $HOME/pmd' + exec(download+' && '+unzip+' && '+mk+' && '+mv, function(error, stdout, stderr){ + if(error) core.setFailed(stderr) + core.debug(stdout) + referencePMD() + }) +} + +function referencePMD(){ + var mk = 'sudo mkdir -p /snap/bin && sudo chmod -R 757 /snap/bin' + var cmd = +`sudo echo '#! /bin/bash +$HOME/pmd/bin/run.sh pmd "$@"' > /snap/bin/pmd` + var cm = 'chmod +x /snap/bin/pmd' + exec(mk+' && '+cmd+' && '+cm, function(error, stdout, stderr){ + if(error) core.setFailed(stderr) + core.debug(stdout) + }) +} + + +/***/ }), + +/***/ 389: +/***/ ((module) => { + +module.exports = eval("require")("@actions/core"); + + +/***/ }), + +/***/ 129: +/***/ ((module) => { + +"use strict"; +module.exports = require("child_process");; + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __nccwpck_require__(moduleId) { +/******/ // Check if module is in cache +/******/ if(__webpack_module_cache__[moduleId]) { +/******/ return __webpack_module_cache__[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ var threw = true; +/******/ try { +/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); +/******/ threw = false; +/******/ } finally { +/******/ if(threw) delete __webpack_module_cache__[moduleId]; +/******/ } +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat */ +/******/ +/******/ __nccwpck_require__.ab = __dirname + "/";/************************************************************************/ +/******/ // module exports must be returned from runtime so entry inlining is disabled +/******/ // startup +/******/ // Load entry module and return exports +/******/ return __nccwpck_require__(690); +/******/ })() +; \ No newline at end of file From 408325734a21b37ab6872df94f37c77130b008a6 Mon Sep 17 00:00:00 2001 From: Jamie Briers Date: Mon, 22 Mar 2021 11:45:51 +0000 Subject: [PATCH 5/9] repack --- .gitignore | 1 + dist/index.js | 293 +++++++++++++++++++++++++++++++++++++++++++++- package-lock.json | 2 +- 3 files changed, 290 insertions(+), 6 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/dist/index.js b/dist/index.js index 45cd492..48783f4 100644 --- a/dist/index.js +++ b/dist/index.js @@ -5,7 +5,7 @@ module.exports = /***/ 690: /***/ ((__unused_webpack_module, __unused_webpack_exports, __nccwpck_require__) => { -const core = __nccwpck_require__(389) +const core = __nccwpck_require__(722) const exec = __nccwpck_require__(129).exec try { @@ -42,11 +42,278 @@ $HOME/pmd/bin/run.sh pmd "$@"' > /snap/bin/pmd` /***/ }), -/***/ 389: -/***/ ((module) => { +/***/ 140: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +const os = __nccwpck_require__(87); +/** + * Commands + * + * Command Format: + * ##[name key=value;key=value]message + * + * Examples: + * ##[warning]This is the user warning message + * ##[set-secret name=mypassword]definitelyNotAPassword! + */ +function issueCommand(command, properties, message) { + const cmd = new Command(command, properties, message); + process.stdout.write(cmd.toString() + os.EOL); +} +exports.issueCommand = issueCommand; +function issue(name, message = '') { + issueCommand(name, {}, message); +} +exports.issue = issue; +const CMD_STRING = '::'; +class Command { + constructor(command, properties, message) { + if (!command) { + command = 'missing.command'; + } + this.command = command; + this.properties = properties; + this.message = message; + } + toString() { + let cmdStr = CMD_STRING + this.command; + if (this.properties && Object.keys(this.properties).length > 0) { + cmdStr += ' '; + for (const key in this.properties) { + if (this.properties.hasOwnProperty(key)) { + const val = this.properties[key]; + if (val) { + // safely append the val - avoid blowing up when attempting to + // call .replace() if message is not a string for some reason + cmdStr += `${key}=${escape(`${val || ''}`)},`; + } + } + } + } + cmdStr += CMD_STRING; + // safely append the message - avoid blowing up when attempting to + // call .replace() if message is not a string for some reason + const message = `${this.message || ''}`; + cmdStr += escapeData(message); + return cmdStr; + } +} +function escapeData(s) { + return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A'); +} +function escape(s) { + return s + .replace(/\r/g, '%0D') + .replace(/\n/g, '%0A') + .replace(/]/g, '%5D') + .replace(/;/g, '%3B'); +} +//# sourceMappingURL=command.js.map + +/***/ }), + +/***/ 722: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { -module.exports = eval("require")("@actions/core"); +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const command_1 = __nccwpck_require__(140); +const os = __nccwpck_require__(87); +const path = __nccwpck_require__(622); +/** + * The code to exit an action + */ +var ExitCode; +(function (ExitCode) { + /** + * A code indicating that the action was successful + */ + ExitCode[ExitCode["Success"] = 0] = "Success"; + /** + * A code indicating that the action was a failure + */ + ExitCode[ExitCode["Failure"] = 1] = "Failure"; +})(ExitCode = exports.ExitCode || (exports.ExitCode = {})); +//----------------------------------------------------------------------- +// Variables +//----------------------------------------------------------------------- +/** + * Sets env variable for this action and future actions in the job + * @param name the name of the variable to set + * @param val the value of the variable + */ +function exportVariable(name, val) { + process.env[name] = val; + command_1.issueCommand('set-env', { name }, val); +} +exports.exportVariable = exportVariable; +/** + * Registers a secret which will get masked from logs + * @param secret value of the secret + */ +function setSecret(secret) { + command_1.issueCommand('add-mask', {}, secret); +} +exports.setSecret = setSecret; +/** + * Prepends inputPath to the PATH (for this action and future actions) + * @param inputPath + */ +function addPath(inputPath) { + command_1.issueCommand('add-path', {}, inputPath); + process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; +} +exports.addPath = addPath; +/** + * Gets the value of an input. The value is also trimmed. + * + * @param name name of the input to get + * @param options optional. See InputOptions. + * @returns string + */ +function getInput(name, options) { + const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || ''; + if (options && options.required && !val) { + throw new Error(`Input required and not supplied: ${name}`); + } + return val.trim(); +} +exports.getInput = getInput; +/** + * Sets the value of an output. + * + * @param name name of the output to set + * @param value value to store + */ +function setOutput(name, value) { + command_1.issueCommand('set-output', { name }, value); +} +exports.setOutput = setOutput; +//----------------------------------------------------------------------- +// Results +//----------------------------------------------------------------------- +/** + * Sets the action status to failed. + * When the action exits it will be with an exit code of 1 + * @param message add error issue message + */ +function setFailed(message) { + process.exitCode = ExitCode.Failure; + error(message); +} +exports.setFailed = setFailed; +//----------------------------------------------------------------------- +// Logging Commands +//----------------------------------------------------------------------- +/** + * Writes debug message to user log + * @param message debug message + */ +function debug(message) { + command_1.issueCommand('debug', {}, message); +} +exports.debug = debug; +/** + * Adds an error issue + * @param message error issue message + */ +function error(message) { + command_1.issue('error', message); +} +exports.error = error; +/** + * Adds an warning issue + * @param message warning issue message + */ +function warning(message) { + command_1.issue('warning', message); +} +exports.warning = warning; +/** + * Writes info to log with console.log. + * @param message info message + */ +function info(message) { + process.stdout.write(message + os.EOL); +} +exports.info = info; +/** + * Begin an output group. + * + * Output until the next `groupEnd` will be foldable in this group + * + * @param name The name of the output group + */ +function startGroup(name) { + command_1.issue('group', name); +} +exports.startGroup = startGroup; +/** + * End an output group. + */ +function endGroup() { + command_1.issue('endgroup'); +} +exports.endGroup = endGroup; +/** + * Wrap an asynchronous function call in a group. + * + * Returns the same type as the function itself. + * + * @param name The name of the group + * @param fn The function to wrap in the group + */ +function group(name, fn) { + return __awaiter(this, void 0, void 0, function* () { + startGroup(name); + let result; + try { + result = yield fn(); + } + finally { + endGroup(); + } + return result; + }); +} +exports.group = group; +//----------------------------------------------------------------------- +// Wrapper action state +//----------------------------------------------------------------------- +/** + * Saves state for current action, the state can only be retrieved by this action's post job execution. + * + * @param name name of the state to store + * @param value value to store + */ +function saveState(name, value) { + command_1.issueCommand('save-state', { name }, value); +} +exports.saveState = saveState; +/** + * Gets the value of an state set by this action's main execution. + * + * @param name name of the state to get + * @returns string + */ +function getState(name) { + return process.env[`STATE_${name}`] || ''; +} +exports.getState = getState; +//# sourceMappingURL=core.js.map /***/ }), @@ -56,6 +323,22 @@ module.exports = eval("require")("@actions/core"); "use strict"; module.exports = require("child_process");; +/***/ }), + +/***/ 87: +/***/ ((module) => { + +"use strict"; +module.exports = require("os");; + +/***/ }), + +/***/ 622: +/***/ ((module) => { + +"use strict"; +module.exports = require("path");; + /***/ }) /******/ }); @@ -79,7 +362,7 @@ module.exports = require("child_process");; /******/ // Execute the module function /******/ var threw = true; /******/ try { -/******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__); +/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nccwpck_require__); /******/ threw = false; /******/ } finally { /******/ if(threw) delete __webpack_module_cache__[moduleId]; diff --git a/package-lock.json b/package-lock.json index dfcbd68..90c3422 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "setup-pmd-action", - "version": "1.0.0", + "version": "1.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { From a80e16640ca3f4387971ec3bde0beaa0b2ff9944 Mon Sep 17 00:00:00 2001 From: Jamie Briers Date: Mon, 22 Mar 2021 11:57:49 +0000 Subject: [PATCH 6/9] update wget command --- dist/index.js | 18 +++++++++--------- index.js | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/dist/index.js b/dist/index.js index 48783f4..ad20207 100644 --- a/dist/index.js +++ b/dist/index.js @@ -15,26 +15,26 @@ try { core.setFailed(error.message) } -function installPMD(version){ - var download = `wget https://github.com/pmd/pmd/releases/download/pmd_releases%2F${version}/pmd-bin-${version}.zip -P /tmp -O pmd.zip` +function installPMD(version) { + var download = `wget https://github.com/pmd/pmd/releases/download/pmd_releases%2F${version}/pmd-bin-${version}.zip -O /tmp/pmd.zip` var unzip = 'unzip /tmp/pmd.zip -d /tmp' var mk = 'mkdir $HOME/pmd' var mv = 'mv /tmp/pmd/* $HOME/pmd' - exec(download+' && '+unzip+' && '+mk+' && '+mv, function(error, stdout, stderr){ - if(error) core.setFailed(stderr) + exec(download + ' && ' + unzip + ' && ' + mk + ' && ' + mv, function (error, stdout, stderr) { + if (error) core.setFailed(stderr) core.debug(stdout) referencePMD() }) } -function referencePMD(){ +function referencePMD() { var mk = 'sudo mkdir -p /snap/bin && sudo chmod -R 757 /snap/bin' - var cmd = -`sudo echo '#! /bin/bash + var cmd = + `sudo echo '#! /bin/bash $HOME/pmd/bin/run.sh pmd "$@"' > /snap/bin/pmd` var cm = 'chmod +x /snap/bin/pmd' - exec(mk+' && '+cmd+' && '+cm, function(error, stdout, stderr){ - if(error) core.setFailed(stderr) + exec(mk + ' && ' + cmd + ' && ' + cm, function (error, stdout, stderr) { + if (error) core.setFailed(stderr) core.debug(stdout) }) } diff --git a/index.js b/index.js index 6c30c10..cd88d25 100644 --- a/index.js +++ b/index.js @@ -8,26 +8,26 @@ try { core.setFailed(error.message) } -function installPMD(version){ - var download = `wget https://github.com/pmd/pmd/releases/download/pmd_releases%2F${version}/pmd-bin-${version}.zip -P /tmp -O pmd.zip` +function installPMD(version) { + var download = `wget https://github.com/pmd/pmd/releases/download/pmd_releases%2F${version}/pmd-bin-${version}.zip -O /tmp/pmd.zip` var unzip = 'unzip /tmp/pmd.zip -d /tmp' var mk = 'mkdir $HOME/pmd' var mv = 'mv /tmp/pmd/* $HOME/pmd' - exec(download+' && '+unzip+' && '+mk+' && '+mv, function(error, stdout, stderr){ - if(error) core.setFailed(stderr) + exec(download + ' && ' + unzip + ' && ' + mk + ' && ' + mv, function (error, stdout, stderr) { + if (error) core.setFailed(stderr) core.debug(stdout) referencePMD() }) } -function referencePMD(){ +function referencePMD() { var mk = 'sudo mkdir -p /snap/bin && sudo chmod -R 757 /snap/bin' - var cmd = -`sudo echo '#! /bin/bash + var cmd = + `sudo echo '#! /bin/bash $HOME/pmd/bin/run.sh pmd "$@"' > /snap/bin/pmd` var cm = 'chmod +x /snap/bin/pmd' - exec(mk+' && '+cmd+' && '+cm, function(error, stdout, stderr){ - if(error) core.setFailed(stderr) + exec(mk + ' && ' + cmd + ' && ' + cm, function (error, stdout, stderr) { + if (error) core.setFailed(stderr) core.debug(stdout) }) } From 27a0102ee5ca754a4a29a3a63194fdb59201d16d Mon Sep 17 00:00:00 2001 From: Jamie Briers Date: Mon, 22 Mar 2021 12:00:48 +0000 Subject: [PATCH 7/9] revert --- dist/index.js | 6 +++--- index.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dist/index.js b/dist/index.js index ad20207..3df7783 100644 --- a/dist/index.js +++ b/dist/index.js @@ -16,10 +16,10 @@ try { } function installPMD(version) { - var download = `wget https://github.com/pmd/pmd/releases/download/pmd_releases%2F${version}/pmd-bin-${version}.zip -O /tmp/pmd.zip` - var unzip = 'unzip /tmp/pmd.zip -d /tmp' + var download = `wget https://github.com/pmd/pmd/releases/download/pmd_releases%2F${version}/pmd-bin-${version}.zip -P /tmp` + var unzip = `unzip /tmp/pmd-bin-${version}.zip -d /tmp` var mk = 'mkdir $HOME/pmd' - var mv = 'mv /tmp/pmd/* $HOME/pmd' + var mv = `mv /tmp/pmd-bin-${version}/* $HOME/pmd` exec(download + ' && ' + unzip + ' && ' + mk + ' && ' + mv, function (error, stdout, stderr) { if (error) core.setFailed(stderr) core.debug(stdout) diff --git a/index.js b/index.js index cd88d25..f432b6d 100644 --- a/index.js +++ b/index.js @@ -9,10 +9,10 @@ try { } function installPMD(version) { - var download = `wget https://github.com/pmd/pmd/releases/download/pmd_releases%2F${version}/pmd-bin-${version}.zip -O /tmp/pmd.zip` - var unzip = 'unzip /tmp/pmd.zip -d /tmp' + var download = `wget https://github.com/pmd/pmd/releases/download/pmd_releases%2F${version}/pmd-bin-${version}.zip -P /tmp` + var unzip = `unzip /tmp/pmd-bin-${version}.zip -d /tmp` var mk = 'mkdir $HOME/pmd' - var mv = 'mv /tmp/pmd/* $HOME/pmd' + var mv = `mv /tmp/pmd-bin-${version}/* $HOME/pmd` exec(download + ' && ' + unzip + ' && ' + mk + ' && ' + mv, function (error, stdout, stderr) { if (error) core.setFailed(stderr) core.debug(stdout) From 71203b7b94ae3d9e9021ddc7f7ac07363102ebce Mon Sep 17 00:00:00 2001 From: Jamie Briers Date: Mon, 22 Mar 2021 12:06:29 +0000 Subject: [PATCH 8/9] update readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index d72bfcf..546e618 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ jobs: steps: - uses: sfdx-actions/setup-pmd@v1 + with: + pmd-version: '6.32.0' - name: run-pmd run: pmd -d ./force-app/main/default/classes -R category/apex/design.xml -f text ``` From b468a12a27c29ae229929d80e5e0492d3a165aaa Mon Sep 17 00:00:00 2001 From: Jamie Briers Date: Mon, 22 Mar 2021 12:10:38 +0000 Subject: [PATCH 9/9] add ncc package --- package-lock.json | 5 +++++ package.json | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 90c3422..36f44ca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,11 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.0.tgz", "integrity": "sha512-ZKdyhlSlyz38S6YFfPnyNgCDZuAF2T0Qv5eHflNWytPS8Qjvz39bZFMry9Bb/dpSnqWcNeav5yM2CTYpJeY+Dw==" + }, + "@vercel/ncc": { + "version": "0.27.0", + "resolved": "https://jenkins-001.ukwest.cloudapp.azure.com:443/npm/@vercel%2fncc/-/ncc-0.27.0.tgz", + "integrity": "sha512-DllIJQapnU2YwewIhh/4dYesmMQw3h2cFtabECc/zSJHqUbNa0eJuEkRa6DXbZvh1YPWBtYQoPV17NlDpBw1Vw==" } } } diff --git a/package.json b/package.json index f9a434d..7769d2c 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ }, "homepage": "https://github.com/sfdx-actions/setup-pmd#readme", "dependencies": { - "@actions/core": "^1.2.0" + "@actions/core": "^1.2.0", + "@vercel/ncc": "^0.27.0" } }