From 8447391d87bc7648ce6bf97159c17b642576afb0 Mon Sep 17 00:00:00 2001 From: Timon van Spronsen Date: Mon, 7 Oct 2019 20:46:08 +0200 Subject: [PATCH] Production build --- dist/index.js | 242 +++++++++++++++++++++++++------------------------- 1 file changed, 121 insertions(+), 121 deletions(-) diff --git a/dist/index.js b/dist/index.js index c34031e2..1755b723 100644 --- a/dist/index.js +++ b/dist/index.js @@ -34,7 +34,7 @@ module.exports = /******/ // the startup function /******/ function startup() { /******/ // Load entry module and return exports -/******/ return __webpack_require__(104); +/******/ return __webpack_require__(676); /******/ }; /******/ /******/ // run startup @@ -115,6 +115,43 @@ const osName = (platform, release) => { module.exports = osName; +/***/ }), + +/***/ 5: +/***/ (function(module, __unusedexports, __webpack_require__) { + +const path = __webpack_require__(622) +const yaml = __webpack_require__(414) + +const CONFIG_PATH = '.github' + +/** + * @returns {Promise>} + */ +module.exports = async function getConfig(github, fileName, { owner, repo }, ref) { + try { + const response = await github.repos.getContents({ + owner, + repo, + path: path.posix.join(CONFIG_PATH, fileName), + ref + }) + + return parseConfig(response.data.content) + } catch (error) { + if (error.code === 404) { + return null + } + + throw error + } +} + +function parseConfig(content) { + return yaml.safeLoad(Buffer.from(content, 'base64').toString()) || {} +} + + /***/ }), /***/ 8: @@ -1051,16 +1088,6 @@ module.exports = new Type('tag:yaml.org,2002:set', { }); -/***/ }), - -/***/ 104: -/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) { - -const action = __webpack_require__(751) - -action() - - /***/ }), /***/ 118: @@ -9216,43 +9243,6 @@ module.exports = withDefaults(request, { }) -/***/ }), - -/***/ 505: -/***/ (function(module, __unusedexports, __webpack_require__) { - -const path = __webpack_require__(622) -const yaml = __webpack_require__(414) - -const CONFIG_PATH = '.github' - -/** - * @returns {Promise>} - */ -module.exports = async function getConfig(github, fileName, { owner, repo }, ref) { - try { - const response = await github.repos.getContents({ - owner, - repo, - path: path.posix.join(CONFIG_PATH, fileName), - ref - }) - - return parseConfig(response.data.content) - } catch (error) { - if (error.code === 404) { - return null - } - - throw error - } -} - -function parseConfig(content) { - return yaml.safeLoad(Buffer.from(content, 'base64').toString()) || {} -} - - /***/ }), /***/ 509: @@ -10094,6 +10084,16 @@ module.exports = function btoa(str) { } +/***/ }), + +/***/ 676: +/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) { + +const action = __webpack_require__(928) + +action() + + /***/ }), /***/ 685: @@ -11308,79 +11308,6 @@ function defaultOptions (defaults, route, options) { module.exports = require("fs"); -/***/ }), - -/***/ 751: -/***/ (function(module, __unusedexports, __webpack_require__) { - -const core = __webpack_require__(470) -const github = __webpack_require__(469) -const matcher = __webpack_require__(167) -const getConfig = __webpack_require__(505) - -const CONFIG_FILENAME = 'pr-labeler.yml' -const defaults = { - feature: ['feature/*', 'feat/*'], - fix: 'fix/*', - chore: 'chore/*' -} - -async function action(context = github.context) { - try { - const GITHUB_TOKEN = process.env.GITHUB_TOKEN - const octokit = new github.GitHub(GITHUB_TOKEN) - const repoInfo = { - owner: context.payload.repository.owner.login, - repo: context.payload.repository.name - } - - if (!context.payload.pull_request) { - throw new Error( - "Payload doesn't contain `pull_request`. Make sure this Action is being triggered by a pull_request event (https://help.github.com/en/articles/events-that-trigger-workflows#pull-request-event-pull_request)." - ) - } - - const ref = context.payload.pull_request.head.ref - const config = { - ...defaults, - ...(await getConfig(octokit, CONFIG_FILENAME, repoInfo, ref)) - } - - const labelsToAdd = Object.entries(config).reduce( - (labels, [label, patterns]) => { - if ( - Array.isArray(patterns) - ? patterns.some(pattern => matcher.isMatch(ref, pattern)) - : matcher.isMatch(ref, patterns) - ) { - labels.push(label) - } - - return labels - }, - [] - ) - - if (labelsToAdd.length > 0) { - await octokit.issues.addLabels({ - number: context.payload.pull_request.number, - labels: labelsToAdd, - ...repoInfo - }) - } - } catch (error) { - if (process.env.NODE_ENV === 'test') { - throw error - } - - core.error(error) - core.setFailed(error.message) - } -} - -module.exports = action - - /***/ }), /***/ 755: @@ -14570,6 +14497,79 @@ module.exports = new Type('tag:yaml.org,2002:seq', { }); +/***/ }), + +/***/ 928: +/***/ (function(module, __unusedexports, __webpack_require__) { + +const core = __webpack_require__(470) +const github = __webpack_require__(469) +const matcher = __webpack_require__(167) +const getConfig = __webpack_require__(5) + +const CONFIG_FILENAME = 'pr-labeler.yml' +const defaults = { + feature: ['feature/*', 'feat/*'], + fix: 'fix/*', + chore: 'chore/*' +} + +async function action(context = github.context) { + try { + const GITHUB_TOKEN = process.env.GITHUB_TOKEN + const octokit = new github.GitHub(GITHUB_TOKEN) + const repoInfo = { + owner: context.payload.repository.owner.login, + repo: context.payload.repository.name + } + + if (!context.payload.pull_request) { + throw new Error( + "Payload doesn't contain `pull_request`. Make sure this Action is being triggered by a pull_request event (https://help.github.com/en/articles/events-that-trigger-workflows#pull-request-event-pull_request)." + ) + } + + const ref = context.payload.pull_request.head.ref + const config = { + ...defaults, + ...(await getConfig(octokit, CONFIG_FILENAME, repoInfo, ref)) + } + + const labelsToAdd = Object.entries(config).reduce( + (labels, [label, patterns]) => { + if ( + Array.isArray(patterns) + ? patterns.some(pattern => matcher.isMatch(ref, pattern)) + : matcher.isMatch(ref, patterns) + ) { + labels.push(label) + } + + return labels + }, + [] + ) + + if (labelsToAdd.length > 0) { + await octokit.issues.addLabels({ + number: context.payload.pull_request.number, + labels: labelsToAdd, + ...repoInfo + }) + } + } catch (error) { + if (process.env.NODE_ENV === 'test') { + throw error + } + + core.error(error) + core.setFailed(error.message) + } +} + +module.exports = action + + /***/ }), /***/ 929: