From 5ddbe77e0fad25e30f689fa27fba8ff656fb8fee Mon Sep 17 00:00:00 2001 From: Nargonath Date: Fri, 25 Sep 2020 10:50:19 +0200 Subject: [PATCH 1/2] fix: handle tweet error when not array --- dist/index.js | 2096 ++++++++++++++--- lib/push/index.js | 6 +- .../event.json | 15 + .../test.js | 63 + .../tweets/my-poll.tweet | 6 + 5 files changed, 1866 insertions(+), 320 deletions(-) create mode 100644 test/push-master-tweet-with-poll-missing-account-id/event.json create mode 100644 test/push-master-tweet-with-poll-missing-account-id/test.js create mode 100644 test/push-master-tweet-with-poll-missing-account-id/tweets/my-poll.tweet diff --git a/dist/index.js b/dist/index.js index 3b34283c..5cbfbd97 100644 --- a/dist/index.js +++ b/dist/index.js @@ -301,9 +301,9 @@ module.exports = require("tls"); /***/ }), /* 17 */, /* 18 */ -/***/ (function() { +/***/ (function(module) { -eval("require")("encoding"); +module.exports = eval("require")("encoding"); /***/ }), @@ -2796,7 +2796,7 @@ module.exports = exports['default']; /* 106 */ /***/ (function(module, __unusedexports, __webpack_require__) { -var abort = __webpack_require__(250) +var abort = __webpack_require__(159) , async = __webpack_require__(751) ; @@ -3688,7 +3688,7 @@ module.exports = function generate_contains(it, $keyword, $ruleType) { /***/ (function(module, __unusedexports, __webpack_require__) { var async = __webpack_require__(751) - , abort = __webpack_require__(250) + , abort = __webpack_require__(159) ; // API @@ -3768,10 +3768,44 @@ function runJob(iterator, key, item, callback) /* 158 */ /***/ (function(module) { -module.exports = {"author":{"name":"Jeremy Stashewsky","email":"jstash@gmail.com","website":"https://github.com/stash"},"contributors":[{"name":"Alexander Savin","website":"https://github.com/apsavin"},{"name":"Ian Livingstone","website":"https://github.com/ianlivingstone"},{"name":"Ivan Nikulin","website":"https://github.com/inikulin"},{"name":"Lalit Kapoor","website":"https://github.com/lalitkapoor"},{"name":"Sam Thompson","website":"https://github.com/sambthompson"},{"name":"Sebastian Mayr","website":"https://github.com/Sebmaster"}],"license":"BSD-3-Clause","name":"tough-cookie","description":"RFC6265 Cookies and Cookie Jar for node.js","keywords":["HTTP","cookie","cookies","set-cookie","cookiejar","jar","RFC6265","RFC2965"],"version":"2.4.3","homepage":"https://github.com/salesforce/tough-cookie","repository":{"type":"git","url":"git://github.com/salesforce/tough-cookie.git"},"bugs":{"url":"https://github.com/salesforce/tough-cookie/issues"},"main":"./lib/cookie","files":["lib"],"scripts":{"test":"vows test/*_test.js","cover":"nyc --reporter=lcov --reporter=html vows test/*_test.js"},"engines":{"node":">=0.8"},"devDependencies":{"async":"^1.4.2","nyc":"^11.6.0","string.prototype.repeat":"^0.2.0","vows":"^0.8.1"},"dependencies":{"psl":"^1.1.24","punycode":"^1.4.1"},"_resolved":"https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz","_integrity":"sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==","_from":"tough-cookie@2.4.3"}; +module.exports = {"_args":[["tough-cookie@2.4.3","/home/jpauthier/workspace/twitter-together"]],"_from":"tough-cookie@2.4.3","_id":"tough-cookie@2.4.3","_inBundle":false,"_integrity":"sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==","_location":"/tough-cookie","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"tough-cookie@2.4.3","name":"tough-cookie","escapedName":"tough-cookie","rawSpec":"2.4.3","saveSpec":null,"fetchSpec":"2.4.3"},"_requiredBy":["/request"],"_resolved":"https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz","_spec":"2.4.3","_where":"/home/jpauthier/workspace/twitter-together","author":{"name":"Jeremy Stashewsky","email":"jstash@gmail.com"},"bugs":{"url":"https://github.com/salesforce/tough-cookie/issues"},"contributors":[{"name":"Alexander Savin"},{"name":"Ian Livingstone"},{"name":"Ivan Nikulin"},{"name":"Lalit Kapoor"},{"name":"Sam Thompson"},{"name":"Sebastian Mayr"}],"dependencies":{"psl":"^1.1.24","punycode":"^1.4.1"},"description":"RFC6265 Cookies and Cookie Jar for node.js","devDependencies":{"async":"^1.4.2","nyc":"^11.6.0","string.prototype.repeat":"^0.2.0","vows":"^0.8.1"},"engines":{"node":">=0.8"},"files":["lib"],"homepage":"https://github.com/salesforce/tough-cookie","keywords":["HTTP","cookie","cookies","set-cookie","cookiejar","jar","RFC6265","RFC2965"],"license":"BSD-3-Clause","main":"./lib/cookie","name":"tough-cookie","repository":{"type":"git","url":"git://github.com/salesforce/tough-cookie.git"},"scripts":{"cover":"nyc --reporter=lcov --reporter=html vows test/*_test.js","test":"vows test/*_test.js"},"version":"2.4.3"}; + +/***/ }), +/* 159 */ +/***/ (function(module) { + +// API +module.exports = abort; + +/** + * Aborts leftover active jobs + * + * @param {object} state - current state object + */ +function abort(state) +{ + Object.keys(state.jobs).forEach(clean.bind(state)); + + // reset leftover jobs + state.jobs = {}; +} + +/** + * Cleans up leftover job by invoking abort function for the provided job id + * + * @this state + * @param {string|number} key - job id to abort + */ +function clean(key) +{ + if (typeof this.jobs[key] == 'function') + { + this.jobs[key](); + } +} + /***/ }), -/* 159 */, /* 160 */ /***/ (function(module) { @@ -4569,105 +4603,35 @@ function toCodePoints(unicodeSurrogates) { /* 176 */, /* 177 */, /* 178 */ -/***/ (function(module) { - -module.exports = function(size) { - return new LruCache(size) -} - -function LruCache(size) { - this.capacity = size | 0 - this.map = Object.create(null) - this.list = new DoublyLinkedList() -} - -LruCache.prototype.get = function(key) { - var node = this.map[key] - if (node == null) return undefined - this.used(node) - return node.val -} - -LruCache.prototype.set = function(key, val) { - var node = this.map[key] - if (node != null) { - node.val = val - } else { - if (!this.capacity) this.prune() - if (!this.capacity) return false - node = new DoublyLinkedNode(key, val) - this.map[key] = node - this.capacity-- - } - this.used(node) - return true -} - -LruCache.prototype.used = function(node) { - this.list.moveToFront(node) -} +/***/ (function(module, exports, __webpack_require__) { -LruCache.prototype.prune = function() { - var node = this.list.pop() - if (node != null) { - delete this.map[node.key] - this.capacity++ - } -} +"use strict"; -function DoublyLinkedList() { - this.firstNode = null - this.lastNode = null -} +Object.defineProperty(exports, "__esModule", { + value: true +}); -DoublyLinkedList.prototype.moveToFront = function(node) { - if (this.firstNode == node) return +var _regexSupplant = __webpack_require__(313); - this.remove(node) +var _regexSupplant2 = _interopRequireDefault(_regexSupplant); - if (this.firstNode == null) { - this.firstNode = node - this.lastNode = node - node.prev = null - node.next = null - } else { - node.prev = null - node.next = this.firstNode - node.next.prev = node - this.firstNode = node - } -} +var _validDomainChars = __webpack_require__(823); -DoublyLinkedList.prototype.pop = function() { - var lastNode = this.lastNode - if (lastNode != null) { - this.remove(lastNode) - } - return lastNode -} +var _validDomainChars2 = _interopRequireDefault(_validDomainChars); -DoublyLinkedList.prototype.remove = function(node) { - if (this.firstNode == node) { - this.firstNode = node.next - } else if (node.prev != null) { - node.prev.next = node.next - } - if (this.lastNode == node) { - this.lastNode = node.prev - } else if (node.next != null) { - node.next.prev = node.prev - } -} +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +// Copyright 2018 Twitter, Inc. +// Licensed under the Apache License, Version 2.0 +// http://www.apache.org/licenses/LICENSE-2.0 -function DoublyLinkedNode(key, val) { - this.key = key - this.val = val - this.prev = null - this.next = null -} +var validDomainName = (0, _regexSupplant2.default)(/(?:(?:#{validDomainChars}(?:-|#{validDomainChars})*)?#{validDomainChars}\.)/, { + validDomainChars: _validDomainChars2.default +}); +exports.default = validDomainName; +module.exports = exports['default']; /***/ }), /* 179 */, @@ -7572,7 +7536,7 @@ async function createCheckRun( { octokit, payload, startedAt, toolkit }, newTweets ) { - const allTweetsValid = newTweets.every(tweet => tweet.valid); + const allTweetsValid = newTweets.every((tweet) => tweet.valid); // Check runs cannot be created if the pull request was created by a fork, // so we just log out the result. @@ -7598,7 +7562,7 @@ The above tweet is ${tweet.weightedLength - 280} characters too long`); "POST /repos/:owner/:repo/check-runs", { headers: { - accept: "application/vnd.github.antiope-preview+json" + accept: "application/vnd.github.antiope-preview+json", }, owner: payload.repository.owner.login, repo: payload.repository.name, @@ -7610,8 +7574,8 @@ The above tweet is ${tweet.weightedLength - 280} characters too long`); conclusion: allTweetsValid ? "success" : "failure", output: { title: `${newTweets.length} tweet(s)`, - summary: newTweets.map(tweetToCheckRunSummary).join("\n\n---\n\n") - } + summary: newTweets.map(tweetToCheckRunSummary).join("\n\n---\n\n"), + }, } ); @@ -7918,7 +7882,7 @@ var _validDomainChars = __webpack_require__(823); var _validDomainChars2 = _interopRequireDefault(_validDomainChars); -var _validDomainName = __webpack_require__(299); +var _validDomainName = __webpack_require__(178); var _validDomainName2 = _interopRequireDefault(_validDomainName); @@ -10125,38 +10089,32 @@ for (var e in errors) { /***/ }), /* 250 */ -/***/ (function(module) { +/***/ (function(__unusedmodule, exports, __webpack_require__) { -// API -module.exports = abort; +"use strict"; -/** - * Aborts leftover active jobs - * - * @param {object} state - current state object - */ -function abort(state) -{ - Object.keys(state.jobs).forEach(clean.bind(state)); - // reset leftover jobs - state.jobs = {}; -} +Object.defineProperty(exports, '__esModule', { value: true }); -/** - * Cleans up leftover job by invoking abort function for the provided job id - * - * @this state - * @param {string|number} key - job id to abort - */ -function clean(key) -{ - if (typeof this.jobs[key] == 'function') - { - this.jobs[key](); +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var osName = _interopDefault(__webpack_require__(2)); + +function getUserAgent() { + try { + return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`; + } catch (error) { + if (/wmic os get Caption/.test(error.message)) { + return "Windows "; + } + + return ""; } } +exports.getUserAgent = getUserAgent; +//# sourceMappingURL=index.js.map + /***/ }), /* 251 */, @@ -10921,7 +10879,7 @@ const { resolve: resolvePath } = __webpack_require__(622); function isSetupDone() { const tweetsFolderPath = resolvePath(process.env.GITHUB_WORKSPACE, "tweets"); - return new Promise(resolve => { + return new Promise((resolve) => { fs.stat(tweetsFolderPath, (error, stat) => { if (error) { return resolve(false); @@ -13883,35 +13841,145 @@ module.exports = exports["default"]; // Copyright 2018 Twitter, Inc. /* 297 */, /* 298 */, /* 299 */ -/***/ (function(module, exports, __webpack_require__) { +/***/ (function(__unusedmodule, exports) { "use strict"; -Object.defineProperty(exports, "__esModule", { - value: true -}); +Object.defineProperty(exports, '__esModule', { value: true }); -var _regexSupplant = __webpack_require__(313); +const VERSION = "2.0.1"; -var _regexSupplant2 = _interopRequireDefault(_regexSupplant); +/** + * Some “list” response that can be paginated have a different response structure + * + * They have a `total_count` key in the response (search also has `incomplete_results`, + * /installation/repositories also has `repository_selection`), as well as a key with + * the list of the items which name varies from endpoint to endpoint: + * + * - https://developer.github.com/v3/search/#example (key `items`) + * - https://developer.github.com/v3/checks/runs/#response-3 (key: `check_runs`) + * - https://developer.github.com/v3/checks/suites/#response-1 (key: `check_suites`) + * - https://developer.github.com/v3/apps/installations/#list-repositories (key: `repositories`) + * - https://developer.github.com/v3/apps/installations/#list-installations-for-a-user (key `installations`) + * + * Octokit normalizes these responses so that paginated results are always returned following + * the same structure. One challenge is that if the list response has only one page, no Link + * header is provided, so this header alone is not sufficient to check wether a response is + * paginated or not. For the exceptions with the namespace, a fallback check for the route + * paths has to be added in order to normalize the response. We cannot check for the total_count + * property because it also exists in the response of Get the combined status for a specific ref. + */ +const REGEX = [/^\/search\//, /^\/repos\/[^/]+\/[^/]+\/commits\/[^/]+\/(check-runs|check-suites)([^/]|$)/, /^\/installation\/repositories([^/]|$)/, /^\/user\/installations([^/]|$)/, /^\/repos\/[^/]+\/[^/]+\/actions\/secrets([^/]|$)/, /^\/repos\/[^/]+\/[^/]+\/actions\/workflows(\/[^/]+\/runs)?([^/]|$)/, /^\/repos\/[^/]+\/[^/]+\/actions\/runs(\/[^/]+\/(artifacts|jobs))?([^/]|$)/]; +function normalizePaginatedListResponse(octokit, url, response) { + const path = url.replace(octokit.request.endpoint.DEFAULTS.baseUrl, ""); + const responseNeedsNormalization = REGEX.find(regex => regex.test(path)); + if (!responseNeedsNormalization) return; // keep the additional properties intact as there is currently no other way + // to retrieve the same information. -var _validDomainChars = __webpack_require__(823); + const incompleteResults = response.data.incomplete_results; + const repositorySelection = response.data.repository_selection; + const totalCount = response.data.total_count; + delete response.data.incomplete_results; + delete response.data.repository_selection; + delete response.data.total_count; + const namespaceKey = Object.keys(response.data)[0]; + const data = response.data[namespaceKey]; + response.data = data; -var _validDomainChars2 = _interopRequireDefault(_validDomainChars); + if (typeof incompleteResults !== "undefined") { + response.data.incomplete_results = incompleteResults; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + if (typeof repositorySelection !== "undefined") { + response.data.repository_selection = repositorySelection; + } -// Copyright 2018 Twitter, Inc. -// Licensed under the Apache License, Version 2.0 -// http://www.apache.org/licenses/LICENSE-2.0 + response.data.total_count = totalCount; +} -var validDomainName = (0, _regexSupplant2.default)(/(?:(?:#{validDomainChars}(?:-|#{validDomainChars})*)?#{validDomainChars}\.)/, { - validDomainChars: _validDomainChars2.default -}); +function iterator(octokit, route, parameters) { + const options = octokit.request.endpoint(route, parameters); + const method = options.method; + const headers = options.headers; + let url = options.url; + return { + [Symbol.asyncIterator]: () => ({ + next() { + if (!url) { + return Promise.resolve({ + done: true + }); + } + + return octokit.request({ + method, + url, + headers + }).then(response => { + normalizePaginatedListResponse(octokit, url, response); // `response.headers.link` format: + // '; rel="next", ; rel="last"' + // sets `url` to undefined if "next" URL is not present or `link` header is not set + + url = ((response.headers.link || "").match(/<([^>]+)>;\s*rel="next"/) || [])[1]; + return { + value: response + }; + }); + } + + }) + }; +} + +function paginate(octokit, route, parameters, mapFn) { + if (typeof parameters === "function") { + mapFn = parameters; + parameters = undefined; + } + + return gather(octokit, [], iterator(octokit, route, parameters)[Symbol.asyncIterator](), mapFn); +} + +function gather(octokit, results, iterator, mapFn) { + return iterator.next().then(result => { + if (result.done) { + return results; + } + + let earlyExit = false; + + function done() { + earlyExit = true; + } + + results = results.concat(mapFn ? mapFn(result.value, done) : result.value.data); + + if (earlyExit) { + return results; + } + + return gather(octokit, results, iterator, mapFn); + }); +} + +/** + * @param octokit Octokit instance + * @param options Options passed to Octokit constructor + */ + +function paginateRest(octokit) { + return { + paginate: Object.assign(paginate.bind(null, octokit), { + iterator: iterator.bind(null, octokit) + }) + }; +} +paginateRest.VERSION = VERSION; + +exports.paginateRest = paginateRest; +//# sourceMappingURL=index.js.map -exports.default = validDomainName; -module.exports = exports['default']; /***/ }), /* 300 */ @@ -16573,25 +16641,27 @@ const EOL = __webpack_require__(87).EOL; const { parseTweet } = __webpack_require__(914); +const OPTION_REGEX = /^\(\s?\)\s+/; + function parseTweetFileContent(text) { const pollOptions = []; let lastLine; while ((lastLine = getlastLineMatchingPollOption(text))) { - pollOptions.push(lastLine.replace(/\( \)\s+/, "")); + pollOptions.push(lastLine.replace(OPTION_REGEX, "")); text = withLastLineRemoved(text); } return { poll: pollOptions.length ? pollOptions.reverse() : null, text, - ...parseTweet(text) + ...parseTweet(text), }; } function getlastLineMatchingPollOption(text) { const lines = text.trim().split(EOL); const [lastLine] = lines.reverse(); - return /^\( \) /.test(lastLine) ? lastLine : null; + return OPTION_REGEX.test(lastLine) ? lastLine : null; } function withLastLineRemoved(text) { @@ -16732,11 +16802,16 @@ const createActionAuth = function createActionAuth() { throw new Error("[@octokit/auth-action] `GITHUB_ACTION` environment variable is not set. @octokit/auth-action is meant to be used in GitHub Actions only."); } - if (!process.env.GITHUB_TOKEN) { - throw new Error("[@octokit/auth-action] `GITHUB_TOKEN` environment variable is not set. See https://help.github.com/en/articles/virtual-environments-for-github-actions#github_token-secret"); + if (!process.env.GITHUB_TOKEN && !process.env.INPUT_GITHUB_TOKEN) { + throw new Error("[@octokit/auth-action] `GITHUB_TOKEN` variable is not set. It must be set on either `env:` or `with:`. See https://github.com/octokit/auth-action.js#createactionauth"); } - return authToken.createTokenAuth(process.env.GITHUB_TOKEN); + if (process.env.GITHUB_TOKEN && process.env.INPUT_GITHUB_TOKEN) { + throw new Error("[@octokit/auth-action] `GITHUB_TOKEN` variable is set on both `env:` and `with:`. Use either the one or the other. See https://github.com/octokit/auth-action.js#createactionauth"); + } + + const token = process.env.GITHUB_TOKEN || process.env.INPUT_GITHUB_TOKEN; + return authToken.createTokenAuth(token); }; exports.createActionAuth = createActionAuth; @@ -17385,17 +17460,24 @@ module.exports = { "use strict"; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const os = __webpack_require__(87); +const os = __importStar(__webpack_require__(87)); /** * Commands * * Command Format: - * ##[name key=value;key=value]message + * ::name key=value,key=value::message * * Examples: - * ##[warning]This is the user warning message - * ##[set-secret name=mypassword]definitelyNotAPassword! + * ::warning::This is the message + * ::set-env name=MY_VAR::some value */ function issueCommand(command, properties, message) { const cmd = new Command(command, properties, message); @@ -17431,30 +17513,42 @@ class Command { else { cmdStr += ','; } - // 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 += `${key}=${escapeProperty(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); + cmdStr += `${CMD_STRING}${escapeData(this.message)}`; return cmdStr; } } +/** + * Sanitizes an input into a string so it can be passed into issueCommand safely + * @param input input to sanitize into a string + */ +function toCommandValue(input) { + if (input === null || input === undefined) { + return ''; + } + else if (typeof input === 'string' || input instanceof String) { + return input; + } + return JSON.stringify(input); +} +exports.toCommandValue = toCommandValue; function escapeData(s) { - return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A'); + return toCommandValue(s) + .replace(/%/g, '%25') + .replace(/\r/g, '%0D') + .replace(/\n/g, '%0A'); } -function escape(s) { - return s +function escapeProperty(s) { + return toCommandValue(s) + .replace(/%/g, '%25') .replace(/\r/g, '%0D') .replace(/\n/g, '%0A') - .replace(/]/g, '%5D') - .replace(/;/g, '%3B'); + .replace(/:/g, '%3A') + .replace(/,/g, '%2C'); } //# sourceMappingURL=command.js.map @@ -17475,14 +17569,15 @@ async function getNewTweets({ octokit, toolkit, payload }) { { owner: payload.repository.owner.login, repo: payload.repository.name, - number: payload.pull_request.number + number: payload.pull_request.number, } ); const { data: files } = response; const newTweet = files.find( - file => file.status === "added" && /^tweets\/.*\.tweet$/.test(file.filename) + (file) => + file.status === "added" && /^tweets\/.*\.tweet$/.test(file.filename) ); if (!newTweet) { @@ -17499,19 +17594,19 @@ async function getNewTweets({ octokit, toolkit, payload }) { "GET /repos/:owner/:repo/pulls/:number", { headers: { - accept: "application/vnd.github.diff" + accept: "application/vnd.github.diff", }, owner: payload.repository.owner.login, repo: payload.repository.name, - number: payload.pull_request.number + number: payload.pull_request.number, } ); const newTweets = parseDiff(data) - .filter(file => file.new && /^tweets\/.*\.tweet$/.test(file.to)) - .map(file => { + .filter((file) => file.new && /^tweets\/.*\.tweet$/.test(file.to)) + .map((file) => { const tweetFileContent = file.chunks[0].changes - .map(line => line.content.substr(1)) + .map((line) => line.content.substr(1)) .join("\n"); return parseTweetFileContent(tweetFileContent); @@ -17563,13 +17658,13 @@ module.exports = exports["default"]; Object.defineProperty(exports, '__esModule', { value: true }); -var universalUserAgent = __webpack_require__(796); +var universalUserAgent = __webpack_require__(848); var beforeAfterHook = __webpack_require__(523); var request = __webpack_require__(586); var graphql = __webpack_require__(898); var authToken = __webpack_require__(813); -const VERSION = "2.0.0"; +const VERSION = "2.4.2"; class Octokit { constructor(options = {}) { @@ -17598,13 +17693,22 @@ class Octokit { if (options.timeZone) { requestDefaults.headers["time-zone"] = options.timeZone; - } // (1) If neither `options.authStrategy` nor `options.auth` are set, the `octokit` instance + } + + this.request = request.request.defaults(requestDefaults); + this.graphql = graphql.withCustomRequest(this.request).defaults(requestDefaults); + this.log = Object.assign({ + debug: () => {}, + info: () => {}, + warn: console.warn.bind(console), + error: console.error.bind(console) + }, options.log); + this.hook = hook; // (1) If neither `options.authStrategy` nor `options.auth` are set, the `octokit` instance // is unauthenticated. The `this.auth()` method is a no-op and no request hook is registred. // (2) If only `options.auth` is set, use the default token authentication strategy. - // (3) If `options.authStrategy` is set then use it and pass in `options.auth` + // (3) If `options.authStrategy` is set then use it and pass in `options.auth`. Always pass own request as many strategies accept a custom request instance. // TODO: type `options.auth` based on `options.authStrategy`. - if (!options.authStrategy) { if (!options.auth) { // (1) @@ -17619,23 +17723,16 @@ class Octokit { this.auth = auth; } } else { - const auth = options.authStrategy(options.auth); // @ts-ignore ¯\_(ツ)_/¯ + const auth = options.authStrategy(Object.assign({ + request: this.request + }, options.auth)); // @ts-ignore ¯\_(ツ)_/¯ hook.wrap("request", auth.hook); this.auth = auth; - } - - this.request = request.request.defaults(requestDefaults); - this.graphql = graphql.withCustomRequest(this.request).defaults(requestDefaults); - this.log = Object.assign({ - debug: () => {}, - info: () => {}, - warn: console.warn.bind(console), - error: console.error.bind(console) - }, options.log); - this.hook = hook; // apply plugins + } // apply plugins // https://stackoverflow.com/a/16345172 + const classConstructor = this.constructor; classConstructor.plugins.forEach(plugin => { Object.assign(this, plugin(this, options)); @@ -17643,12 +17740,16 @@ class Octokit { } static defaults(defaults) { - return class OctokitWithDefaults extends this { - constructor(options = {}) { - super(Object.assign({}, defaults, options)); + const OctokitWithDefaults = class extends this { + constructor(...args) { + const options = args[0] || {}; + super(Object.assign({}, defaults, options, options.userAgent && defaults.userAgent ? { + userAgent: `${options.userAgent} ${defaults.userAgent}` + } : null)); } }; + return OctokitWithDefaults; } static plugin(pluginOrPlugins) { @@ -17661,6 +17762,7 @@ class Octokit { } } +Octokit.VERSION = VERSION; Octokit.plugins = []; exports.Octokit = Octokit; @@ -17698,20 +17800,20 @@ const { parseTweet } = __webpack_require__(914); async function getNewTweets({ payload, octokit }) { const { - data: { files } + data: { files }, } = await octokit.request("GET /repos/:owner/:repo/compare/:base...:head", { owner: payload.repository.owner.login, repo: payload.repository.name, base: payload.before, - head: payload.after + head: payload.after, }); return files .filter( - file => + (file) => file.status === "added" && /^tweets\/.*\.tweet$/.test(file.filename) ) - .map(file => { + .map((file) => { const text = readFileSync( resolvePath(process.env.GITHUB_WORKSPACE, file.filename), "utf8" @@ -17719,7 +17821,7 @@ async function getNewTweets({ payload, octokit }) { return { text, filename: file.filename, - ...parseTweet(text) + ...parseTweet(text), }; }); } @@ -21673,10 +21775,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); const command_1 = __webpack_require__(431); -const os = __webpack_require__(87); -const path = __webpack_require__(622); +const os = __importStar(__webpack_require__(87)); +const path = __importStar(__webpack_require__(622)); /** * The code to exit an action */ @@ -21697,11 +21806,13 @@ var ExitCode; /** * 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 + * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any function exportVariable(name, val) { - process.env[name] = val; - command_1.issueCommand('set-env', { name }, val); + const convertedVal = command_1.toCommandValue(val); + process.env[name] = convertedVal; + command_1.issueCommand('set-env', { name }, convertedVal); } exports.exportVariable = exportVariable; /** @@ -21740,12 +21851,22 @@ exports.getInput = getInput; * Sets the value of an output. * * @param name name of the output to set - * @param value value to store + * @param value value to store. Non-string values will be converted to a string via JSON.stringify */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any function setOutput(name, value) { command_1.issueCommand('set-output', { name }, value); } exports.setOutput = setOutput; +/** + * Enables or disables the echoing of commands into stdout for the rest of the step. + * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set. + * + */ +function setCommandEcho(enabled) { + command_1.issue('echo', enabled ? 'on' : 'off'); +} +exports.setCommandEcho = setCommandEcho; //----------------------------------------------------------------------- // Results //----------------------------------------------------------------------- @@ -21762,6 +21883,13 @@ exports.setFailed = setFailed; //----------------------------------------------------------------------- // Logging Commands //----------------------------------------------------------------------- +/** + * Gets whether Actions Step Debug is on or not + */ +function isDebug() { + return process.env['RUNNER_DEBUG'] === '1'; +} +exports.isDebug = isDebug; /** * Writes debug message to user log * @param message debug message @@ -21772,18 +21900,18 @@ function debug(message) { exports.debug = debug; /** * Adds an error issue - * @param message error issue message + * @param message error issue message. Errors will be converted to string via toString() */ function error(message) { - command_1.issue('error', message); + command_1.issue('error', message instanceof Error ? message.toString() : message); } exports.error = error; /** * Adds an warning issue - * @param message warning issue message + * @param message warning issue message. Errors will be converted to string via toString() */ function warning(message) { - command_1.issue('warning', message); + command_1.issue('warning', message instanceof Error ? message.toString() : message); } exports.warning = warning; /** @@ -21841,8 +21969,9 @@ exports.group = group; * 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 + * @param value value to store. Non-string values will be converted to a string via JSON.stringify */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any function saveState(name, value) { command_1.issueCommand('save-state', { name }, value); } @@ -21890,7 +22019,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var isPlainObject = _interopDefault(__webpack_require__(696)); -var universalUserAgent = __webpack_require__(796); +var universalUserAgent = __webpack_require__(848); function lowercaseKeys(object) { if (!object) { @@ -22240,7 +22369,7 @@ function withDefaults(oldDefaults, newDefaults) { }); } -const VERSION = "5.5.1"; +const VERSION = "5.5.3"; const userAgent = `octokit-endpoint.js/${VERSION} ${universalUserAgent.getUserAgent()}`; // DEFAULTS has all properties set that EndpointOptions has, except url. // So we use RequestParameters and add method as additional required property. @@ -22671,75 +22800,31 @@ function regex(str) { /* 494 */, /* 495 */, /* 496 */ -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; -var ruleModules = __webpack_require__(894) - , toHash = __webpack_require__(855).toHash; - -module.exports = function rules() { - var RULES = [ - { type: 'number', - rules: [ { 'maximum': ['exclusiveMaximum'] }, - { 'minimum': ['exclusiveMinimum'] }, 'multipleOf', 'format'] }, - { type: 'string', - rules: [ 'maxLength', 'minLength', 'pattern', 'format' ] }, - { type: 'array', - rules: [ 'maxItems', 'minItems', 'items', 'contains', 'uniqueItems' ] }, - { type: 'object', - rules: [ 'maxProperties', 'minProperties', 'required', 'dependencies', 'propertyNames', - { 'properties': ['additionalProperties', 'patternProperties'] } ] }, - { rules: [ '$ref', 'const', 'enum', 'not', 'anyOf', 'oneOf', 'allOf', 'if' ] } - ]; - - var ALL = [ 'type', '$comment' ]; - var KEYWORDS = [ - '$schema', '$id', 'id', '$data', '$async', 'title', - 'description', 'default', 'definitions', - 'examples', 'readOnly', 'writeOnly', - 'contentMediaType', 'contentEncoding', - 'additionalItems', 'then', 'else' - ]; - var TYPES = [ 'number', 'integer', 'string', 'array', 'object', 'boolean', 'null' ]; - RULES.all = toHash(ALL); - RULES.types = toHash(TYPES); +Object.defineProperty(exports, '__esModule', { value: true }); - RULES.forEach(function (group) { - group.rules = group.rules.map(function (keyword) { - var implKeywords; - if (typeof keyword == 'object') { - var key = Object.keys(keyword)[0]; - implKeywords = keyword[key]; - keyword = key; - implKeywords.forEach(function (k) { - ALL.push(k); - RULES.all[k] = true; - }); - } - ALL.push(keyword); - var rule = RULES.all[keyword] = { - keyword: keyword, - code: ruleModules[keyword], - implements: implKeywords - }; - return rule; - }); +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } - RULES.all.$comment = { - keyword: '$comment', - code: ruleModules.$comment - }; +var osName = _interopDefault(__webpack_require__(2)); - if (group.type) RULES.types[group.type] = group; - }); +function getUserAgent() { + try { + return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`; + } catch (error) { + if (/wmic os get Caption/.test(error.message)) { + return "Windows "; + } - RULES.keywords = toHash(ALL.concat(KEYWORDS)); - RULES.custom = {}; + return ""; + } +} - return RULES; -}; +exports.getUserAgent = getUserAgent; +//# sourceMappingURL=index.js.map /***/ }), @@ -23787,7 +23872,7 @@ var compileSchema = __webpack_require__(805) , SchemaObject = __webpack_require__(474) , stableStringify = __webpack_require__(741) , formats = __webpack_require__(492) - , rules = __webpack_require__(496) + , rules = __webpack_require__(851) , $dataMetaSchema = __webpack_require__(628) , util = __webpack_require__(855); @@ -24432,7 +24517,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var isPlainObject = _interopDefault(__webpack_require__(696)); -var universalUserAgent = __webpack_require__(796); +var universalUserAgent = __webpack_require__(250); function lowercaseKeys(object) { if (!object) { @@ -24782,7 +24867,7 @@ function withDefaults(oldDefaults, newDefaults) { }); } -const VERSION = "5.5.1"; +const VERSION = "5.5.3"; const userAgent = `octokit-endpoint.js/${VERSION} ${universalUserAgent.getUserAgent()}`; // DEFAULTS has all properties set that EndpointOptions has, except url. // So we use RequestParameters and add method as additional required property. @@ -24889,7 +24974,7 @@ const toolkit = __webpack_require__(470); const handlePullRequest = __webpack_require__(815); const handlePush = __webpack_require__(555); -const VERSION = __webpack_require__(775); +const VERSION = __webpack_require__(731).version; console.log(`Running twitter-together version ${VERSION}`); @@ -24915,8 +25000,8 @@ async function main() { consumer_key: process.env.TWITTER_API_KEY, consumer_secret: process.env.TWITTER_API_SECRET_KEY, access_token_key: process.env.TWITTER_ACCESS_TOKEN, - access_token_secret: process.env.TWITTER_ACCESS_TOKEN_SECRET - } + access_token_secret: process.env.TWITTER_ACCESS_TOKEN_SECRET, + }, }; switch (process.env.GITHUB_EVENT_NAME) { @@ -25183,7 +25268,7 @@ function write(key, options) { /* 540 */ /***/ (function(module) { -module.exports = {"name":"twitter","version":"1.7.1","description":"Twitter API client library for node.js","license":"MIT","keywords":["twitter","streaming","oauth"],"homepage":"https://github.com/desmondmorris/node-twitter","author":"Desmond Morris ","repository":{"type":"git","url":"https://github.com/desmondmorris/node-twitter"},"scripts":{"test":"npm run lint && mocha","lint":"./node_modules/.bin/eslint test/*.js lib/*.js"},"dependencies":{"deep-extend":"^0.5.0","request":"^2.72.0"},"devDependencies":{"eslint":"^3.12.0","mocha":"^3.2.0","nock":"^9.0.2"},"main":"./lib/twitter","_resolved":"https://registry.npmjs.org/twitter/-/twitter-1.7.1.tgz","_integrity":"sha1-B2I3jx3BwFDkj2ZqypBOJLGpYvQ=","_from":"twitter@1.7.1"}; +module.exports = {"_args":[["twitter@1.7.1","/home/jpauthier/workspace/twitter-together"]],"_from":"twitter@1.7.1","_id":"twitter@1.7.1","_inBundle":false,"_integrity":"sha1-B2I3jx3BwFDkj2ZqypBOJLGpYvQ=","_location":"/twitter","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"twitter@1.7.1","name":"twitter","escapedName":"twitter","rawSpec":"1.7.1","saveSpec":null,"fetchSpec":"1.7.1"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/twitter/-/twitter-1.7.1.tgz","_spec":"1.7.1","_where":"/home/jpauthier/workspace/twitter-together","author":{"name":"Desmond Morris","email":"hi@desmondmorris.com"},"bugs":{"url":"https://github.com/desmondmorris/node-twitter/issues"},"dependencies":{"deep-extend":"^0.5.0","request":"^2.72.0"},"description":"Twitter API client library for node.js","devDependencies":{"eslint":"^3.12.0","mocha":"^3.2.0","nock":"^9.0.2"},"homepage":"https://github.com/desmondmorris/node-twitter","keywords":["twitter","streaming","oauth"],"license":"MIT","main":"./lib/twitter","name":"twitter","repository":{"type":"git","url":"git+https://github.com/desmondmorris/node-twitter.git"},"scripts":{"lint":"eslint test/*.js lib/*.js","test":"npm run lint && mocha"},"version":"1.7.1"}; /***/ }), /* 541 */, @@ -25806,7 +25891,11 @@ async function handlePush(state) { console.log(`error`); console.log(error); - tweetErrors.push(error[0]); + if (Array.isArray(error)) { + tweetErrors.push(error[0]); + } else { + tweetErrors.push(error); + } } } @@ -25818,7 +25907,7 @@ async function handlePush(state) { tweetErrors.forEach(toolkit.error); await addComment( state, - "Errors:\n\n- " + tweetErrors.map(error => error.message).join("\n- ") + "Errors:\n\n- " + tweetErrors.map((error) => error.message).join("\n- ") ); return toolkit.setFailed("Error tweeting"); } @@ -25830,7 +25919,7 @@ async function handlePush(state) { /* 557 */ /***/ (function(module) { -// Generated by CoffeeScript 2.4.1 +// Generated by CoffeeScript 2.5.1 // parses unified diff // http://www.gnu.org/software/diffutils/manual/diffutils.html#Unified-Format var defaultToWhiteSpace, escapeRegExp, ltrim, makeString, parseFile, parseFileFallback, trimLeft, @@ -25986,9 +26075,9 @@ parseFile = function(s) { if (!s) { return; } - fileNames = s.match(/a\/.*(?= b)|b\/.*$/g); + fileNames = s.match(/a\/.*(?=["']? ["']?b\/)|b\/.*$/g); fileNames.map(function(fileName, i) { - return fileNames[i] = fileName.replace(/^(a|b)\//, ''); + return fileNames[i] = fileName.replace(/^(a|b)\//, '').replace(/("|')$/, ''); }); return fileNames; }; @@ -26431,7 +26520,7 @@ var _validCCTLD = __webpack_require__(662); var _validCCTLD2 = _interopRequireDefault(_validCCTLD); -var _validDomainName = __webpack_require__(299); +var _validDomainName = __webpack_require__(178); var _validDomainName2 = _interopRequireDefault(_validDomainName); @@ -26804,7 +26893,7 @@ async function tweet({ twitterCredentials }, tweetFile) { const { card_uri } = await createPoll(client, { name: tweetFile.filename, - pollOptions: tweet.poll + pollOptions: tweet.poll, }); return createTweet(client, { status: tweet.text, card_uri }); @@ -26815,7 +26904,7 @@ function createPoll( { name, text, - pollOptions: [first_choice, second_choice, third_choice, fourth_choice] + pollOptions: [first_choice, second_choice, third_choice, fourth_choice], } ) { return new Promise((resolve, reject) => { @@ -26829,7 +26918,7 @@ function createPoll( second_choice, third_choice, fourth_choice, - text + text, }, (error, result) => { /* istanbul ignore if */ @@ -26852,7 +26941,7 @@ function createTweet(client, options) { resolve({ text: options.status, - url: `https://twitter.com/${result.user.screen_name}/status/${result.id_str}` + url: `https://twitter.com/${result.user.screen_name}/status/${result.id_str}`, }); }); }); @@ -27403,12 +27492,12 @@ Object.defineProperty(exports, '__esModule', { value: true }); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var endpoint = __webpack_require__(475); -var universalUserAgent = __webpack_require__(796); +var universalUserAgent = __webpack_require__(848); var isPlainObject = _interopDefault(__webpack_require__(696)); var nodeFetch = _interopDefault(__webpack_require__(454)); var requestError = __webpack_require__(463); -const VERSION = "5.3.1"; +const VERSION = "5.3.2"; function getBufferResponse(response) { return response.arrayBuffer(); @@ -27438,7 +27527,7 @@ function fetchWrapper(requestOptions) { if (status === 204 || status === 205) { return; - } // GitHub API returns 200 for HEAD requsets + } // GitHub API returns 200 for HEAD requests if (requestOptions.method === "HEAD") { @@ -27469,7 +27558,7 @@ function fetchWrapper(requestOptions) { try { let responseBody = JSON.parse(error.message); Object.assign(error, responseBody); - let errors = responseBody.errors; // Assumption `errors` would always be in Array Fotmat + let errors = responseBody.errors; // Assumption `errors` would always be in Array format error.message = error.message + ": " + errors.map(JSON.stringify).join(", "); } catch (e) {// ignore, see octokit/rest.js#684 @@ -27563,7 +27652,7 @@ function addComment({ octokit, payload }, body) { owner: payload.repository.owner.login, repo: payload.repository.name, sha: payload.head_commit.id, - body + body, }); } @@ -28977,12 +29066,12 @@ Object.defineProperty(exports, '__esModule', { value: true }); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var endpoint = __webpack_require__(521); -var universalUserAgent = __webpack_require__(796); +var universalUserAgent = __webpack_require__(496); var isPlainObject = _interopDefault(__webpack_require__(696)); var nodeFetch = _interopDefault(__webpack_require__(454)); var requestError = __webpack_require__(463); -const VERSION = "5.3.1"; +const VERSION = "5.3.2"; function getBufferResponse(response) { return response.arrayBuffer(); @@ -29012,7 +29101,7 @@ function fetchWrapper(requestOptions) { if (status === 204 || status === 205) { return; - } // GitHub API returns 200 for HEAD requsets + } // GitHub API returns 200 for HEAD requests if (requestOptions.method === "HEAD") { @@ -29043,7 +29132,7 @@ function fetchWrapper(requestOptions) { try { let responseBody = JSON.parse(error.message); Object.assign(error, responseBody); - let errors = responseBody.errors; // Assumption `errors` would always be in Array Fotmat + let errors = responseBody.errors; // Assumption `errors` would always be in Array format error.message = error.message + ": " + errors.map(JSON.stringify).join(", "); } catch (e) {// ignore, see octokit/rest.js#684 @@ -30131,7 +30220,7 @@ var aws4 = exports, url = __webpack_require__(835), querystring = __webpack_require__(191), crypto = __webpack_require__(417), - lru = __webpack_require__(178), + lru = __webpack_require__(951), credentialsCache = lru(1000) // http://docs.amazonwebservices.com/general/latest/gr/signature-version-4.html @@ -33683,10 +33772,12 @@ Object.defineProperty(exports, '__esModule', { value: true }); var core = __webpack_require__(448); var authAction = __webpack_require__(414); +var pluginPaginateRest = __webpack_require__(299); +var pluginRestEndpointMethods = __webpack_require__(842); -const VERSION = "1.0.3"; +const VERSION = "2.0.0"; -const Octokit = core.Octokit.defaults({ +const Octokit = core.Octokit.plugin([pluginPaginateRest.paginateRest, pluginRestEndpointMethods.restEndpointMethods]).defaults({ authStrategy: authAction.createActionAuth, userAgent: `octokit-action.js/${VERSION}` }); @@ -33735,7 +33826,12 @@ module.exports = exports["default"]; /***/ }), /* 730 */, -/* 731 */, +/* 731 */ +/***/ (function(module) { + +module.exports = {"name":"twitter-together","version":"0.0.0-development","description":"A GitHub action to tweet together using pull requests","main":"lib/index.js","scripts":{"build":"ncc build lib/index.js -o dist","coverage":"nyc report --reporter=html && open coverage/index.html","lint":"prettier --check '{lib,test}/**/*.js' 'docs/*.md' 'tweets/README.md' README.md package.json","lint:fix":"prettier --write '{lib,test}/**/*.js' 'docs/*.md' 'tweets/README.md' README.md package.json","test":"tap --100 test/*/test.js","posttest":"npm run -s lint"},"keywords":[],"author":"","license":"MIT","dependencies":{"@actions/core":"1.2.4","@octokit/action":"^2.0.0","parse-diff":"^0.7.0","twitter":"^1.7.1","twitter-text":"^3.0.0"},"devDependencies":{"@semantic-release/git":"^9.0.0","@zeit/ncc":"^0.22.0","nock":"^12.0.0","prettier":"^2.0.1","semantic-release":"^17.0.0","tap":"^14.10.7"},"repository":{"type":"git","url":"https://github.com/gr2m/tweet-together.git"},"release":{"plugins":["@semantic-release/commit-analyzer","@semantic-release/release-notes-generator","@semantic-release/github",["@semantic-release/git",{"assets":["package.json","dist/index.js"],"message":"build(release): compiled action for ${nextRelease.version}\n\n[skip ci]"}]]}}; + +/***/ }), /* 732 */, /* 733 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -35634,13 +35730,7 @@ module.exports = function generate__limitLength(it, $keyword, $ruleType) { /***/ }), /* 773 */, /* 774 */, -/* 775 */ -/***/ (function(module) { - -module.exports = "0.0.0-development"; - - -/***/ }), +/* 775 */, /* 776 */ /***/ (function(module) { @@ -36173,8 +36263,8 @@ async function setup({ toolkit, octokit, payload, sha }) { repo: payload.repository.name, ref: "heads/twitter-together-setup", request: { - expectStatus: 404 - } + expectStatus: 404, + }, }); // If it does, the script assumes that the setup pull requset already exists @@ -36190,7 +36280,7 @@ async function setup({ toolkit, octokit, payload, sha }) { owner: payload.repository.owner.login, repo: payload.repository.name, ref: "refs/heads/twitter-together-setup", - sha + sha, }); toolkit.info('"twitter-together-setup" branch created'); @@ -36200,11 +36290,11 @@ async function setup({ toolkit, octokit, payload, sha }) { "GET /repos/:owner/:repo/contents/:path", { mediaType: { - format: "raw" + format: "raw", }, owner: "gr2m", repo: "twitter-together", - path: "tweets/README.md" + path: "tweets/README.md", } ); // https://developer.github.com/v3/repos/contents/#create-or-update-a-file @@ -36214,7 +36304,7 @@ async function setup({ toolkit, octokit, payload, sha }) { path: "tweets/README.md", content: Buffer.from(readmeContent).toString("base64"), branch: "twitter-together-setup", - message: "twitter-together setup" + message: "twitter-together setup", }); toolkit.info('"tweets/README.md" created in "twitter-together-setup" branch'); @@ -36230,7 +36320,7 @@ Note that if you plan to support tweets with polls, your twitter app has to be a Enjoy!`, head: "twitter-together-setup", - base: payload.repository.default_branch + base: payload.repository.default_branch, }); toolkit.info(`Setup pull request created: ${pr.html_url}`); } @@ -36930,7 +37020,7 @@ async function handlePullRequest(state) { } // on request errors, log the requset options and error, then end process - octokit.hook.error("request", error => { + octokit.hook.error("request", (error) => { toolkit.info(error); toolkit.setFailed(error.stack); process.exit(); @@ -37310,7 +37400,1174 @@ module.exports = require("url"); /* 839 */, /* 840 */, /* 841 */, -/* 842 */, +/* 842 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + + +Object.defineProperty(exports, '__esModule', { value: true }); + +const Endpoints = { + actions: { + cancelWorkflowRun: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel"], + createOrUpdateSecretForRepo: ["PUT /repos/{owner}/{repo}/actions/secrets/{name}"], + createRegistrationToken: ["POST /repos/{owner}/{repo}/actions/runners/registration-token"], + createRemoveToken: ["POST /repos/{owner}/{repo}/actions/runners/remove-token"], + deleteArtifact: ["DELETE /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"], + deleteSecretFromRepo: ["DELETE /repos/{owner}/{repo}/actions/secrets/{name}"], + downloadArtifact: ["GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format}"], + getArtifact: ["GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}"], + getPublicKey: ["GET /repos/{owner}/{repo}/actions/secrets/public-key"], + getSecret: ["GET /repos/{owner}/{repo}/actions/secrets/{name}"], + getSelfHostedRunner: ["GET /repos/{owner}/{repo}/actions/runners/{runner_id}"], + getWorkflow: ["GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}"], + getWorkflowJob: ["GET /repos/{owner}/{repo}/actions/jobs/{job_id}"], + getWorkflowRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}"], + listArtifactsForRepo: ["GET /repos/{owner}/{repo}/actions/artifacts"], + listDownloadsForSelfHostedRunnerApplication: ["GET /repos/{owner}/{repo}/actions/runners/downloads"], + listJobsForWorkflowRun: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs"], + listRepoWorkflowRuns: ["GET /repos/{owner}/{repo}/actions/runs"], + listRepoWorkflows: ["GET /repos/{owner}/{repo}/actions/workflows"], + listSecretsForRepo: ["GET /repos/{owner}/{repo}/actions/secrets"], + listSelfHostedRunnersForRepo: ["GET /repos/{owner}/{repo}/actions/runners"], + listWorkflowJobLogs: ["GET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs"], + listWorkflowRunArtifacts: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts"], + listWorkflowRunLogs: ["GET /repos/{owner}/{repo}/actions/runs/{run_id}/logs"], + listWorkflowRuns: ["GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs"], + reRunWorkflow: ["POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun"], + removeSelfHostedRunner: ["DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}"] + }, + activity: { + checkStarringRepo: ["GET /user/starred/{owner}/{repo}"], + deleteRepoSubscription: ["DELETE /repos/{owner}/{repo}/subscription"], + deleteThreadSubscription: ["DELETE /notifications/threads/{thread_id}/subscription"], + getRepoSubscription: ["GET /repos/{owner}/{repo}/subscription"], + getThread: ["GET /notifications/threads/{thread_id}"], + getThreadSubscription: ["GET /notifications/threads/{thread_id}/subscription"], + listEventsForOrg: ["GET /users/{username}/events/orgs/{org}"], + listEventsForUser: ["GET /users/{username}/events"], + listFeeds: ["GET /feeds"], + listNotifications: ["GET /notifications"], + listNotificationsForRepo: ["GET /repos/{owner}/{repo}/notifications"], + listPublicEvents: ["GET /events"], + listPublicEventsForOrg: ["GET /orgs/{org}/events"], + listPublicEventsForRepoNetwork: ["GET /networks/{owner}/{repo}/events"], + listPublicEventsForUser: ["GET /users/{username}/events/public"], + listReceivedEventsForUser: ["GET /users/{username}/received_events"], + listReceivedPublicEventsForUser: ["GET /users/{username}/received_events/public"], + listRepoEvents: ["GET /repos/{owner}/{repo}/events"], + listReposStarredByAuthenticatedUser: ["GET /user/starred"], + listReposStarredByUser: ["GET /users/{username}/starred"], + listReposWatchedByUser: ["GET /users/{username}/subscriptions"], + listStargazersForRepo: ["GET /repos/{owner}/{repo}/stargazers"], + listWatchedReposForAuthenticatedUser: ["GET /user/subscriptions"], + listWatchersForRepo: ["GET /repos/{owner}/{repo}/subscribers"], + markAsRead: ["PUT /notifications"], + markNotificationsAsReadForRepo: ["PUT /repos/{owner}/{repo}/notifications"], + markThreadAsRead: ["PATCH /notifications/threads/{thread_id}"], + setRepoSubscription: ["PUT /repos/{owner}/{repo}/subscription"], + setThreadSubscription: ["PUT /notifications/threads/{thread_id}/subscription"], + starRepo: ["PUT /user/starred/{owner}/{repo}"], + unstarRepo: ["DELETE /user/starred/{owner}/{repo}"] + }, + apps: { + addRepoToInstallation: ["PUT /user/installations/{installation_id}/repositories/{repository_id}", { + mediaType: { + previews: ["machine-man"] + } + }], + checkAccountIsAssociatedWithAny: ["GET /marketplace_listing/accounts/{account_id}"], + checkAccountIsAssociatedWithAnyStubbed: ["GET /marketplace_listing/stubbed/accounts/{account_id}"], + checkToken: ["POST /applications/{client_id}/token", { + mediaType: { + previews: ["doctor-strange"] + } + }], + createContentAttachment: ["POST /content_references/{content_reference_id}/attachments", { + mediaType: { + previews: ["corsair"] + } + }], + createFromManifest: ["POST /app-manifests/{code}/conversions", { + mediaType: { + previews: ["fury"] + } + }], + createInstallationToken: ["POST /app/installations/{installation_id}/access_tokens", { + mediaType: { + previews: ["machine-man"] + } + }], + deleteAuthorization: ["DELETE /applications/{client_id}/grant", { + mediaType: { + previews: ["doctor-strange"] + } + }], + deleteInstallation: ["DELETE /app/installations/{installation_id}", { + mediaType: { + previews: ["gambit", "machine-man"] + } + }], + deleteToken: ["DELETE /applications/{client_id}/token", { + mediaType: { + previews: ["doctor-strange"] + } + }], + getAuthenticated: ["GET /app", { + mediaType: { + previews: ["machine-man"] + } + }], + getBySlug: ["GET /apps/{app_slug}", { + mediaType: { + previews: ["machine-man"] + } + }], + getInstallation: ["GET /app/installations/{installation_id}", { + mediaType: { + previews: ["machine-man"] + } + }], + getOrgInstallation: ["GET /orgs/{org}/installation", { + mediaType: { + previews: ["machine-man"] + } + }], + getRepoInstallation: ["GET /repos/{owner}/{repo}/installation", { + mediaType: { + previews: ["machine-man"] + } + }], + getUserInstallation: ["GET /users/{username}/installation", { + mediaType: { + previews: ["machine-man"] + } + }], + listAccountsUserOrOrgOnPlan: ["GET /marketplace_listing/plans/{plan_id}/accounts"], + listAccountsUserOrOrgOnPlanStubbed: ["GET /marketplace_listing/stubbed/plans/{plan_id}/accounts"], + listInstallationReposForAuthenticatedUser: ["GET /user/installations/{installation_id}/repositories", { + mediaType: { + previews: ["machine-man"] + } + }], + listInstallations: ["GET /app/installations", { + mediaType: { + previews: ["machine-man"] + } + }], + listInstallationsForAuthenticatedUser: ["GET /user/installations", { + mediaType: { + previews: ["machine-man"] + } + }], + listMarketplacePurchasesForAuthenticatedUser: ["GET /user/marketplace_purchases"], + listMarketplacePurchasesForAuthenticatedUserStubbed: ["GET /user/marketplace_purchases/stubbed"], + listPlans: ["GET /marketplace_listing/plans"], + listPlansStubbed: ["GET /marketplace_listing/stubbed/plans"], + listRepos: ["GET /installation/repositories", { + mediaType: { + previews: ["machine-man"] + } + }], + removeRepoFromInstallation: ["DELETE /user/installations/{installation_id}/repositories/{repository_id}", { + mediaType: { + previews: ["machine-man"] + } + }], + resetToken: ["PATCH /applications/{client_id}/token", { + mediaType: { + previews: ["doctor-strange"] + } + }], + revokeInstallationToken: ["DELETE /installation/token", { + mediaType: { + previews: ["gambit"] + } + }] + }, + checks: { + create: ["POST /repos/{owner}/{repo}/check-runs", { + mediaType: { + previews: ["antiope"] + } + }], + createSuite: ["POST /repos/{owner}/{repo}/check-suites", { + mediaType: { + previews: ["antiope"] + } + }], + get: ["GET /repos/{owner}/{repo}/check-runs/{check_run_id}", { + mediaType: { + previews: ["antiope"] + } + }], + getSuite: ["GET /repos/{owner}/{repo}/check-suites/{check_suite_id}", { + mediaType: { + previews: ["antiope"] + } + }], + listAnnotations: ["GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations", { + mediaType: { + previews: ["antiope"] + } + }], + listForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/check-runs", { + mediaType: { + previews: ["antiope"] + } + }], + listForSuite: ["GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs", { + mediaType: { + previews: ["antiope"] + } + }], + listSuitesForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/check-suites", { + mediaType: { + previews: ["antiope"] + } + }], + rerequestSuite: ["POST /repos/{owner}/{repo}/check-suites/{check_suite_id}/rerequest", { + mediaType: { + previews: ["antiope"] + } + }], + setSuitesPreferences: ["PATCH /repos/{owner}/{repo}/check-suites/preferences", { + mediaType: { + previews: ["antiope"] + } + }], + update: ["PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}", { + mediaType: { + previews: ["antiope"] + } + }] + }, + codesOfConduct: { + getConductCode: ["GET /codes_of_conduct/{key}", { + mediaType: { + previews: ["scarlet-witch"] + } + }], + getForRepo: ["GET /repos/{owner}/{repo}/community/code_of_conduct", { + mediaType: { + previews: ["scarlet-witch"] + } + }], + listConductCodes: ["GET /codes_of_conduct", { + mediaType: { + previews: ["scarlet-witch"] + } + }] + }, + emojis: { + get: ["GET /emojis"] + }, + gists: { + checkIsStarred: ["GET /gists/{gist_id}/star"], + create: ["POST /gists"], + createComment: ["POST /gists/{gist_id}/comments"], + delete: ["DELETE /gists/{gist_id}"], + deleteComment: ["DELETE /gists/{gist_id}/comments/{comment_id}"], + fork: ["POST /gists/{gist_id}/forks"], + get: ["GET /gists/{gist_id}"], + getComment: ["GET /gists/{gist_id}/comments/{comment_id}"], + getRevision: ["GET /gists/{gist_id}/{sha}"], + list: ["GET /gists"], + listComments: ["GET /gists/{gist_id}/comments"], + listCommits: ["GET /gists/{gist_id}/commits"], + listForks: ["GET /gists/{gist_id}/forks"], + listPublic: ["GET /gists/public"], + listPublicForUser: ["GET /users/{username}/gists"], + listStarred: ["GET /gists/starred"], + star: ["PUT /gists/{gist_id}/star"], + unstar: ["DELETE /gists/{gist_id}/star"], + update: ["PATCH /gists/{gist_id}"], + updateComment: ["PATCH /gists/{gist_id}/comments/{comment_id}"] + }, + git: { + createBlob: ["POST /repos/{owner}/{repo}/git/blobs"], + createCommit: ["POST /repos/{owner}/{repo}/git/commits"], + createRef: ["POST /repos/{owner}/{repo}/git/refs"], + createTag: ["POST /repos/{owner}/{repo}/git/tags"], + createTree: ["POST /repos/{owner}/{repo}/git/trees"], + deleteRef: ["DELETE /repos/{owner}/{repo}/git/refs/{ref}"], + getBlob: ["GET /repos/{owner}/{repo}/git/blobs/{file_sha}"], + getCommit: ["GET /repos/{owner}/{repo}/git/commits/{commit_sha}"], + getRef: ["GET /repos/{owner}/{repo}/git/ref/{ref}"], + getTag: ["GET /repos/{owner}/{repo}/git/tags/{tag_sha}"], + getTree: ["GET /repos/{owner}/{repo}/git/trees/{tree_sha}"], + listMatchingRefs: ["GET /repos/{owner}/{repo}/git/matching-refs/{ref}"], + updateRef: ["PATCH /repos/{owner}/{repo}/git/refs/{ref}"] + }, + gitignore: { + getTemplate: ["GET /gitignore/templates/{name}"], + listTemplates: ["GET /gitignore/templates"] + }, + interactions: { + addOrUpdateRestrictionsForOrg: ["PUT /orgs/{org}/interaction-limits", { + mediaType: { + previews: ["sombra"] + } + }], + addOrUpdateRestrictionsForRepo: ["PUT /repos/{owner}/{repo}/interaction-limits", { + mediaType: { + previews: ["sombra"] + } + }], + getRestrictionsForOrg: ["GET /orgs/{org}/interaction-limits", { + mediaType: { + previews: ["sombra"] + } + }], + getRestrictionsForRepo: ["GET /repos/{owner}/{repo}/interaction-limits", { + mediaType: { + previews: ["sombra"] + } + }], + removeRestrictionsForOrg: ["DELETE /orgs/{org}/interaction-limits", { + mediaType: { + previews: ["sombra"] + } + }], + removeRestrictionsForRepo: ["DELETE /repos/{owner}/{repo}/interaction-limits", { + mediaType: { + previews: ["sombra"] + } + }] + }, + issues: { + addAssignees: ["POST /repos/{owner}/{repo}/issues/{issue_number}/assignees"], + addLabels: ["POST /repos/{owner}/{repo}/issues/{issue_number}/labels"], + checkAssignee: ["GET /repos/{owner}/{repo}/assignees/{assignee}"], + create: ["POST /repos/{owner}/{repo}/issues"], + createComment: ["POST /repos/{owner}/{repo}/issues/{issue_number}/comments"], + createLabel: ["POST /repos/{owner}/{repo}/labels"], + createMilestone: ["POST /repos/{owner}/{repo}/milestones"], + deleteComment: ["DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}"], + deleteLabel: ["DELETE /repos/{owner}/{repo}/labels/{name}"], + deleteMilestone: ["DELETE /repos/{owner}/{repo}/milestones/{milestone_number}"], + get: ["GET /repos/{owner}/{repo}/issues/{issue_number}"], + getComment: ["GET /repos/{owner}/{repo}/issues/comments/{comment_id}"], + getEvent: ["GET /repos/{owner}/{repo}/issues/events/{event_id}"], + getLabel: ["GET /repos/{owner}/{repo}/labels/{name}"], + getMilestone: ["GET /repos/{owner}/{repo}/milestones/{milestone_number}"], + list: ["GET /issues"], + listAssignees: ["GET /repos/{owner}/{repo}/assignees"], + listComments: ["GET /repos/{owner}/{repo}/issues/{issue_number}/comments"], + listCommentsForRepo: ["GET /repos/{owner}/{repo}/issues/comments"], + listEvents: ["GET /repos/{owner}/{repo}/issues/{issue_number}/events"], + listEventsForRepo: ["GET /repos/{owner}/{repo}/issues/events"], + listEventsForTimeline: ["GET /repos/{owner}/{repo}/issues/{issue_number}/timeline", { + mediaType: { + previews: ["mockingbird"] + } + }], + listForAuthenticatedUser: ["GET /user/issues"], + listForOrg: ["GET /orgs/{org}/issues"], + listForRepo: ["GET /repos/{owner}/{repo}/issues"], + listLabelsForMilestone: ["GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels"], + listLabelsForRepo: ["GET /repos/{owner}/{repo}/labels"], + listLabelsOnIssue: ["GET /repos/{owner}/{repo}/issues/{issue_number}/labels"], + listMilestonesForRepo: ["GET /repos/{owner}/{repo}/milestones"], + lock: ["PUT /repos/{owner}/{repo}/issues/{issue_number}/lock"], + removeAssignees: ["DELETE /repos/{owner}/{repo}/issues/{issue_number}/assignees"], + removeLabel: ["DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name}"], + removeLabels: ["DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels"], + replaceLabels: ["PUT /repos/{owner}/{repo}/issues/{issue_number}/labels"], + unlock: ["DELETE /repos/{owner}/{repo}/issues/{issue_number}/lock"], + update: ["PATCH /repos/{owner}/{repo}/issues/{issue_number}"], + updateComment: ["PATCH /repos/{owner}/{repo}/issues/comments/{comment_id}"], + updateLabel: ["PATCH /repos/{owner}/{repo}/labels/{name}"], + updateMilestone: ["PATCH /repos/{owner}/{repo}/milestones/{milestone_number}"] + }, + licenses: { + get: ["GET /licenses/{license}"], + getForRepo: ["GET /repos/{owner}/{repo}/license"], + listCommonlyUsed: ["GET /licenses"] + }, + markdown: { + render: ["POST /markdown"], + renderRaw: ["POST /markdown/raw", { + headers: { + "content-type": "text/plain; charset=utf-8" + } + }] + }, + meta: { + get: ["GET /meta"] + }, + migrations: { + cancelImport: ["DELETE /repos/{owner}/{repo}/import"], + deleteArchiveForAuthenticatedUser: ["DELETE /user/migrations/{migration_id}/archive", { + mediaType: { + previews: ["wyandotte"] + } + }], + deleteArchiveForOrg: ["DELETE /orgs/{org}/migrations/{migration_id}/archive", { + mediaType: { + previews: ["wyandotte"] + } + }], + downloadArchiveForOrg: ["GET /orgs/{org}/migrations/{migration_id}/archive", { + mediaType: { + previews: ["wyandotte"] + } + }], + getArchiveForAuthenticatedUser: ["GET /user/migrations/{migration_id}/archive", { + mediaType: { + previews: ["wyandotte"] + } + }], + getCommitAuthors: ["GET /repos/{owner}/{repo}/import/authors"], + getImportProgress: ["GET /repos/{owner}/{repo}/import"], + getLargeFiles: ["GET /repos/{owner}/{repo}/import/large_files"], + getStatusForAuthenticatedUser: ["GET /user/migrations/{migration_id}", { + mediaType: { + previews: ["wyandotte"] + } + }], + getStatusForOrg: ["GET /orgs/{org}/migrations/{migration_id}", { + mediaType: { + previews: ["wyandotte"] + } + }], + listForAuthenticatedUser: ["GET /user/migrations", { + mediaType: { + previews: ["wyandotte"] + } + }], + listForOrg: ["GET /orgs/{org}/migrations", { + mediaType: { + previews: ["wyandotte"] + } + }], + listReposForOrg: ["GET /orgs/{org}/migrations/{migration_id}/repositories", { + mediaType: { + previews: ["wyandotte"] + } + }], + listReposForUser: ["GET /user/{migration_id}/repositories", { + mediaType: { + previews: ["wyandotte"] + } + }], + mapCommitAuthor: ["PATCH /repos/{owner}/{repo}/import/authors/{author_id}"], + setLfsPreference: ["PATCH /repos/{owner}/{repo}/import/lfs"], + startForAuthenticatedUser: ["POST /user/migrations"], + startForOrg: ["POST /orgs/{org}/migrations"], + startImport: ["PUT /repos/{owner}/{repo}/import"], + unlockRepoForAuthenticatedUser: ["DELETE /user/migrations/{migration_id}/repos/{repo_name}/lock", { + mediaType: { + previews: ["wyandotte"] + } + }], + unlockRepoForOrg: ["DELETE /orgs/{org}/migrations/{migration_id}/repos/{repo_name}/lock", { + mediaType: { + previews: ["wyandotte"] + } + }], + updateImport: ["PATCH /repos/{owner}/{repo}/import"] + }, + orgs: { + addOrUpdateMembership: ["PUT /orgs/{org}/memberships/{username}"], + blockUser: ["PUT /orgs/{org}/blocks/{username}"], + checkBlockedUser: ["GET /orgs/{org}/blocks/{username}"], + checkMembership: ["GET /orgs/{org}/members/{username}"], + checkPublicMembership: ["GET /orgs/{org}/public_members/{username}"], + concealMembership: ["DELETE /orgs/{org}/public_members/{username}"], + convertMemberToOutsideCollaborator: ["PUT /orgs/{org}/outside_collaborators/{username}"], + createHook: ["POST /orgs/{org}/hooks"], + createInvitation: ["POST /orgs/{org}/invitations"], + deleteHook: ["DELETE /orgs/{org}/hooks/{hook_id}"], + get: ["GET /orgs/{org}"], + getHook: ["GET /orgs/{org}/hooks/{hook_id}"], + getMembership: ["GET /orgs/{org}/memberships/{username}"], + getMembershipForAuthenticatedUser: ["GET /user/memberships/orgs/{org}"], + list: ["GET /organizations"], + listBlockedUsers: ["GET /orgs/{org}/blocks"], + listForAuthenticatedUser: ["GET /user/orgs"], + listForUser: ["GET /users/{username}/orgs"], + listHooks: ["GET /orgs/{org}/hooks"], + listInstallations: ["GET /orgs/{org}/installations", { + mediaType: { + previews: ["machine-man"] + } + }], + listInvitationTeams: ["GET /orgs/{org}/invitations/{invitation_id}/teams"], + listMembers: ["GET /orgs/{org}/members"], + listMemberships: ["GET /user/memberships/orgs"], + listOutsideCollaborators: ["GET /orgs/{org}/outside_collaborators"], + listPendingInvitations: ["GET /orgs/{org}/invitations"], + listPublicMembers: ["GET /orgs/{org}/public_members"], + pingHook: ["POST /orgs/{org}/hooks/{hook_id}/pings"], + publicizeMembership: ["PUT /orgs/{org}/public_members/{username}"], + removeMember: ["DELETE /orgs/{org}/members/{username}"], + removeMembership: ["DELETE /orgs/{org}/memberships/{username}"], + removeOutsideCollaborator: ["DELETE /orgs/{org}/outside_collaborators/{username}"], + unblockUser: ["DELETE /orgs/{org}/blocks/{username}"], + update: ["PATCH /orgs/{org}"], + updateHook: ["PATCH /orgs/{org}/hooks/{hook_id}"], + updateMembership: ["PATCH /user/memberships/orgs/{org}"] + }, + projects: { + addCollaborator: ["PUT /projects/{project_id}/collaborators/{username}", { + mediaType: { + previews: ["inertia"] + } + }], + createCard: ["POST /projects/columns/{column_id}/cards", { + mediaType: { + previews: ["inertia"] + } + }], + createColumn: ["POST /projects/{project_id}/columns", { + mediaType: { + previews: ["inertia"] + } + }], + createForAuthenticatedUser: ["POST /user/projects", { + mediaType: { + previews: ["inertia"] + } + }], + createForOrg: ["POST /orgs/{org}/projects", { + mediaType: { + previews: ["inertia"] + } + }], + createForRepo: ["POST /repos/{owner}/{repo}/projects", { + mediaType: { + previews: ["inertia"] + } + }], + delete: ["DELETE /projects/{project_id}", { + mediaType: { + previews: ["inertia"] + } + }], + deleteCard: ["DELETE /projects/columns/cards/{card_id}", { + mediaType: { + previews: ["inertia"] + } + }], + deleteColumn: ["DELETE /projects/columns/{column_id}", { + mediaType: { + previews: ["inertia"] + } + }], + get: ["GET /projects/{project_id}", { + mediaType: { + previews: ["inertia"] + } + }], + getCard: ["GET /projects/columns/cards/{card_id}", { + mediaType: { + previews: ["inertia"] + } + }], + getColumn: ["GET /projects/columns/{column_id}", { + mediaType: { + previews: ["inertia"] + } + }], + listCards: ["GET /projects/columns/{column_id}/cards", { + mediaType: { + previews: ["inertia"] + } + }], + listCollaborators: ["GET /projects/{project_id}/collaborators", { + mediaType: { + previews: ["inertia"] + } + }], + listColumns: ["GET /projects/{project_id}/columns", { + mediaType: { + previews: ["inertia"] + } + }], + listForOrg: ["GET /orgs/{org}/projects", { + mediaType: { + previews: ["inertia"] + } + }], + listForRepo: ["GET /repos/{owner}/{repo}/projects", { + mediaType: { + previews: ["inertia"] + } + }], + listForUser: ["GET /users/{username}/projects", { + mediaType: { + previews: ["inertia"] + } + }], + moveCard: ["POST /projects/columns/cards/{card_id}/moves", { + mediaType: { + previews: ["inertia"] + } + }], + moveColumn: ["POST /projects/columns/{column_id}/moves", { + mediaType: { + previews: ["inertia"] + } + }], + removeCollaborator: ["DELETE /projects/{project_id}/collaborators/{username}", { + mediaType: { + previews: ["inertia"] + } + }], + reviewUserPermissionLevel: ["GET /projects/{project_id}/collaborators/{username}/permission", { + mediaType: { + previews: ["inertia"] + } + }], + update: ["PATCH /projects/{project_id}", { + mediaType: { + previews: ["inertia"] + } + }], + updateCard: ["PATCH /projects/columns/cards/{card_id}", { + mediaType: { + previews: ["inertia"] + } + }], + updateColumn: ["PATCH /projects/columns/{column_id}", { + mediaType: { + previews: ["inertia"] + } + }] + }, + pulls: { + checkIfMerged: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/merge"], + create: ["POST /repos/{owner}/{repo}/pulls"], + createComment: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/comments"], + createReview: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews"], + createReviewCommentReply: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies"], + createReviewRequest: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers"], + deleteComment: ["DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}"], + deletePendingReview: ["DELETE /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"], + deleteReviewRequest: ["DELETE /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers"], + dismissReview: ["PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals"], + get: ["GET /repos/{owner}/{repo}/pulls/{pull_number}"], + getComment: ["GET /repos/{owner}/{repo}/pulls/comments/{comment_id}"], + getCommentsForReview: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments"], + getReview: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"], + list: ["GET /repos/{owner}/{repo}/pulls"], + listComments: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/comments"], + listCommentsForRepo: ["GET /repos/{owner}/{repo}/pulls/comments"], + listCommits: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/commits"], + listFiles: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/files"], + listReviewRequests: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers"], + listReviews: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews"], + merge: ["PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge"], + submitReview: ["POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events"], + update: ["PATCH /repos/{owner}/{repo}/pulls/{pull_number}"], + updateBranch: ["PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch", { + mediaType: { + previews: ["lydian"] + } + }], + updateComment: ["PATCH /repos/{owner}/{repo}/pulls/comments/{comment_id}"], + updateReview: ["PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}"] + }, + rateLimit: { + get: ["GET /rate_limit"] + }, + reactions: { + createForCommitComment: ["POST /repos/{owner}/{repo}/comments/{comment_id}/reactions", { + mediaType: { + previews: ["squirrel-girl"] + } + }], + createForIssue: ["POST /repos/{owner}/{repo}/issues/{issue_number}/reactions", { + mediaType: { + previews: ["squirrel-girl"] + } + }], + createForIssueComment: ["POST /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions", { + mediaType: { + previews: ["squirrel-girl"] + } + }], + createForPullRequestReviewComment: ["POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions", { + mediaType: { + previews: ["squirrel-girl"] + } + }], + createForTeamDiscussionCommentInOrg: ["POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions", { + mediaType: { + previews: ["squirrel-girl"] + } + }], + createForTeamDiscussionInOrg: ["POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions", { + mediaType: { + previews: ["squirrel-girl"] + } + }], + delete: ["DELETE /reactions/{reaction_id}", { + mediaType: { + previews: ["squirrel-girl"] + } + }], + listForCommitComment: ["GET /repos/{owner}/{repo}/comments/{comment_id}/reactions", { + mediaType: { + previews: ["squirrel-girl"] + } + }], + listForIssue: ["GET /repos/{owner}/{repo}/issues/{issue_number}/reactions", { + mediaType: { + previews: ["squirrel-girl"] + } + }], + listForIssueComment: ["GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions", { + mediaType: { + previews: ["squirrel-girl"] + } + }], + listForPullRequestReviewComment: ["GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions", { + mediaType: { + previews: ["squirrel-girl"] + } + }], + listForTeamDiscussionCommentInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions", { + mediaType: { + previews: ["squirrel-girl"] + } + }], + listForTeamDiscussionInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions", { + mediaType: { + previews: ["squirrel-girl"] + } + }] + }, + repos: { + acceptInvitation: ["PATCH /user/repository_invitations/{invitation_id}"], + addCollaborator: ["PUT /repos/{owner}/{repo}/collaborators/{username}"], + addDeployKey: ["POST /repos/{owner}/{repo}/keys"], + addProtectedBranchAdminEnforcement: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"], + addProtectedBranchAppRestrictions: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps", {}, { + mapToData: "apps" + }], + addProtectedBranchRequiredSignatures: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures", { + mediaType: { + previews: ["zzzax"] + } + }], + addProtectedBranchRequiredStatusChecksContexts: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts", {}, { + mapToData: "contexts" + }], + addProtectedBranchTeamRestrictions: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams", {}, { + mapToData: "teams" + }], + addProtectedBranchUserRestrictions: ["POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users", {}, { + mapToData: "users" + }], + checkCollaborator: ["GET /repos/{owner}/{repo}/collaborators/{username}"], + checkVulnerabilityAlerts: ["GET /repos/{owner}/{repo}/vulnerability-alerts", { + mediaType: { + previews: ["dorian"] + } + }], + compareCommits: ["GET /repos/{owner}/{repo}/compare/{base}...{head}"], + createCommitComment: ["POST /repos/{owner}/{repo}/commits/{commit_sha}/comments"], + createDeployment: ["POST /repos/{owner}/{repo}/deployments"], + createDeploymentStatus: ["POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses"], + createDispatchEvent: ["POST /repos/{owner}/{repo}/dispatches"], + createForAuthenticatedUser: ["POST /user/repos"], + createFork: ["POST /repos/{owner}/{repo}/forks"], + createHook: ["POST /repos/{owner}/{repo}/hooks"], + createInOrg: ["POST /orgs/{org}/repos"], + createOrUpdateFile: ["PUT /repos/{owner}/{repo}/contents/{path}"], + createRelease: ["POST /repos/{owner}/{repo}/releases"], + createStatus: ["POST /repos/{owner}/{repo}/statuses/{sha}"], + createUsingTemplate: ["POST /repos/{template_owner}/{template_repo}/generate", { + mediaType: { + previews: ["baptiste"] + } + }], + declineInvitation: ["DELETE /user/repository_invitations/{invitation_id}"], + delete: ["DELETE /repos/{owner}/{repo}"], + deleteCommitComment: ["DELETE /repos/{owner}/{repo}/comments/{comment_id}"], + deleteDeployment: ["DELETE /repos/{owner}/{repo}/deployments/{deployment_id}"], + deleteDownload: ["DELETE /repos/{owner}/{repo}/downloads/{download_id}"], + deleteFile: ["DELETE /repos/{owner}/{repo}/contents/{path}"], + deleteHook: ["DELETE /repos/{owner}/{repo}/hooks/{hook_id}"], + deleteInvitation: ["DELETE /repos/{owner}/{repo}/invitations/{invitation_id}"], + deleteRelease: ["DELETE /repos/{owner}/{repo}/releases/{release_id}"], + deleteReleaseAsset: ["DELETE /repos/{owner}/{repo}/releases/assets/{asset_id}"], + disableAutomatedSecurityFixes: ["DELETE /repos/{owner}/{repo}/automated-security-fixes", { + mediaType: { + previews: ["london"] + } + }], + disablePagesSite: ["DELETE /repos/{owner}/{repo}/pages", { + mediaType: { + previews: ["switcheroo"] + } + }], + disableVulnerabilityAlerts: ["DELETE /repos/{owner}/{repo}/vulnerability-alerts", { + mediaType: { + previews: ["dorian"] + } + }], + enableAutomatedSecurityFixes: ["PUT /repos/{owner}/{repo}/automated-security-fixes", { + mediaType: { + previews: ["london"] + } + }], + enablePagesSite: ["POST /repos/{owner}/{repo}/pages", { + mediaType: { + previews: ["switcheroo"] + } + }], + enableVulnerabilityAlerts: ["PUT /repos/{owner}/{repo}/vulnerability-alerts", { + mediaType: { + previews: ["dorian"] + } + }], + get: ["GET /repos/{owner}/{repo}"], + getAppsWithAccessToProtectedBranch: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps"], + getArchiveLink: ["GET /repos/{owner}/{repo}/{archive_format}/{ref}"], + getBranch: ["GET /repos/{owner}/{repo}/branches/{branch}"], + getBranchProtection: ["GET /repos/{owner}/{repo}/branches/{branch}/protection"], + getClones: ["GET /repos/{owner}/{repo}/traffic/clones"], + getCodeFrequencyStats: ["GET /repos/{owner}/{repo}/stats/code_frequency"], + getCollaboratorPermissionLevel: ["GET /repos/{owner}/{repo}/collaborators/{username}/permission"], + getCombinedStatusForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/status"], + getCommit: ["GET /repos/{owner}/{repo}/commits/{ref}"], + getCommitActivityStats: ["GET /repos/{owner}/{repo}/stats/commit_activity"], + getCommitComment: ["GET /repos/{owner}/{repo}/comments/{comment_id}"], + getContents: ["GET /repos/{owner}/{repo}/contents/{path}"], + getContributorsStats: ["GET /repos/{owner}/{repo}/stats/contributors"], + getDeployKey: ["GET /repos/{owner}/{repo}/keys/{key_id}"], + getDeployment: ["GET /repos/{owner}/{repo}/deployments/{deployment_id}"], + getDeploymentStatus: ["GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses/{status_id}"], + getDownload: ["GET /repos/{owner}/{repo}/downloads/{download_id}"], + getHook: ["GET /repos/{owner}/{repo}/hooks/{hook_id}"], + getLatestPagesBuild: ["GET /repos/{owner}/{repo}/pages/builds/latest"], + getLatestRelease: ["GET /repos/{owner}/{repo}/releases/latest"], + getPages: ["GET /repos/{owner}/{repo}/pages"], + getPagesBuild: ["GET /repos/{owner}/{repo}/pages/builds/{build_id}"], + getParticipationStats: ["GET /repos/{owner}/{repo}/stats/participation"], + getProtectedBranchAdminEnforcement: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"], + getProtectedBranchPullRequestReviewEnforcement: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"], + getProtectedBranchRequiredSignatures: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures", { + mediaType: { + previews: ["zzzax"] + } + }], + getProtectedBranchRequiredStatusChecks: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"], + getProtectedBranchRestrictions: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions"], + getPunchCardStats: ["GET /repos/{owner}/{repo}/stats/punch_card"], + getReadme: ["GET /repos/{owner}/{repo}/readme"], + getRelease: ["GET /repos/{owner}/{repo}/releases/{release_id}"], + getReleaseAsset: ["GET /repos/{owner}/{repo}/releases/assets/{asset_id}"], + getReleaseByTag: ["GET /repos/{owner}/{repo}/releases/tags/{tag}"], + getTeamsWithAccessToProtectedBranch: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams"], + getTopPaths: ["GET /repos/{owner}/{repo}/traffic/popular/paths"], + getTopReferrers: ["GET /repos/{owner}/{repo}/traffic/popular/referrers"], + getUsersWithAccessToProtectedBranch: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users"], + getViews: ["GET /repos/{owner}/{repo}/traffic/views"], + list: ["GET /user/repos"], + listAssetsForRelease: ["GET /repos/{owner}/{repo}/releases/{release_id}/assets"], + listBranches: ["GET /repos/{owner}/{repo}/branches"], + listBranchesForHeadCommit: ["GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head", { + mediaType: { + previews: ["groot"] + } + }], + listCollaborators: ["GET /repos/{owner}/{repo}/collaborators"], + listCommentsForCommit: ["GET /repos/{owner}/{repo}/commits/{commit_sha}/comments"], + listCommitComments: ["GET /repos/{owner}/{repo}/comments"], + listCommits: ["GET /repos/{owner}/{repo}/commits"], + listContributors: ["GET /repos/{owner}/{repo}/contributors"], + listDeployKeys: ["GET /repos/{owner}/{repo}/keys"], + listDeploymentStatuses: ["GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses"], + listDeployments: ["GET /repos/{owner}/{repo}/deployments"], + listDownloads: ["GET /repos/{owner}/{repo}/downloads"], + listForOrg: ["GET /orgs/{org}/repos"], + listForUser: ["GET /users/{username}/repos"], + listForks: ["GET /repos/{owner}/{repo}/forks"], + listHooks: ["GET /repos/{owner}/{repo}/hooks"], + listInvitations: ["GET /repos/{owner}/{repo}/invitations"], + listInvitationsForAuthenticatedUser: ["GET /user/repository_invitations"], + listLanguages: ["GET /repos/{owner}/{repo}/languages"], + listPagesBuilds: ["GET /repos/{owner}/{repo}/pages/builds"], + listProtectedBranchRequiredStatusChecksContexts: ["GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts"], + listPublic: ["GET /repositories"], + listPullRequestsAssociatedWithCommit: ["GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls", { + mediaType: { + previews: ["groot"] + } + }], + listReleases: ["GET /repos/{owner}/{repo}/releases"], + listStatusesForRef: ["GET /repos/{owner}/{repo}/commits/{ref}/statuses"], + listTags: ["GET /repos/{owner}/{repo}/tags"], + listTeams: ["GET /repos/{owner}/{repo}/teams"], + listTopics: ["GET /repos/{owner}/{repo}/topics", { + mediaType: { + previews: ["mercy"] + } + }], + merge: ["POST /repos/{owner}/{repo}/merges"], + pingHook: ["POST /repos/{owner}/{repo}/hooks/{hook_id}/pings"], + removeBranchProtection: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection"], + removeCollaborator: ["DELETE /repos/{owner}/{repo}/collaborators/{username}"], + removeDeployKey: ["DELETE /repos/{owner}/{repo}/keys/{key_id}"], + removeProtectedBranchAdminEnforcement: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins"], + removeProtectedBranchAppRestrictions: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps", {}, { + mapToData: "apps" + }], + removeProtectedBranchPullRequestReviewEnforcement: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"], + removeProtectedBranchRequiredSignatures: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures", { + mediaType: { + previews: ["zzzax"] + } + }], + removeProtectedBranchRequiredStatusChecks: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"], + removeProtectedBranchRequiredStatusChecksContexts: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts", {}, { + mapToData: "contexts" + }], + removeProtectedBranchRestrictions: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions"], + removeProtectedBranchTeamRestrictions: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams", {}, { + mapToData: "teams" + }], + removeProtectedBranchUserRestrictions: ["DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users", {}, { + mapToData: "users" + }], + replaceProtectedBranchAppRestrictions: ["PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps", {}, { + mapToData: "apps" + }], + replaceProtectedBranchRequiredStatusChecksContexts: ["PUT /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts", {}, { + mapToData: "contexts" + }], + replaceProtectedBranchTeamRestrictions: ["PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams", {}, { + mapToData: "teams" + }], + replaceProtectedBranchUserRestrictions: ["PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users", {}, { + mapToData: "users" + }], + replaceTopics: ["PUT /repos/{owner}/{repo}/topics", { + mediaType: { + previews: ["mercy"] + } + }], + requestPageBuild: ["POST /repos/{owner}/{repo}/pages/builds"], + retrieveCommunityProfileMetrics: ["GET /repos/{owner}/{repo}/community/profile"], + testPushHook: ["POST /repos/{owner}/{repo}/hooks/{hook_id}/tests"], + transfer: ["POST /repos/{owner}/{repo}/transfer"], + update: ["PATCH /repos/{owner}/{repo}"], + updateBranchProtection: ["PUT /repos/{owner}/{repo}/branches/{branch}/protection"], + updateCommitComment: ["PATCH /repos/{owner}/{repo}/comments/{comment_id}"], + updateHook: ["PATCH /repos/{owner}/{repo}/hooks/{hook_id}"], + updateInformationAboutPagesSite: ["PUT /repos/{owner}/{repo}/pages"], + updateInvitation: ["PATCH /repos/{owner}/{repo}/invitations/{invitation_id}"], + updateProtectedBranchPullRequestReviewEnforcement: ["PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews"], + updateProtectedBranchRequiredStatusChecks: ["PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"], + updateRelease: ["PATCH /repos/{owner}/{repo}/releases/{release_id}"], + updateReleaseAsset: ["PATCH /repos/{owner}/{repo}/releases/assets/{asset_id}"], + uploadReleaseAsset: ["POST /repos/{owner}/{repo}/releases/{release_id}/assets{?name,label}", { + baseUrl: "https://uploads.github.com" + }] + }, + search: { + code: ["GET /search/code"], + commits: ["GET /search/commits", { + mediaType: { + previews: ["cloak"] + } + }], + issuesAndPullRequests: ["GET /search/issues"], + labels: ["GET /search/labels"], + repos: ["GET /search/repositories"], + topics: ["GET /search/topics"], + users: ["GET /search/users"] + }, + teams: { + addOrUpdateMembershipInOrg: ["PUT /orgs/{org}/teams/{team_slug}/memberships/{username}"], + addOrUpdateProjectInOrg: ["PUT /orgs/{org}/teams/{team_slug}/projects/{project_id}", { + mediaType: { + previews: ["inertia"] + } + }], + addOrUpdateRepoInOrg: ["PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"], + checkManagesRepoInOrg: ["GET /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"], + create: ["POST /orgs/{org}/teams"], + createDiscussionCommentInOrg: ["POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments"], + createDiscussionInOrg: ["POST /orgs/{org}/teams/{team_slug}/discussions"], + deleteDiscussionCommentInOrg: ["DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}"], + deleteDiscussionInOrg: ["DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}"], + deleteInOrg: ["DELETE /orgs/{org}/teams/{team_slug}"], + getByName: ["GET /orgs/{org}/teams/{team_slug}"], + getDiscussionCommentInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}"], + getDiscussionInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}"], + getMembershipInOrg: ["GET /orgs/{org}/teams/{team_slug}/memberships/{username}"], + list: ["GET /orgs/{org}/teams"], + listChildInOrg: ["GET /orgs/{org}/teams/{team_slug}/teams"], + listDiscussionCommentsInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments"], + listDiscussionsInOrg: ["GET /orgs/{org}/teams/{team_slug}/discussions"], + listForAuthenticatedUser: ["GET /user/teams"], + listMembersInOrg: ["GET /orgs/{org}/teams/{team_slug}/members"], + listPendingInvitationsInOrg: ["GET /orgs/{org}/teams/{team_slug}/invitations"], + listProjectsInOrg: ["GET /orgs/{org}/teams/{team_slug}/projects", { + mediaType: { + previews: ["inertia"] + } + }], + listReposInOrg: ["GET /orgs/{org}/teams/{team_slug}/repos"], + removeMembershipInOrg: ["DELETE /orgs/{org}/teams/{team_slug}/memberships/{username}"], + removeProjectInOrg: ["DELETE /orgs/{org}/teams/{team_slug}/projects/{project_id}"], + removeRepoInOrg: ["DELETE /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"], + reviewProjectInOrg: ["GET /orgs/{org}/teams/{team_slug}/projects/{project_id}", { + mediaType: { + previews: ["inertia"] + } + }], + updateDiscussionCommentInOrg: ["PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}"], + updateDiscussionInOrg: ["PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}"], + updateInOrg: ["PATCH /orgs/{org}/teams/{team_slug}"] + }, + users: { + addEmails: ["POST /user/emails"], + block: ["PUT /user/blocks/{username}"], + checkBlocked: ["GET /user/blocks/{username}"], + checkFollowing: ["GET /user/following/{username}"], + checkFollowingForUser: ["GET /users/{username}/following/{target_user}"], + createGpgKey: ["POST /user/gpg_keys"], + createPublicKey: ["POST /user/keys"], + deleteEmails: ["DELETE /user/emails"], + deleteGpgKey: ["DELETE /user/gpg_keys/{gpg_key_id}"], + deletePublicKey: ["DELETE /user/keys/{key_id}"], + follow: ["PUT /user/following/{username}"], + getAuthenticated: ["GET /user"], + getByUsername: ["GET /users/{username}"], + getContextForUser: ["GET /users/{username}/hovercard"], + getGpgKey: ["GET /user/gpg_keys/{gpg_key_id}"], + getPublicKey: ["GET /user/keys/{key_id}"], + list: ["GET /users"], + listBlocked: ["GET /user/blocks"], + listEmails: ["GET /user/emails"], + listFollowersForAuthenticatedUser: ["GET /user/followers"], + listFollowersForUser: ["GET /users/{username}/followers"], + listFollowingForAuthenticatedUser: ["GET /user/following"], + listFollowingForUser: ["GET /users/{username}/following"], + listGpgKeys: ["GET /user/gpg_keys"], + listGpgKeysForUser: ["GET /users/{username}/gpg_keys"], + listPublicEmails: ["GET /user/public_emails"], + listPublicKeys: ["GET /user/keys"], + listPublicKeysForUser: ["GET /users/{username}/keys"], + togglePrimaryEmailVisibility: ["PATCH /user/email/visibility"], + unblock: ["DELETE /user/blocks/{username}"], + unfollow: ["DELETE /user/following/{username}"], + updateAuthenticated: ["PATCH /user"] + } +}; + +const VERSION = "3.2.0"; + +function endpointsToMethods(octokit, endpointsMap) { + const newMethods = {}; + + for (const [scope, endpoints] of Object.entries(endpointsMap)) { + for (const [methodName, endpoint] of Object.entries(endpoints)) { + const [route, defaults, decorations] = endpoint; + const [method, url] = route.split(/ /); + const endpointDefaults = Object.assign({ + method, + url + }, defaults); + + if (!newMethods[scope]) { + newMethods[scope] = {}; + } + + const scopeMethods = newMethods[scope]; + + if (decorations) { + scopeMethods[methodName] = decorate(octokit, scope, methodName, endpointDefaults, decorations); + continue; + } + + scopeMethods[methodName] = octokit.request.defaults(endpointDefaults); + } + } + + return newMethods; +} + +function decorate(octokit, scope, methodName, defaults, decorations) { + const requestWithDefaults = octokit.request.defaults(defaults); + + function withDecorations(...args) { + // @ts-ignore https://github.com/microsoft/TypeScript/issues/25488 + let options = requestWithDefaults.endpoint.merge(...args); // There are currently no other decorations than `.mapToData` + + /* istanbul ignore else */ + + if (decorations.mapToData) { + options = Object.assign({}, options, { + data: options[decorations.mapToData], + [decorations.mapToData]: undefined + }); + return requestWithDefaults(options); + } // NOTE: there are currently no deprecations. But we keep the code + // below for future reference + // if (decorations.renamed) { + // const [newScope, newMethodName] = decorations.renamed; + // octokit.log.warn( + // `octokit.${scope}.${methodName}() has been renamed to octokit.${newScope}.${newMethodName}()` + // ); + // } + // if (decorations.deprecated) { + // octokit.log.warn(decorations.deprecated); + // } + // if (decorations.renamedParameters) { + // // @ts-ignore https://github.com/microsoft/TypeScript/issues/25488 + // const options = requestWithDefaults.endpoint.merge(...args); + // for (const [name, alias] of Object.entries( + // decorations.renamedParameters + // )) { + // if (name in options) { + // octokit.log.warn( + // `"${name}" parameter is deprecated for "octokit.${scope}.${methodName}()". Use "${alias}" instead` + // ); + // if (!(alias in options)) { + // options[alias] = options[name]; + // } + // delete options[name]; + // } + // } + // return requestWithDefaults(options); + // } + // @ts-ignore https://github.com/microsoft/TypeScript/issues/25488 + // return requestWithDefaults(...args); + + } + + return Object.assign(withDecorations, requestWithDefaults); +} + +/** + * This plugin is a 1:1 copy of internal @octokit/rest plugins. The primary + * goal is to rebuild @octokit/rest on top of @octokit/core. Once that is + * done, we will remove the registerEndpoints methods and return the methods + * directly as with the other plugins. At that point we will also remove the + * legacy workarounds and deprecations. + * + * See the plan at + * https://github.com/octokit/plugin-rest-endpoint-methods.js/pull/1 + */ + +function restEndpointMethods(octokit) { + return endpointsToMethods(octokit, Endpoints); +} +restEndpointMethods.VERSION = VERSION; + +exports.restEndpointMethods = restEndpointMethods; +//# sourceMappingURL=index.js.map + + +/***/ }), /* 843 */, /* 844 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -37463,10 +38720,110 @@ exports.timings = function (data) { /***/ }), /* 847 */, -/* 848 */, +/* 848 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var osName = _interopDefault(__webpack_require__(2)); + +function getUserAgent() { + try { + return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`; + } catch (error) { + if (/wmic os get Caption/.test(error.message)) { + return "Windows "; + } + + return ""; + } +} + +exports.getUserAgent = getUserAgent; +//# sourceMappingURL=index.js.map + + +/***/ }), /* 849 */, /* 850 */, -/* 851 */, +/* 851 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +"use strict"; + + +var ruleModules = __webpack_require__(894) + , toHash = __webpack_require__(855).toHash; + +module.exports = function rules() { + var RULES = [ + { type: 'number', + rules: [ { 'maximum': ['exclusiveMaximum'] }, + { 'minimum': ['exclusiveMinimum'] }, 'multipleOf', 'format'] }, + { type: 'string', + rules: [ 'maxLength', 'minLength', 'pattern', 'format' ] }, + { type: 'array', + rules: [ 'maxItems', 'minItems', 'items', 'contains', 'uniqueItems' ] }, + { type: 'object', + rules: [ 'maxProperties', 'minProperties', 'required', 'dependencies', 'propertyNames', + { 'properties': ['additionalProperties', 'patternProperties'] } ] }, + { rules: [ '$ref', 'const', 'enum', 'not', 'anyOf', 'oneOf', 'allOf', 'if' ] } + ]; + + var ALL = [ 'type', '$comment' ]; + var KEYWORDS = [ + '$schema', '$id', 'id', '$data', '$async', 'title', + 'description', 'default', 'definitions', + 'examples', 'readOnly', 'writeOnly', + 'contentMediaType', 'contentEncoding', + 'additionalItems', 'then', 'else' + ]; + var TYPES = [ 'number', 'integer', 'string', 'array', 'object', 'boolean', 'null' ]; + RULES.all = toHash(ALL); + RULES.types = toHash(TYPES); + + RULES.forEach(function (group) { + group.rules = group.rules.map(function (keyword) { + var implKeywords; + if (typeof keyword == 'object') { + var key = Object.keys(keyword)[0]; + implKeywords = keyword[key]; + keyword = key; + implKeywords.forEach(function (k) { + ALL.push(k); + RULES.all[k] = true; + }); + } + ALL.push(keyword); + var rule = RULES.all[keyword] = { + keyword: keyword, + code: ruleModules[keyword], + implements: implKeywords + }; + return rule; + }); + + RULES.all.$comment = { + keyword: '$comment', + code: ruleModules.$comment + }; + + if (group.type) RULES.types[group.type] = group; + }); + + RULES.keywords = toHash(ALL.concat(KEYWORDS)); + RULES.custom = {}; + + return RULES; +}; + + +/***/ }), /* 852 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -44494,7 +45851,108 @@ module.exports = exports['default']; /***/ }), /* 950 */, -/* 951 */, +/* 951 */ +/***/ (function(module) { + +module.exports = function(size) { + return new LruCache(size) +} + +function LruCache(size) { + this.capacity = size | 0 + this.map = Object.create(null) + this.list = new DoublyLinkedList() +} + +LruCache.prototype.get = function(key) { + var node = this.map[key] + if (node == null) return undefined + this.used(node) + return node.val +} + +LruCache.prototype.set = function(key, val) { + var node = this.map[key] + if (node != null) { + node.val = val + } else { + if (!this.capacity) this.prune() + if (!this.capacity) return false + node = new DoublyLinkedNode(key, val) + this.map[key] = node + this.capacity-- + } + this.used(node) + return true +} + +LruCache.prototype.used = function(node) { + this.list.moveToFront(node) +} + +LruCache.prototype.prune = function() { + var node = this.list.pop() + if (node != null) { + delete this.map[node.key] + this.capacity++ + } +} + + +function DoublyLinkedList() { + this.firstNode = null + this.lastNode = null +} + +DoublyLinkedList.prototype.moveToFront = function(node) { + if (this.firstNode == node) return + + this.remove(node) + + if (this.firstNode == null) { + this.firstNode = node + this.lastNode = node + node.prev = null + node.next = null + } else { + node.prev = null + node.next = this.firstNode + node.next.prev = node + this.firstNode = node + } +} + +DoublyLinkedList.prototype.pop = function() { + var lastNode = this.lastNode + if (lastNode != null) { + this.remove(lastNode) + } + return lastNode +} + +DoublyLinkedList.prototype.remove = function(node) { + if (this.firstNode == node) { + this.firstNode = node.next + } else if (node.prev != null) { + node.prev.next = node.next + } + if (this.lastNode == node) { + this.lastNode = node.prev + } else if (node.next != null) { + node.next.prev = node.prev + } +} + + +function DoublyLinkedNode(key, val) { + this.key = key + this.val = val + this.prev = null + this.next = null +} + + +/***/ }), /* 952 */ /***/ (function(module, __unusedexports, __webpack_require__) { diff --git a/lib/push/index.js b/lib/push/index.js index 7250774b..7dab6217 100644 --- a/lib/push/index.js +++ b/lib/push/index.js @@ -70,7 +70,11 @@ async function handlePush(state) { console.log(`error`); console.log(error); - tweetErrors.push(error[0]); + if (Array.isArray(error)) { + tweetErrors.push(error[0]); + } else { + tweetErrors.push(error); + } } } diff --git a/test/push-master-tweet-with-poll-missing-account-id/event.json b/test/push-master-tweet-with-poll-missing-account-id/event.json new file mode 100644 index 00000000..8150d6ee --- /dev/null +++ b/test/push-master-tweet-with-poll-missing-account-id/event.json @@ -0,0 +1,15 @@ +{ + "ref": "refs/heads/master", + "before": "0000000000000000000000000000000000000001", + "after": "0000000000000000000000000000000000000002", + "head_commit": { + "id": "0000000000000000000000000000000000000002" + }, + "repository": { + "owner": { + "login": "gr2m" + }, + "name": "twitter-together", + "default_branch": "master" + } +} diff --git a/test/push-master-tweet-with-poll-missing-account-id/test.js b/test/push-master-tweet-with-poll-missing-account-id/test.js new file mode 100644 index 00000000..f0c36a05 --- /dev/null +++ b/test/push-master-tweet-with-poll-missing-account-id/test.js @@ -0,0 +1,63 @@ +/** + * This test checks the happy path of a commit to the main branch (master) + * which includes a new *.tweet file. + */ + +const assert = require("assert"); +const path = require("path"); + +const nock = require("nock"); +const tap = require("tap"); + +// SETUP +process.env.GITHUB_EVENT_NAME = "push"; +process.env.GITHUB_TOKEN = "secret123"; +process.env.GITHUB_EVENT_PATH = require.resolve("./event.json"); +process.env.GITHUB_REF = "refs/heads/master"; +process.env.GITHUB_WORKSPACE = path.dirname(process.env.GITHUB_EVENT_PATH); + +// set other env variables so action-toolkit is happy +process.env.GITHUB_WORKFLOW = ""; +process.env.GITHUB_ACTION = "twitter-together"; +process.env.GITHUB_ACTOR = ""; +process.env.GITHUB_REPOSITORY = ""; +process.env.GITHUB_SHA = ""; + +// MOCK +nock("https://api.github.com", { + reqheaders: { + authorization: "token secret123", + }, +}) + // get changed files + .get( + "/repos/gr2m/twitter-together/compare/0000000000000000000000000000000000000001...0000000000000000000000000000000000000002" + ) + .reply(200, { + files: [ + { + status: "added", + filename: "tweets/my-poll.tweet", + }, + ], + }) + + // post comment + .post( + "/repos/gr2m/twitter-together/commits/0000000000000000000000000000000000000002/comments", + (body) => { + tap.equal( + body.body, + "Errors:\n\n- TWITTER_ACCOUNT_ID environment variable must be set" + ); + return true; + } + ) + .reply(201); + +process.on("exit", (code) => { + assert.equal(code, 1); + assert.deepEqual(nock.pendingMocks(), []); +}); + +require("../../lib"); diff --git a/test/push-master-tweet-with-poll-missing-account-id/tweets/my-poll.tweet b/test/push-master-tweet-with-poll-missing-account-id/tweets/my-poll.tweet new file mode 100644 index 00000000..11362f1a --- /dev/null +++ b/test/push-master-tweet-with-poll-missing-account-id/tweets/my-poll.tweet @@ -0,0 +1,6 @@ +Here is my poll + +( ) option 1 +() option 2 +( ) option 3 +() option 4 \ No newline at end of file From 4372851ca0bcb119e913681fdca28856d3f6cf27 Mon Sep 17 00:00:00 2001 From: Nargonath Date: Fri, 25 Sep 2020 10:54:17 +0200 Subject: [PATCH 2/2] chore: add .vscode to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index cb24d6a5..ce8c5d31 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ coverage/ dist/ node_modules/ +.vscode/