diff --git a/README.md b/README.md index 6e2c4630..b6138c4d 100644 --- a/README.md +++ b/README.md @@ -62,3 +62,7 @@ Example: `major.minor.build[-patch][->dev]` ## More examples To see more examples, check out [version-bumper](https://github.com/michmich112/version-bumper) which automatically bumps your versions based on the branching model you define and customize. + +## Notes +This action uses the `gh-action-stats` package to track usage. See the data collected at [gh-action-stats-js](https://github.com/michmich112/gh-action-stats-js). + diff --git a/dist/index.js b/dist/index.js index b69a522e..f7b603e9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -27,116 +27,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __asyncValues = (this && this.__asyncValues) || function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.generateSchemeRegexp = exports.getCurrentVersion = void 0; const core = __importStar(require("@actions/core")); -const fs = __importStar(require("fs")); -const readline = __importStar(require("readline")); +const utils_1 = require("./utils"); +const gh_action_stats_1 = __importDefault(require("gh-action-stats")); const FAILURE = 1; -function test() { - return __awaiter(this, void 0, void 0, function* () { - const options = getActionOptions(); - Object.freeze(options); - const schemeRegExp = generateSchemeRegexp(options.schema); - const version = yield getCurrentVersion(options, schemeRegExp); - console.info(`[SUCCESS] - found version ${version}`); - return version; - }); -} -function getActionOptions() { - const schema = core.getInput('schema', { required: true }); - const versionFile = core.getInput('version-file', { required: true }); - const versionLine = parseInt(core.getInput('version-line')) || undefined; - return { - schema, - versionFile, - versionLine, - }; -} -function getCurrentVersion(options, regExp) { - var e_1, _a; - return __awaiter(this, void 0, void 0, function* () { - const { versionFile: path, versionLine: line } = options; - // verify the path actually corresponds to a file - if (!fs.existsSync(path)) - throw new Error(`Version file with path ${path} does not exist.`); - const rl = readline.createInterface({ input: fs.createReadStream(path), crlfDelay: Infinity }); - let counter = 1, initialMatch; - try { - for (var rl_1 = __asyncValues(rl), rl_1_1; rl_1_1 = yield rl_1.next(), !rl_1_1.done;) { - const ln = rl_1_1.value; - const match = ln.match(regExp); - if (!initialMatch && match !== null) - initialMatch = match[0]; // set the initial match - if (!line && initialMatch) { // return straight away if line is not specified - console.log(`Match found line ${counter} -> ${initialMatch}`); - return initialMatch; - } - // if the user has specified a line number we go all the way to it - if (line && counter === line) { - if (match !== null) { - console.log(`Found scheme match line ${counter} -> ${match[0]}`); - return match[0]; - } - else { - console.log(`No match found for specified scheme on specified line ${line}.`); - if (initialMatch) { - console.log(`Using previous found match: ${initialMatch}`); - return initialMatch; - } - else - console.log(`No match found previously. Continuing file search.`); - } - } - else if (line && counter > line && initialMatch) { - console.log(`Match found line ${counter} -> ${initialMatch}`); - return initialMatch; - } - counter++; // increment line counter - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (rl_1_1 && !rl_1_1.done && (_a = rl_1.return)) yield _a.call(rl_1); - } - finally { if (e_1) throw e_1.error; } - } - throw new Error(`No match found in file. Unable to identify current version number.`); - }); -} -exports.getCurrentVersion = getCurrentVersion; -/** - * scheme must be of form [] - * tag will be used to generate commands - * - strstatus is a reserved tag that inserts the status as a string, also mapped to the status command - * seperators are used to seperate tags. allowed seperators are: .,;-_>< - * brackets define optional tags. they wont be displayed if there are no tags after them and if they are = to 0 - * generated regex will identify the scheme in the passed options file - * @param scheme - */ -function generateSchemeRegexp(scheme) { - let seperators = new Set(scheme.match(/[.,;:\-_><]+/gm) || []), tags = new Set(scheme.split(/[.,;:\-_><\]\[]+/g).filter((tag) => tag !== "")), - // regExp = scheme.replace(/[\[\]]/gm, ""); - regExp = scheme.replace(/\[/gm, '(').replace(/\]/gm, ')?'); - seperators.forEach((sep) => regExp = regExp.replace(new RegExp('\\' + sep.split('').join('\\'), 'g'), '\\' + sep.split('').join('\\'))); - tags.forEach((tag) => regExp = regExp.replace(tag, '[0-9]+')); - return new RegExp(regExp); -} -exports.generateSchemeRegexp = generateSchemeRegexp; function main() { return __awaiter(this, void 0, void 0, function* () { - const options = getActionOptions(); + gh_action_stats_1.default(); // collect the stats of the action run + const options = utils_1.getActionOptions(); Object.freeze(options); - const schemeRegExp = generateSchemeRegexp(options.schema); - const version = yield getCurrentVersion(options, schemeRegExp); + const schemeRegExp = utils_1.generateSchemeRegexp(options.schema); + const version = yield utils_1.getCurrentVersion(options, schemeRegExp); console.info(`[SUCCESS] - found version ${version}`); return version; }); diff --git a/dist/tests/main.test.js b/dist/tests/main.test.js index fddc4006..c9f5faf4 100644 --- a/dist/tests/main.test.js +++ b/dist/tests/main.test.js @@ -1,9 +1,9 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const index_1 = require("../index"); +const utils_1 = require("../utils"); describe("Generate Regular expression from scheme description", () => { describe("General semantic cases: major.minor.build", () => { - let scheme = 'major.minor.build', genRegExp = index_1.generateSchemeRegexp(scheme); + let scheme = 'major.minor.build', genRegExp = utils_1.generateSchemeRegexp(scheme); console.log(genRegExp); test("it should identify the correct item in the string for a simple input", () => { let match = "1.2.3".match(genRegExp); @@ -36,7 +36,7 @@ describe("Generate Regular expression from scheme description", () => { }); }); describe("General semantic cases w/ optional tag: major.minor[.build]", () => { - let scheme = 'major.minor[.build]', genRegExp = index_1.generateSchemeRegexp(scheme); + let scheme = 'major.minor[.build]', genRegExp = utils_1.generateSchemeRegexp(scheme); test("it should identify the correct item in the string for simple input (w/ optional)", () => { let match = "1.2.3".match(genRegExp); expect(match).not.toBe(null); @@ -79,7 +79,7 @@ describe("Generate Regular expression from scheme description", () => { }); }); describe("General semantic cases w/ optional tags: major.minor[.build][.commit]", () => { - let scheme = 'major.minor[.build][.commit]', genRegExp = index_1.generateSchemeRegexp(scheme); + let scheme = 'major.minor[.build][.commit]', genRegExp = utils_1.generateSchemeRegexp(scheme); test("it should identify the correct item in the string for simple input (w/ optionals)", () => { let match = "1.2.3.4".match(genRegExp); expect(match).not.toBe(null); @@ -133,7 +133,7 @@ describe("Generate Regular expression from scheme description", () => { }); }); describe("General semantic cases w/ compound optional tags: major.minor[.build[-commit]]", () => { - let scheme = 'major.minor[.build[-commit]]', genRegExp = index_1.generateSchemeRegexp(scheme); + let scheme = 'major.minor[.build[-commit]]', genRegExp = utils_1.generateSchemeRegexp(scheme); test("it should identify the correct item in the string for simple input (w/ optionals)", () => { let match = "1.2.3-4".match(genRegExp); expect(match).not.toBe(null); @@ -188,22 +188,22 @@ describe("Generate Regular expression from scheme description", () => { }); describe("Case with multiple seperators", () => { test("multiple seperators -> 1.2->3", () => { - let match = "1.2->3".match(index_1.generateSchemeRegexp("major.minor->build")); + let match = "1.2->3".match(utils_1.generateSchemeRegexp("major.minor->build")); expect(match).not.toBe(null); expect(match[0]).toBe("1.2->3"); }); test("multiple seperators with optional -> 1.2->3", () => { - let match = "1.2->3".match(index_1.generateSchemeRegexp("major.minor[->build]")); + let match = "1.2->3".match(utils_1.generateSchemeRegexp("major.minor[->build]")); expect(match).not.toBe(null); expect(match[0]).toBe("1.2->3"); }); test("multiple seperators with optionals -> 1.2->3<-4", () => { - let match = "1.2->3<-4".match(index_1.generateSchemeRegexp("major.minor[->build][<-tag]")); + let match = "1.2->3<-4".match(utils_1.generateSchemeRegexp("major.minor[->build][<-tag]")); expect(match).not.toBe(null); expect(match[0]).toBe("1.2->3<-4"); }); test("multiple seperators with compound optionals -> 1.2->3<-4", () => { - let match = "1.2->3<-4".match(index_1.generateSchemeRegexp("major.minor[->build[<-tag]]")); + let match = "1.2->3<-4".match(utils_1.generateSchemeRegexp("major.minor[->build[<-tag]]")); expect(match).not.toBe(null); expect(match[0]).toBe("1.2->3<-4"); }); diff --git a/dist/utils.js b/dist/utils.js new file mode 100644 index 00000000..797c1c8e --- /dev/null +++ b/dist/utils.js @@ -0,0 +1,134 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +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()); + }); +}; +var __asyncValues = (this && this.__asyncValues) || function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.generateSchemeRegexp = exports.getCurrentVersion = exports.getActionOptions = exports.test = void 0; +const core = __importStar(require("@actions/core")); +const fs = __importStar(require("fs")); +const readline = __importStar(require("readline")); +function test() { + return __awaiter(this, void 0, void 0, function* () { + const options = getActionOptions(); + Object.freeze(options); + const schemeRegExp = generateSchemeRegexp(options.schema); + const version = yield getCurrentVersion(options, schemeRegExp); + console.info(`[SUCCESS] - found version ${version}`); + return version; + }); +} +exports.test = test; +function getActionOptions() { + const schema = core.getInput('schema', { required: true }); + const versionFile = core.getInput('version-file', { required: true }); + const versionLine = parseInt(core.getInput('version-line')) || undefined; + return { + schema, + versionFile, + versionLine, + }; +} +exports.getActionOptions = getActionOptions; +function getCurrentVersion(options, regExp) { + var e_1, _a; + return __awaiter(this, void 0, void 0, function* () { + const { versionFile: path, versionLine: line } = options; + // verify the path actually corresponds to a file + if (!fs.existsSync(path)) + throw new Error(`Version file with path ${path} does not exist.`); + const rl = readline.createInterface({ input: fs.createReadStream(path), crlfDelay: Infinity }); + let counter = 1, initialMatch; + try { + for (var rl_1 = __asyncValues(rl), rl_1_1; rl_1_1 = yield rl_1.next(), !rl_1_1.done;) { + const ln = rl_1_1.value; + const match = ln.match(regExp); + if (!initialMatch && match !== null) + initialMatch = match[0]; // set the initial match + if (!line && initialMatch) { // return straight away if line is not specified + console.log(`Match found line ${counter} -> ${initialMatch}`); + return initialMatch; + } + // if the user has specified a line number we go all the way to it + if (line && counter === line) { + if (match !== null) { + console.log(`Found scheme match line ${counter} -> ${match[0]}`); + return match[0]; + } + else { + console.log(`No match found for specified scheme on specified line ${line}.`); + if (initialMatch) { + console.log(`Using previous found match: ${initialMatch}`); + return initialMatch; + } + else + console.log(`No match found previously. Continuing file search.`); + } + } + else if (line && counter > line && initialMatch) { + console.log(`Match found line ${counter} -> ${initialMatch}`); + return initialMatch; + } + counter++; // increment line counter + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (rl_1_1 && !rl_1_1.done && (_a = rl_1.return)) yield _a.call(rl_1); + } + finally { if (e_1) throw e_1.error; } + } + throw new Error(`No match found in file. Unable to identify current version number.`); + }); +} +exports.getCurrentVersion = getCurrentVersion; +/** + * scheme must be of form [] + * tag will be used to generate commands + * - strstatus is a reserved tag that inserts the status as a string, also mapped to the status command + * seperators are used to seperate tags. allowed seperators are: .,;-_>< + * brackets define optional tags. they wont be displayed if there are no tags after them and if they are = to 0 + * generated regex will identify the scheme in the passed options file + * @param scheme + */ +function generateSchemeRegexp(scheme) { + let seperators = new Set(scheme.match(/[.,;:\-_><]+/gm) || []), tags = new Set(scheme.split(/[.,;:\-_><\]\[]+/g).filter((tag) => tag !== "")), + // regExp = scheme.replace(/[\[\]]/gm, ""); + regExp = scheme.replace(/\[/gm, '(').replace(/\]/gm, ')?'); + seperators.forEach((sep) => regExp = regExp.replace(new RegExp('\\' + sep.split('').join('\\'), 'g'), '\\' + sep.split('').join('\\'))); + tags.forEach((tag) => regExp = regExp.replace(tag, '[0-9]+')); + return new RegExp(regExp); +} +exports.generateSchemeRegexp = generateSchemeRegexp; diff --git a/node_modules/gh-action-stats/LICENSE b/node_modules/gh-action-stats/LICENSE new file mode 100644 index 00000000..6bb3fe85 --- /dev/null +++ b/node_modules/gh-action-stats/LICENSE @@ -0,0 +1,8 @@ +Copyright 2021 https://github.com/michmich112 + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/node_modules/gh-action-stats/README.md b/node_modules/gh-action-stats/README.md new file mode 100644 index 00000000..1f3b2321 --- /dev/null +++ b/node_modules/gh-action-stats/README.md @@ -0,0 +1,43 @@ +# Github Actions Stats JS + +Javascript packager to get insight on your github action's performance through the GHA-Stats platform. + +## Getting Sarted +First, install the package in your project by running + +```shell +npm install -S gh-action-stats +``` + +Then add it to the start of your custom GitHub action as follows: + +```javascript +const collectStats = require('gh-action-stats'); + +collectStats(); +``` +Now every time your action is used in a workflow you will be able to see the stats. + +## Stats Collected +The following information is collected: +| Variable | Description | +|---------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `GITHUB_RUN_ID` | A unique number for each run within a repository. This number does not change if your re-run the workflow | +| `GITHUB_ACTION` | The unique identifier (id) of the action (your custom action). | +| `GITHUB_ACTOR` | The name of the person or app that initiated the workflow. For example, `octocat`. | +| `GITHUB_REPOSITORY` | The owner of the repository name, For example, `octocat/Hello-World`. | +| `GITHUB_REF` | The branch or tag ref that triggered the workflow. For example, `refs/heads/feature-branch-1`.If neither a branch or tag is available for the event type, the variable will not exist. | +| `GITHUB_HEAD_REF` | Only set for pull request events. The name of the head branch. | +| `GITHUB_BASE_REF` | Only set for pull request events. The name of the base branch. | +| `RUNNER_OS` | The operation system of the runner executing the job. Possible values are `Linux`, `Windows`, or `macOS`. | + +## Usage Policy +Please make sure you state that you are using this package in your README as to make the users aware of the information collected. + +## Notes +This packages is made to work with node 12 or above. + +## Todo +- [ ] Runtime stats for debugging possible problems in runs. +- [ ] Test on self hosted runners + diff --git a/node_modules/gh-action-stats/index.d.ts b/node_modules/gh-action-stats/index.d.ts new file mode 100644 index 00000000..4dae1760 --- /dev/null +++ b/node_modules/gh-action-stats/index.d.ts @@ -0,0 +1,3 @@ +declare function collectStats(): void; +export default collectStats; + diff --git a/node_modules/gh-action-stats/index.js b/node_modules/gh-action-stats/index.js new file mode 100644 index 00000000..351d0d0f --- /dev/null +++ b/node_modules/gh-action-stats/index.js @@ -0,0 +1,47 @@ +const https = require('https'); + +function getRunMetadata() { + const envVars = [ + 'GITHUB_RUN_ID', + 'GITHUB_ACTION', + 'GITHUB_ACTOR', + 'GITHUB_REPOSITORY', + 'GITHUB_REF', + 'GITHUB_HEAD_REF', + 'GITHUB_BASE_REF', + 'RUNNER_OS' + ]; + return envVars.map(v => ({ [v.toLowerCase()]: process.env[v] || null })) + .reduce((acc, cur) => ({ ...acc, ...cur })) +} + +function collectStats() { + + const data = JSON.stringify(getRunMetadata()); + + const options = { + hostname: 'us-central1-gh-action-stats.cloudfunctions.net', + port: 443, + path: '/newActionRun', + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Content-Length': data.length + } + } + + const req = https.request(options, _ => { + console.debug(`Collected action statistics`); + }) + + req.on('error', error => { + console.error('Error collecting action stats.\n', error) + }) + + req.write(data) + req.end() + +} + +module.exports = collectStats; + diff --git a/node_modules/gh-action-stats/package.json b/node_modules/gh-action-stats/package.json new file mode 100644 index 00000000..f575dafb --- /dev/null +++ b/node_modules/gh-action-stats/package.json @@ -0,0 +1,44 @@ +{ + "_from": "gh-action-stats", + "_id": "gh-action-stats@0.0.1", + "_inBundle": false, + "_integrity": "sha512-S9LiF0+RaRyPM29o1ngADpt9Z5BH5jqlswxCASIYbbdvcNas5niOfqpXr5VkgVsWPpyMaMfQcPqGQCgZlF0ToQ==", + "_location": "/gh-action-stats", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "gh-action-stats", + "name": "gh-action-stats", + "escapedName": "gh-action-stats", + "rawSpec": "", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/gh-action-stats/-/gh-action-stats-0.0.1.tgz", + "_shasum": "0e9dde39311837c7dbb757dab76cfac7f868fe91", + "_spec": "gh-action-stats", + "_where": "/Users/michel/Code/Actions/extract-version", + "author": { + "name": "michmich112" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Library to get stats for github action runs", + "keywords": [ + "github", + "actions", + "github-actions" + ], + "license": "MIT", + "main": "index.js", + "name": "gh-action-stats", + "scripts": { + "test": "node index.spec.js" + }, + "version": "0.0.1" +} diff --git a/package-lock.json b/package-lock.json index 095fb4e4..fd2e9fcb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "extract-version", - "version": "0.0.1", + "version": "0.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -9,37 +9,6 @@ "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.3.0.tgz", "integrity": "sha512-xxtX0Cwdhb8LcgatfJkokqT8KzPvcIbwL9xpLU09nOwBzaStbfm0dNncsP0M4us+EpoPdWy7vbzU5vSOH7K6pg==" }, - "@actions/exec": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.4.tgz", - "integrity": "sha512-4DPChWow9yc9W3WqEbUj8Nr86xkpyE29ZzWjXucHItclLbEW6jr80Zx4nqv18QL6KK65+cifiQZXvnqgTV6oHw==", - "requires": { - "@actions/io": "^1.0.1" - } - }, - "@actions/github": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@actions/github/-/github-2.2.0.tgz", - "integrity": "sha512-9UAZqn8ywdR70n3GwVle4N8ALosQs4z50N7XMXrSTUVOmVpaBC5kE3TRTT7qQdi3OaQV24mjGuJZsHUmhD+ZXw==", - "requires": { - "@actions/http-client": "^1.0.3", - "@octokit/graphql": "^4.3.1", - "@octokit/rest": "^16.43.1" - } - }, - "@actions/http-client": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz", - "integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==", - "requires": { - "tunnel": "0.0.6" - } - }, - "@actions/io": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.0.tgz", - "integrity": "sha512-PspSX7Z9zh2Fyyuf3F6BsYeXcYHfc/VJ1vwy2vouas95efHVd42M6UfBFRs+jY0uiMDXhAoUtATn9g2r1MaWBQ==" - }, "@babel/code-frame": { "version": "7.12.13", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz", @@ -682,188 +651,6 @@ "chalk": "^3.0.0" } }, - "@octokit/auth-token": { - "version": "2.4.5", - "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.5.tgz", - "integrity": "sha512-BpGYsPgJt05M7/L/5FoE1PiAbdxXFZkX/3kDYcsvd1v6UhlnE5e96dTDr0ezX/EFwciQxf3cNV0loipsURU+WA==", - "requires": { - "@octokit/types": "^6.0.3" - } - }, - "@octokit/endpoint": { - "version": "6.0.11", - "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.11.tgz", - "integrity": "sha512-fUIPpx+pZyoLW4GCs3yMnlj2LfoXTWDUVPTC4V3MUEKZm48W+XYpeWSZCv+vYF1ZABUm2CqnDVf1sFtIYrj7KQ==", - "requires": { - "@octokit/types": "^6.0.3", - "is-plain-object": "^5.0.0", - "universal-user-agent": "^6.0.0" - } - }, - "@octokit/graphql": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.6.2.tgz", - "integrity": "sha512-WmsIR1OzOr/3IqfG9JIczI8gMJUMzzyx5j0XXQ4YihHtKlQc+u35VpVoOXhlKAlaBntvry1WpAzPl/a+s3n89Q==", - "requires": { - "@octokit/request": "^5.3.0", - "@octokit/types": "^6.0.3", - "universal-user-agent": "^6.0.0" - } - }, - "@octokit/openapi-types": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-7.2.1.tgz", - "integrity": "sha512-IHQJpLciwzwDvciLxiFj3IEV5VYn7lSVcj5cu0jbTwMfK4IG6/g8SPrVp3Le1VRzIiYSRcBzm1dA7vgWelYP3Q==" - }, - "@octokit/plugin-paginate-rest": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-1.1.2.tgz", - "integrity": "sha512-jbsSoi5Q1pj63sC16XIUboklNw+8tL9VOnJsWycWYR78TKss5PVpIPb1TUUcMQ+bBh7cY579cVAWmf5qG+dw+Q==", - "requires": { - "@octokit/types": "^2.0.1" - }, - "dependencies": { - "@octokit/types": { - "version": "2.16.2", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-2.16.2.tgz", - "integrity": "sha512-O75k56TYvJ8WpAakWwYRN8Bgu60KrmX0z1KqFp1kNiFNkgW+JW+9EBKZ+S33PU6SLvbihqd+3drvPxKK68Ee8Q==", - "requires": { - "@types/node": ">= 8" - } - }, - "@types/node": { - "version": "15.6.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-15.6.1.tgz", - "integrity": "sha512-7EIraBEyRHEe7CH+Fm1XvgqU6uwZN8Q7jppJGcqjROMT29qhAuuOxYB1uEY5UMYQKEmA5D+5tBnhdaPXSsLONA==" - } - } - }, - "@octokit/plugin-request-log": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-1.0.3.tgz", - "integrity": "sha512-4RFU4li238jMJAzLgAwkBAw+4Loile5haQMQr+uhFq27BmyJXcXSKvoQKqh0agsZEiUlW6iSv3FAgvmGkur7OQ==" - }, - "@octokit/plugin-rest-endpoint-methods": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-2.4.0.tgz", - "integrity": "sha512-EZi/AWhtkdfAYi01obpX0DF7U6b1VRr30QNQ5xSFPITMdLSfhcBqjamE3F+sKcxPbD7eZuMHu3Qkk2V+JGxBDQ==", - "requires": { - "@octokit/types": "^2.0.1", - "deprecation": "^2.3.1" - }, - "dependencies": { - "@octokit/types": { - "version": "2.16.2", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-2.16.2.tgz", - "integrity": "sha512-O75k56TYvJ8WpAakWwYRN8Bgu60KrmX0z1KqFp1kNiFNkgW+JW+9EBKZ+S33PU6SLvbihqd+3drvPxKK68Ee8Q==", - "requires": { - "@types/node": ">= 8" - } - }, - "@types/node": { - "version": "15.6.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-15.6.1.tgz", - "integrity": "sha512-7EIraBEyRHEe7CH+Fm1XvgqU6uwZN8Q7jppJGcqjROMT29qhAuuOxYB1uEY5UMYQKEmA5D+5tBnhdaPXSsLONA==" - } - } - }, - "@octokit/request": { - "version": "5.4.15", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.15.tgz", - "integrity": "sha512-6UnZfZzLwNhdLRreOtTkT9n57ZwulCve8q3IT/Z477vThu6snfdkBuhxnChpOKNGxcQ71ow561Qoa6uqLdPtag==", - "requires": { - "@octokit/endpoint": "^6.0.1", - "@octokit/request-error": "^2.0.0", - "@octokit/types": "^6.7.1", - "is-plain-object": "^5.0.0", - "node-fetch": "^2.6.1", - "universal-user-agent": "^6.0.0" - } - }, - "@octokit/request-error": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.5.tgz", - "integrity": "sha512-T/2wcCFyM7SkXzNoyVNWjyVlUwBvW3igM3Btr/eKYiPmucXTtkxt2RBsf6gn3LTzaLSLTQtNmvg+dGsOxQrjZg==", - "requires": { - "@octokit/types": "^6.0.3", - "deprecation": "^2.0.0", - "once": "^1.4.0" - } - }, - "@octokit/rest": { - "version": "16.43.2", - "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-16.43.2.tgz", - "integrity": "sha512-ngDBevLbBTFfrHZeiS7SAMAZ6ssuVmXuya+F/7RaVvlysgGa1JKJkKWY+jV6TCJYcW0OALfJ7nTIGXcBXzycfQ==", - "requires": { - "@octokit/auth-token": "^2.4.0", - "@octokit/plugin-paginate-rest": "^1.1.1", - "@octokit/plugin-request-log": "^1.0.0", - "@octokit/plugin-rest-endpoint-methods": "2.4.0", - "@octokit/request": "^5.2.0", - "@octokit/request-error": "^1.0.2", - "atob-lite": "^2.0.0", - "before-after-hook": "^2.0.0", - "btoa-lite": "^1.0.0", - "deprecation": "^2.0.0", - "lodash.get": "^4.4.2", - "lodash.set": "^4.3.2", - "lodash.uniq": "^4.5.0", - "octokit-pagination-methods": "^1.1.0", - "once": "^1.4.0", - "universal-user-agent": "^4.0.0" - }, - "dependencies": { - "@octokit/request-error": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-1.2.1.tgz", - "integrity": "sha512-+6yDyk1EES6WK+l3viRDElw96MvwfJxCt45GvmjDUKWjYIb3PJZQkq3i46TwGwoPD4h8NmTrENmtyA1FwbmhRA==", - "requires": { - "@octokit/types": "^2.0.0", - "deprecation": "^2.0.0", - "once": "^1.4.0" - } - }, - "@octokit/types": { - "version": "2.16.2", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-2.16.2.tgz", - "integrity": "sha512-O75k56TYvJ8WpAakWwYRN8Bgu60KrmX0z1KqFp1kNiFNkgW+JW+9EBKZ+S33PU6SLvbihqd+3drvPxKK68Ee8Q==", - "requires": { - "@types/node": ">= 8" - } - }, - "@types/node": { - "version": "15.6.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-15.6.1.tgz", - "integrity": "sha512-7EIraBEyRHEe7CH+Fm1XvgqU6uwZN8Q7jppJGcqjROMT29qhAuuOxYB1uEY5UMYQKEmA5D+5tBnhdaPXSsLONA==" - }, - "universal-user-agent": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-4.0.1.tgz", - "integrity": "sha512-LnST3ebHwVL2aNe4mejI9IQh2HfZ1RLo8Io2HugSif8ekzD1TlWpHpColOB/eh8JHMLkGH3Akqf040I+4ylNxg==", - "requires": { - "os-name": "^3.1.0" - } - } - } - }, - "@octokit/types": { - "version": "6.16.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.16.0.tgz", - "integrity": "sha512-EktqSNq8EKXE82a7Vw33ozOEhFXIRik+rZHJTHAgVZRm/p2K5r5ecn5fVpRkLCm3CAVFwchRvt3yvtmfbt2LCQ==", - "requires": { - "@octokit/openapi-types": "^7.2.0" - } - }, - "@octokit/webhooks": { - "version": "7.24.3", - "resolved": "https://registry.npmjs.org/@octokit/webhooks/-/webhooks-7.24.3.tgz", - "integrity": "sha512-2atcGWxwY9qoRWoJWURrz329tM8jhYWy4YfnhEguf6WUKRmgsfiAaOv57d5VESjRAgk43n2QK9EdlcCEvgu9Tg==", - "requires": { - "@octokit/request-error": "^2.0.2", - "aggregate-error": "^3.1.0", - "debug": "^4.0.0" - } - }, "@sinonjs/commons": { "version": "1.8.3", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz", @@ -1033,15 +820,6 @@ "integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==", "dev": true }, - "aggregate-error": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", - "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", - "requires": { - "clean-stack": "^2.0.0", - "indent-string": "^4.0.0" - } - }, "ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -1174,11 +952,6 @@ "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", "dev": true }, - "atob-lite": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/atob-lite/-/atob-lite-2.0.0.tgz", - "integrity": "sha1-D+9a1G8b16hQLGVyfwNn1e5D1pY=" - }, "aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", @@ -1330,11 +1103,6 @@ "tweetnacl": "^0.14.3" } }, - "before-after-hook": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.1.tgz", - "integrity": "sha512-/6FKxSTWoJdbsLDF8tdIjaRiFXiE6UHsEHE3OPI/cwPURCVi1ukP0gmLn7XWEiFk5TcwQjjY5PWsU+j+tgXgmw==" - }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -1399,11 +1167,6 @@ "node-int64": "^0.4.0" } }, - "btoa-lite": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/btoa-lite/-/btoa-lite-1.0.0.tgz", - "integrity": "sha1-M3dm2hWAEhD92VbCLpxokaudAzc=" - }, "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", @@ -1499,11 +1262,6 @@ } } }, - "clean-stack": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", - "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==" - }, "cliui": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", @@ -1604,6 +1362,7 @@ "version": "6.0.5", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, "requires": { "nice-try": "^1.0.4", "path-key": "^2.0.1", @@ -1659,6 +1418,7 @@ "version": "4.3.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, "requires": { "ms": "2.1.2" } @@ -1734,11 +1494,6 @@ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", "dev": true }, - "deprecation": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", - "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" - }, "detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -1786,6 +1541,7 @@ "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, "requires": { "once": "^1.4.0" } @@ -1852,6 +1608,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "dev": true, "requires": { "cross-spawn": "^6.0.0", "get-stream": "^4.0.0", @@ -2158,6 +1915,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, "requires": { "pump": "^3.0.0" } @@ -2177,6 +1935,11 @@ "assert-plus": "^1.0.0" } }, + "gh-action-stats": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/gh-action-stats/-/gh-action-stats-0.0.1.tgz", + "integrity": "sha512-S9LiF0+RaRyPM29o1ngADpt9Z5BH5jqlswxCASIYbbdvcNas5niOfqpXr5VkgVsWPpyMaMfQcPqGQCgZlF0ToQ==" + }, "glob": { "version": "7.1.7", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", @@ -2356,11 +2119,6 @@ "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "dev": true }, - "indent-string": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", - "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==" - }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -2503,15 +2261,11 @@ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true }, - "is-plain-object": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", - "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==" - }, "is-stream": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true }, "is-typedarray": { "version": "1.0.0", @@ -2544,7 +2298,8 @@ "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true }, "isobject": { "version": "3.0.1", @@ -3308,27 +3063,12 @@ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, - "lodash.get": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", - "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=" - }, - "lodash.set": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/lodash.set/-/lodash.set-4.3.2.tgz", - "integrity": "sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM=" - }, "lodash.sortby": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=", "dev": true }, - "lodash.uniq": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", - "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=" - }, "lolex": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz", @@ -3338,11 +3078,6 @@ "@sinonjs/commons": "^1.7.0" } }, - "macos-release": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/macos-release/-/macos-release-2.4.1.tgz", - "integrity": "sha512-H/QHeBIN1fIGJX517pvK8IEK53yQOW7YcEI55oYtgjDdoCQQz7eJS94qt5kNrscReEyuD/JcdFCm2XBEcGOITg==" - }, "make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -3469,7 +3204,8 @@ "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true }, "nanomatch": { "version": "1.2.13", @@ -3499,12 +3235,8 @@ "nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" - }, - "node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true }, "node-int64": { "version": "0.4.0", @@ -3569,6 +3301,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, "requires": { "path-key": "^2.0.0" } @@ -3634,15 +3367,11 @@ "isobject": "^3.0.1" } }, - "octokit-pagination-methods": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/octokit-pagination-methods/-/octokit-pagination-methods-1.1.0.tgz", - "integrity": "sha512-fZ4qZdQ2nxJvtcasX7Ghl+WlWS/d9IgnBIwFZXVNNZUmzpno91SX5bc5vuxiuKoCtK78XxGGNuSCrDC7xYB3OQ==" - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, "requires": { "wrappy": "1" } @@ -3670,15 +3399,6 @@ "word-wrap": "~1.2.3" } }, - "os-name": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/os-name/-/os-name-3.1.0.tgz", - "integrity": "sha512-h8L+8aNjNcMpo/mAIBPn5PXCM16iyPGjHNWo6U1YO8sJTMHtEtyczI6QJnLoplswm6goopQkqc7OAnjhWcugVg==", - "requires": { - "macos-release": "^2.2.0", - "windows-release": "^3.1.0" - } - }, "p-each-series": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-2.2.0.tgz", @@ -3688,7 +3408,8 @@ "p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true }, "p-limit": { "version": "2.3.0", @@ -3753,7 +3474,8 @@ "path-key": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true }, "path-parse": { "version": "1.0.7", @@ -3841,6 +3563,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, "requires": { "end-of-stream": "^1.1.0", "once": "^1.3.1" @@ -4239,7 +3962,8 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true }, "set-blocking": { "version": "2.0.0", @@ -4283,6 +4007,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, "requires": { "shebang-regex": "^1.0.0" } @@ -4290,7 +4015,8 @@ "shebang-regex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true }, "shellwords": { "version": "0.1.1", @@ -4302,7 +4028,8 @@ "signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", + "dev": true }, "sisteransi": { "version": "1.0.5", @@ -4643,7 +4370,8 @@ "strip-eof": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=" + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true }, "strip-final-newline": { "version": "2.0.0", @@ -4776,11 +4504,6 @@ "punycode": "^2.1.0" } }, - "tunnel": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", - "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" - }, "tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -4844,11 +4567,6 @@ "set-value": "^2.0.1" } }, - "universal-user-agent": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", - "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==" - }, "unset-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", @@ -5021,6 +4739,7 @@ "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, "requires": { "isexe": "^2.0.0" } @@ -5031,14 +4750,6 @@ "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, - "windows-release": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/windows-release/-/windows-release-3.3.3.tgz", - "integrity": "sha512-OSOGH1QYiW5yVor9TtmXKQvt2vjQqbYS+DqmsZw+r7xDwLXEeT3JGW0ZppFmHx4diyXmxt238KFR3N9jzevBRg==", - "requires": { - "execa": "^1.0.0" - } - }, "word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", @@ -5059,7 +4770,8 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true }, "write-file-atomic": { "version": "3.0.3", diff --git a/package.json b/package.json index b77aa01a..46c2222b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "extract-version", - "version": "0.1.0", + "version": "0.1.1", "description": "", "main": "dist/index.js", "scripts": { @@ -11,7 +11,8 @@ "author": "", "license": "MIT", "dependencies": { - "@actions/core": "^1.2.6" + "@actions/core": "^1.2.6", + "gh-action-stats": "0.0.1" }, "devDependencies": { "@types/node": "^13.9.8", diff --git a/src/index.ts b/src/index.ts index bbbc9b8c..71ef85f3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,99 +1,12 @@ import * as core from '@actions/core'; -import * as fs from "fs"; -import * as readline from "readline"; +import { getActionOptions, generateSchemeRegexp, getCurrentVersion } from './utils'; +import collectStats from "gh-action-stats"; const FAILURE = 1; -type ActionOptions = { - schema: string, - versionFile: string, - versionLine?: number, -} - -async function test() { - const options = getActionOptions(); - Object.freeze(options); - const schemeRegExp = generateSchemeRegexp(options.schema); - const version = await getCurrentVersion(options, schemeRegExp); - console.info(`[SUCCESS] - found version ${version}`); - return version; -} - - -function getActionOptions(): ActionOptions { - const schema = core.getInput('schema', { required: true }); - const versionFile = core.getInput('version-file', { required: true }); - const versionLine = parseInt(core.getInput('version-line')) || undefined; - - return { - schema, - versionFile, - versionLine, - }; -} - -export async function getCurrentVersion(options: ActionOptions, regExp: RegExp): Promise { - const { versionFile: path, versionLine: line } = options; - - // verify the path actually corresponds to a file - if (!fs.existsSync(path)) throw new Error(`Version file with path ${path} does not exist.`); - - const rl = readline.createInterface({ input: fs.createReadStream(path), crlfDelay: Infinity }); - let counter = 1, - initialMatch: string | undefined; - - for await (const ln of rl) { - const match = ln.match(regExp); - if (!initialMatch && match !== null) initialMatch = match[0]; // set the initial match - if (!line && initialMatch) { // return straight away if line is not specified - console.log(`Match found line ${counter} -> ${initialMatch}`); - return initialMatch; - } - // if the user has specified a line number we go all the way to it - if (line && counter === line) { - if (match !== null) { - console.log(`Found scheme match line ${counter} -> ${match[0]}`); - return match[0]; - } else { - console.log(`No match found for specified scheme on specified line ${line}.`); - if (initialMatch) { - console.log(`Using previous found match: ${initialMatch}`); - return initialMatch; - } else console.log(`No match found previously. Continuing file search.`); - } - } else if (line && counter > line && initialMatch) { - console.log(`Match found line ${counter} -> ${initialMatch}`); - return initialMatch; - } - counter++; // increment line counter - } - throw new Error(`No match found in file. Unable to identify current version number.`); - -} - -/** - * scheme must be of form [] - * tag will be used to generate commands - * - strstatus is a reserved tag that inserts the status as a string, also mapped to the status command - * seperators are used to seperate tags. allowed seperators are: .,;-_>< - * brackets define optional tags. they wont be displayed if there are no tags after them and if they are = to 0 - * generated regex will identify the scheme in the passed options file - * @param scheme - */ -export function generateSchemeRegexp(scheme: string): RegExp { - let seperators = new Set(scheme.match(/[.,;:\-_><]+/gm) || []), - tags = new Set(scheme.split(/[.,;:\-_><\]\[]+/g).filter((tag: string) => tag !== "")), - // regExp = scheme.replace(/[\[\]]/gm, ""); - regExp = scheme.replace(/\[/gm, '(').replace(/\]/gm, ')?'); - seperators.forEach( - (sep) => regExp = regExp.replace(new RegExp('\\' + sep.split('').join('\\'), 'g'), - '\\' + sep.split('').join('\\'))); - tags.forEach((tag) => regExp = regExp.replace(tag, '[0-9]+')); - - return new RegExp(regExp); -} async function main() { + collectStats(); // collect the stats of the action run const options = getActionOptions(); Object.freeze(options); const schemeRegExp = generateSchemeRegexp(options.schema); @@ -104,7 +17,7 @@ async function main() { main() - .then(version => core.setOutput('version',version)) + .then(version => core.setOutput('version', version)) .catch(e => { core.error(e); core.setFailed(e.message); diff --git a/src/tests/main.test.ts b/src/tests/main.test.ts index 0a87966e..0909cb00 100644 --- a/src/tests/main.test.ts +++ b/src/tests/main.test.ts @@ -1,4 +1,4 @@ -import { getCurrentVersion, generateSchemeRegexp } from "../index"; +import { generateSchemeRegexp } from "../utils"; describe("Generate Regular expression from scheme description", () => { describe("General semantic cases: major.minor.build", () => { diff --git a/src/utils.ts b/src/utils.ts new file mode 100644 index 00000000..9915d64e --- /dev/null +++ b/src/utils.ts @@ -0,0 +1,94 @@ +import * as core from '@actions/core'; +import * as fs from 'fs'; +import * as readline from 'readline'; + + +export type ActionOptions = { + schema: string, + versionFile: string, + versionLine?: number, +} + +export async function test() { + const options = getActionOptions(); + Object.freeze(options); + const schemeRegExp = generateSchemeRegexp(options.schema); + const version = await getCurrentVersion(options, schemeRegExp); + console.info(`[SUCCESS] - found version ${version}`); + return version; +} + + +export function getActionOptions(): ActionOptions { + const schema = core.getInput('schema', { required: true }); + const versionFile = core.getInput('version-file', { required: true }); + const versionLine = parseInt(core.getInput('version-line')) || undefined; + + return { + schema, + versionFile, + versionLine, + }; +} + +export async function getCurrentVersion(options: ActionOptions, regExp: RegExp): Promise { + const { versionFile: path, versionLine: line } = options; + + // verify the path actually corresponds to a file + if (!fs.existsSync(path)) throw new Error(`Version file with path ${path} does not exist.`); + + const rl = readline.createInterface({ input: fs.createReadStream(path), crlfDelay: Infinity }); + let counter = 1, + initialMatch: string | undefined; + + for await (const ln of rl) { + const match = ln.match(regExp); + if (!initialMatch && match !== null) initialMatch = match[0]; // set the initial match + if (!line && initialMatch) { // return straight away if line is not specified + console.log(`Match found line ${counter} -> ${initialMatch}`); + return initialMatch; + } + // if the user has specified a line number we go all the way to it + if (line && counter === line) { + if (match !== null) { + console.log(`Found scheme match line ${counter} -> ${match[0]}`); + return match[0]; + } else { + console.log(`No match found for specified scheme on specified line ${line}.`); + if (initialMatch) { + console.log(`Using previous found match: ${initialMatch}`); + return initialMatch; + } else console.log(`No match found previously. Continuing file search.`); + } + } else if (line && counter > line && initialMatch) { + console.log(`Match found line ${counter} -> ${initialMatch}`); + return initialMatch; + } + counter++; // increment line counter + } + throw new Error(`No match found in file. Unable to identify current version number.`); + +} + +/** + * scheme must be of form [] + * tag will be used to generate commands + * - strstatus is a reserved tag that inserts the status as a string, also mapped to the status command + * seperators are used to seperate tags. allowed seperators are: .,;-_>< + * brackets define optional tags. they wont be displayed if there are no tags after them and if they are = to 0 + * generated regex will identify the scheme in the passed options file + * @param scheme + */ +export function generateSchemeRegexp(scheme: string): RegExp { + let seperators = new Set(scheme.match(/[.,;:\-_><]+/gm) || []), + tags = new Set(scheme.split(/[.,;:\-_><\]\[]+/g).filter((tag: string) => tag !== "")), + // regExp = scheme.replace(/[\[\]]/gm, ""); + regExp = scheme.replace(/\[/gm, '(').replace(/\]/gm, ')?'); + seperators.forEach( + (sep) => regExp = regExp.replace(new RegExp('\\' + sep.split('').join('\\'), 'g'), + '\\' + sep.split('').join('\\'))); + tags.forEach((tag) => regExp = regExp.replace(tag, '[0-9]+')); + + return new RegExp(regExp); +} +