From 8e05706e43d6ba5ce06c0be96fb864e0aedf1717 Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Mon, 11 Jan 2021 21:32:00 +0800 Subject: [PATCH] feat: add random to (#35) * feat: add random to * add actions * up * up version * add less --- CHANGELOG.md | 6 + LICENSE | 2 +- README.en-US.md | 55 +- README.md | 55 +- action.yml | 2 + dist/index.js | 1614 +++++++++++++++++++++++++++++++++++++- docs/advanced.en-US.md | 12 +- docs/advanced.md | 12 +- docs/base.en-US.md | 35 +- docs/base.md | 35 +- docs/guide/note.en-US.md | 5 + docs/guide/note.md | 5 + docs/index.en-US.md | 2 +- docs/index.md | 2 +- package.json | 7 +- script/update-version.js | 4 +- src/advanced.js | 12 +- src/base.js | 38 +- src/less/dumi.less | 8 +- src/util.js | 15 +- 20 files changed, 1768 insertions(+), 158 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a095a7..fecbaad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v1.9 + +`2021.01.11` + +- feat: add random to. [#35](https://github.com/actions-cool/issues-helper/pull/35) + ## v1.8 `2021.01.07` diff --git a/LICENSE b/LICENSE index c779c1d..acda654 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 xrkffgg +Copyright (c) 2020-present xrkffgg Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.en-US.md b/README.en-US.md index 0761642..2c4097e 100644 --- a/README.en-US.md +++ b/README.en-US.md @@ -134,12 +134,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Add assigness - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'add-assignees' token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ github.event.issue.number }} assignees: 'xxx' or 'xx1,xx2' + random-to: 1 ``` | Param | Desc | Type | Required | @@ -148,6 +149,7 @@ jobs: | token | [Token explain](#token) | string | ✔ | | issue-number | The number of issue | number | ✔ | | assignees | Designated person. No operation when no input or empty character | string | ✖ | +| random-to | When set, it will be randomly selected in assignees | number | ✖ | - `actions` support multiple and separated by comma. Like: `add-assignees,add-labels` - The `name` can be modified according to the actual situation @@ -174,7 +176,7 @@ jobs: if: contains(github.event.issue.body, 'xxx') == false steps: - name: Add labels - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'add-labels' token: ${{ secrets.GITHUB_TOKEN }} @@ -199,7 +201,7 @@ Close the specified issue. ```yml - name: Close issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'close-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -232,7 +234,7 @@ jobs: if: github.event.label.name == 'xxx' steps: - name: Create comment - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'create-comment' token: ${{ secrets.GITHUB_TOKEN }} @@ -276,7 +278,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Create issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'create-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -295,6 +297,7 @@ jobs: | body | The body of the new issue | string | ✖ | | labels | The labels for the new issue | string | ✖ | | assignees | The assignees for the new issue | string | ✖ | +| random-to | When set, it will be randomly selected in assignees | number | ✖ | | contents | Add [reaction](#reactions-types) | string | ✖ | - `title` default is `Default Title` @@ -308,7 +311,7 @@ According to [`comment-id`](#comment-id) delete the specified comment. ```yml - name: Delete comment - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'delete-comment' token: ${{ secrets.GITHUB_TOKEN }} @@ -340,7 +343,7 @@ jobs: if: github.event.label.name == 'invalid' steps: - name: Lock issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'lock-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -371,7 +374,7 @@ jobs: runs-on: ubuntu-latest steps: - name: mark-duplicate - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'mark-duplicate' token: ${{ secrets.GITHUB_TOKEN }} @@ -399,7 +402,7 @@ Open the specified issue. ```yml - name: Open issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'open-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -420,7 +423,7 @@ Remove the person designated by issue. ```yml - name: Remove assignees - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'remove-assignees' token: ${{ secrets.GITHUB_TOKEN }} @@ -443,7 +446,7 @@ Remove the specified labels. ```yml - name: Remove labels - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'remove-labels' token: ${{ secrets.GITHUB_TOKEN }} @@ -468,7 +471,7 @@ Replace the labels of issue. ```yml - name: Set labels - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'set-labels' token: ${{ secrets.GITHUB_TOKEN }} @@ -491,7 +494,7 @@ Unlock the specified issue. ```yml - name: Unlock issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'unlock-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -524,7 +527,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Update comment - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'update-comment' token: ${{ secrets.GITHUB_TOKEN }} @@ -552,7 +555,7 @@ Update the specified issue according to the `issue-number`. ```yml - name: Update issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'update-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -602,7 +605,7 @@ jobs: runs-on: ubuntu-latest steps: - name: welcome - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'welcome' token: ${{ secrets.GITHUB_TOKEN }} @@ -645,7 +648,7 @@ jobs: runs-on: ubuntu-latest steps: - name: check-inactive - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'check-inactive' token: ${{ secrets.GITHUB_TOKEN }} @@ -698,7 +701,7 @@ jobs: runs-on: ubuntu-latest steps: - name: check-issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'check-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -737,7 +740,7 @@ jobs: runs-on: ubuntu-latest steps: - name: close-issues - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'close-issues' token: ${{ secrets.GITHUB_TOKEN }} @@ -771,7 +774,7 @@ Find the current warehouse issue No. 1, the creator is k and the content contain ```yml - name: Find comments - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'find-comments' token: ${{ secrets.GITHUB_TOKEN }} @@ -819,7 +822,7 @@ jobs: runs-on: ubuntu-latest steps: - name: lock-issues - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'lock-issues' token: ${{ secrets.GITHUB_TOKEN }} @@ -865,7 +868,7 @@ jobs: runs-on: ubuntu-latest steps: - name: month-statistics - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'month-statistics' token: ${{ secrets.GITHUB_TOKEN }} @@ -908,7 +911,7 @@ jobs: if: github.event.label.name == 'watch' steps: - name: find comments - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 id: fcid with: actions: 'find-comments' @@ -919,7 +922,7 @@ jobs: - name: create comment if: ${{ steps.fcid.outputs.comments.length == 0 }} - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'create-comment' token: ${{ secrets.GITHUB_TOKEN }} @@ -928,7 +931,7 @@ jobs: - name: update comment if: ${{ steps.fcid.outputs.comments.length == 1 }} - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'update-comment' token: ${{ secrets.GITHUB_TOKEN }} @@ -960,7 +963,7 @@ When the token is not filled in actions or the corresponding secrets are not add ```yml - name: Create issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 id: createissue with: actions: 'create-issue' diff --git a/README.md b/README.md index 5996959..98da835 100644 --- a/README.md +++ b/README.md @@ -134,12 +134,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Add assigness - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'add-assignees' token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ github.event.issue.number }} assignees: 'xxx' or 'xx1,xx2' + random-to: 1 ``` | 参数 | 描述 | 类型 | 必填 | @@ -148,6 +149,7 @@ jobs: | token | [token 说明](#token) | string | ✔ | | issue-number | 指定的 issue | number | ✔ | | assignees | 指定人。当不填或者为空字符时,不操作 | string | ✖ | +| random-to | 当设置时,会在 assignees 中随机选择 | number | ✖ | - `actions` 支持多个,需用逗号隔开。如:`add-assignees,add-labels` - 其中的 `name` 可根据自行根据实际情况修改 @@ -174,7 +176,7 @@ jobs: if: contains(github.event.issue.body, 'xxx') == false steps: - name: Add labels - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'add-labels' token: ${{ secrets.GITHUB_TOKEN }} @@ -199,7 +201,7 @@ jobs: ```yml - name: Close issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'close-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -232,7 +234,7 @@ jobs: if: github.event.label.name == 'xxx' steps: - name: Create comment - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'create-comment' token: ${{ secrets.GITHUB_TOKEN }} @@ -276,7 +278,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Create issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'create-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -295,6 +297,7 @@ jobs: | body | 新增 issue 的内容 | string | ✖ | | labels | 为新增 issue 添加 labels | string | ✖ | | assignees | 为新增 issue 添加 assignees | string | ✖ | +| random-to | 当设置时,会在 assignees 中随机选择 | number | ✖ | | contents | 为新增 issue 增加 [reaction](#reactions-types) | string | ✖ | - `title` 默认为:`Default Title` @@ -308,7 +311,7 @@ jobs: ```yml - name: Delete comment - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'delete-comment' token: ${{ secrets.GITHUB_TOKEN }} @@ -340,7 +343,7 @@ jobs: if: github.event.label.name == 'invalid' steps: - name: Lock issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'lock-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -371,7 +374,7 @@ jobs: runs-on: ubuntu-latest steps: - name: mark-duplicate - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'mark-duplicate' token: ${{ secrets.GITHUB_TOKEN }} @@ -399,7 +402,7 @@ jobs: ```yml - name: Open issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'open-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -420,7 +423,7 @@ jobs: ```yml - name: Remove assignees - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'remove-assignees' token: ${{ secrets.GITHUB_TOKEN }} @@ -443,7 +446,7 @@ jobs: ```yml - name: Remove labels - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'remove-labels' token: ${{ secrets.GITHUB_TOKEN }} @@ -468,7 +471,7 @@ jobs: ```yml - name: Set labels - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'set-labels' token: ${{ secrets.GITHUB_TOKEN }} @@ -491,7 +494,7 @@ jobs: ```yml - name: Unlock issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'unlock-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -524,7 +527,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Update comment - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'update-comment' token: ${{ secrets.GITHUB_TOKEN }} @@ -552,7 +555,7 @@ jobs: ```yml - name: Update issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'update-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -600,7 +603,7 @@ jobs: runs-on: ubuntu-latest steps: - name: welcome - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'welcome' token: ${{ secrets.GITHUB_TOKEN }} @@ -643,7 +646,7 @@ jobs: runs-on: ubuntu-latest steps: - name: check-inactive - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'check-inactive' token: ${{ secrets.GITHUB_TOKEN }} @@ -692,7 +695,7 @@ jobs: runs-on: ubuntu-latest steps: - name: check-issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'check-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -731,7 +734,7 @@ jobs: runs-on: ubuntu-latest steps: - name: close-issues - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'close-issues' token: ${{ secrets.GITHUB_TOKEN }} @@ -765,7 +768,7 @@ jobs: ```yml - name: Find comments - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'find-comments' token: ${{ secrets.GITHUB_TOKEN }} @@ -813,7 +816,7 @@ jobs: runs-on: ubuntu-latest steps: - name: lock-issues - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'lock-issues' token: ${{ secrets.GITHUB_TOKEN }} @@ -859,7 +862,7 @@ jobs: runs-on: ubuntu-latest steps: - name: month-statistics - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'month-statistics' token: ${{ secrets.GITHUB_TOKEN }} @@ -902,7 +905,7 @@ jobs: if: github.event.label.name == 'watch' steps: - name: find comments - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 id: fcid with: actions: 'find-comments' @@ -913,7 +916,7 @@ jobs: - name: create comment if: ${{ steps.fcid.outputs.comments.length == 0 }} - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'create-comment' token: ${{ secrets.GITHUB_TOKEN }} @@ -922,7 +925,7 @@ jobs: - name: update comment if: ${{ steps.fcid.outputs.comments.length == 1 }} - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'update-comment' token: ${{ secrets.GITHUB_TOKEN }} @@ -954,7 +957,7 @@ jobs: ```yml - name: Create issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 id: createissue with: actions: 'create-issue' diff --git a/action.yml b/action.yml index 5ae22b6..574997d 100644 --- a/action.yml +++ b/action.yml @@ -20,6 +20,8 @@ inputs: description: 'Issue title' assignees: description: 'Issue assignees' + random-to: + description: 'Issue assignees random to' labels: description: 'Issue labels' state: diff --git a/dist/index.js b/dist/index.js index a797654..d9c80bb 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3968,6 +3968,1537 @@ module.exports.config = config module.exports.parse = parse +/***/ }), + +/***/ 9213: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var root = __webpack_require__(9882); + +/** Built-in value references. */ +var Symbol = root.Symbol; + +module.exports = Symbol; + + +/***/ }), + +/***/ 2237: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var baseTimes = __webpack_require__(7765), + isArguments = __webpack_require__(8495), + isArray = __webpack_require__(4869), + isBuffer = __webpack_require__(4190), + isIndex = __webpack_require__(2936), + isTypedArray = __webpack_require__(2496); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ +function arrayLikeKeys(value, inherited) { + var isArr = isArray(value), + isArg = !isArr && isArguments(value), + isBuff = !isArr && !isArg && isBuffer(value), + isType = !isArr && !isArg && !isBuff && isTypedArray(value), + skipIndexes = isArr || isArg || isBuff || isType, + result = skipIndexes ? baseTimes(value.length, String) : [], + length = result.length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && ( + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == 'offset' || key == 'parent')) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || + // Skip index properties. + isIndex(key, length) + ))) { + result.push(key); + } + } + return result; +} + +module.exports = arrayLikeKeys; + + +/***/ }), + +/***/ 4356: +/***/ ((module) => { + +/** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; +} + +module.exports = arrayMap; + + +/***/ }), + +/***/ 585: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var baseClamp = __webpack_require__(768), + copyArray = __webpack_require__(5157), + shuffleSelf = __webpack_require__(5436); + +/** + * A specialized version of `_.sampleSize` for arrays. + * + * @private + * @param {Array} array The array to sample. + * @param {number} n The number of elements to sample. + * @returns {Array} Returns the random elements. + */ +function arraySampleSize(array, n) { + return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); +} + +module.exports = arraySampleSize; + + +/***/ }), + +/***/ 768: +/***/ ((module) => { + +/** + * The base implementation of `_.clamp` which doesn't coerce arguments. + * + * @private + * @param {number} number The number to clamp. + * @param {number} [lower] The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the clamped number. + */ +function baseClamp(number, lower, upper) { + if (number === number) { + if (upper !== undefined) { + number = number <= upper ? number : upper; + } + if (lower !== undefined) { + number = number >= lower ? number : lower; + } + } + return number; +} + +module.exports = baseClamp; + + +/***/ }), + +/***/ 7497: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var Symbol = __webpack_require__(9213), + getRawTag = __webpack_require__(923), + objectToString = __webpack_require__(4200); + +/** `Object#toString` result references. */ +var nullTag = '[object Null]', + undefinedTag = '[object Undefined]'; + +/** Built-in value references. */ +var symToStringTag = Symbol ? Symbol.toStringTag : undefined; + +/** + * The base implementation of `getTag` without fallbacks for buggy environments. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ +function baseGetTag(value) { + if (value == null) { + return value === undefined ? undefinedTag : nullTag; + } + return (symToStringTag && symToStringTag in Object(value)) + ? getRawTag(value) + : objectToString(value); +} + +module.exports = baseGetTag; + + +/***/ }), + +/***/ 2177: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var baseGetTag = __webpack_require__(7497), + isObjectLike = __webpack_require__(5926); + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]'; + +/** + * The base implementation of `_.isArguments`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + */ +function baseIsArguments(value) { + return isObjectLike(value) && baseGetTag(value) == argsTag; +} + +module.exports = baseIsArguments; + + +/***/ }), + +/***/ 1528: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var baseGetTag = __webpack_require__(7497), + isLength = __webpack_require__(4530), + isObjectLike = __webpack_require__(5926); + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + funcTag = '[object Function]', + mapTag = '[object Map]', + numberTag = '[object Number]', + objectTag = '[object Object]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + weakMapTag = '[object WeakMap]'; + +var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; + +/** Used to identify `toStringTag` values of typed arrays. */ +var typedArrayTags = {}; +typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = +typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = +typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = +typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = +typedArrayTags[uint32Tag] = true; +typedArrayTags[argsTag] = typedArrayTags[arrayTag] = +typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = +typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = +typedArrayTags[errorTag] = typedArrayTags[funcTag] = +typedArrayTags[mapTag] = typedArrayTags[numberTag] = +typedArrayTags[objectTag] = typedArrayTags[regexpTag] = +typedArrayTags[setTag] = typedArrayTags[stringTag] = +typedArrayTags[weakMapTag] = false; + +/** + * The base implementation of `_.isTypedArray` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + */ +function baseIsTypedArray(value) { + return isObjectLike(value) && + isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; +} + +module.exports = baseIsTypedArray; + + +/***/ }), + +/***/ 7164: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var isPrototype = __webpack_require__(10), + nativeKeys = __webpack_require__(5778); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; +} + +module.exports = baseKeys; + + +/***/ }), + +/***/ 2183: +/***/ ((module) => { + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeFloor = Math.floor, + nativeRandom = Math.random; + +/** + * The base implementation of `_.random` without support for returning + * floating-point numbers. + * + * @private + * @param {number} lower The lower bound. + * @param {number} upper The upper bound. + * @returns {number} Returns the random number. + */ +function baseRandom(lower, upper) { + return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); +} + +module.exports = baseRandom; + + +/***/ }), + +/***/ 8686: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var baseClamp = __webpack_require__(768), + shuffleSelf = __webpack_require__(5436), + values = __webpack_require__(5736); + +/** + * The base implementation of `_.sampleSize` without param guards. + * + * @private + * @param {Array|Object} collection The collection to sample. + * @param {number} n The number of elements to sample. + * @returns {Array} Returns the random elements. + */ +function baseSampleSize(collection, n) { + var array = values(collection); + return shuffleSelf(array, baseClamp(n, 0, array.length)); +} + +module.exports = baseSampleSize; + + +/***/ }), + +/***/ 7765: +/***/ ((module) => { + +/** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ +function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} + +module.exports = baseTimes; + + +/***/ }), + +/***/ 9258: +/***/ ((module) => { + +/** + * The base implementation of `_.unary` without support for storing metadata. + * + * @private + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + */ +function baseUnary(func) { + return function(value) { + return func(value); + }; +} + +module.exports = baseUnary; + + +/***/ }), + +/***/ 5159: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var arrayMap = __webpack_require__(4356); + +/** + * The base implementation of `_.values` and `_.valuesIn` which creates an + * array of `object` property values corresponding to the property names + * of `props`. + * + * @private + * @param {Object} object The object to query. + * @param {Array} props The property names to get values for. + * @returns {Object} Returns the array of property values. + */ +function baseValues(object, props) { + return arrayMap(props, function(key) { + return object[key]; + }); +} + +module.exports = baseValues; + + +/***/ }), + +/***/ 5157: +/***/ ((module) => { + +/** + * Copies the values of `source` to `array`. + * + * @private + * @param {Array} source The array to copy values from. + * @param {Array} [array=[]] The array to copy values to. + * @returns {Array} Returns `array`. + */ +function copyArray(source, array) { + var index = -1, + length = source.length; + + array || (array = Array(length)); + while (++index < length) { + array[index] = source[index]; + } + return array; +} + +module.exports = copyArray; + + +/***/ }), + +/***/ 2085: +/***/ ((module) => { + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +module.exports = freeGlobal; + + +/***/ }), + +/***/ 923: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var Symbol = __webpack_require__(9213); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var nativeObjectToString = objectProto.toString; + +/** Built-in value references. */ +var symToStringTag = Symbol ? Symbol.toStringTag : undefined; + +/** + * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the raw `toStringTag`. + */ +function getRawTag(value) { + var isOwn = hasOwnProperty.call(value, symToStringTag), + tag = value[symToStringTag]; + + try { + value[symToStringTag] = undefined; + var unmasked = true; + } catch (e) {} + + var result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag] = tag; + } else { + delete value[symToStringTag]; + } + } + return result; +} + +module.exports = getRawTag; + + +/***/ }), + +/***/ 2936: +/***/ ((module) => { + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + var type = typeof value; + length = length == null ? MAX_SAFE_INTEGER : length; + + return !!length && + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); +} + +module.exports = isIndex; + + +/***/ }), + +/***/ 8494: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var eq = __webpack_require__(1901), + isArrayLike = __webpack_require__(8017), + isIndex = __webpack_require__(2936), + isObject = __webpack_require__(3334); + +/** + * Checks if the given arguments are from an iteratee call. + * + * @private + * @param {*} value The potential iteratee value argument. + * @param {*} index The potential iteratee index or key argument. + * @param {*} object The potential iteratee object argument. + * @returns {boolean} Returns `true` if the arguments are from an iteratee call, + * else `false`. + */ +function isIterateeCall(value, index, object) { + if (!isObject(object)) { + return false; + } + var type = typeof index; + if (type == 'number' + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { + return eq(object[index], value); + } + return false; +} + +module.exports = isIterateeCall; + + +/***/ }), + +/***/ 10: +/***/ ((module) => { + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ +function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; + + return value === proto; +} + +module.exports = isPrototype; + + +/***/ }), + +/***/ 5778: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var overArg = __webpack_require__(6320); + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeKeys = overArg(Object.keys, Object); + +module.exports = nativeKeys; + + +/***/ }), + +/***/ 4643: +/***/ ((module, exports, __webpack_require__) => { + +/* module decorator */ module = __webpack_require__.nmd(module); +var freeGlobal = __webpack_require__(2085); + +/** Detect free variable `exports`. */ +var freeExports = true && exports && !exports.nodeType && exports; + +/** Detect free variable `module`. */ +var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module; + +/** Detect the popular CommonJS extension `module.exports`. */ +var moduleExports = freeModule && freeModule.exports === freeExports; + +/** Detect free variable `process` from Node.js. */ +var freeProcess = moduleExports && freeGlobal.process; + +/** Used to access faster Node.js helpers. */ +var nodeUtil = (function() { + try { + // Use `util.types` for Node.js 10+. + var types = freeModule && freeModule.require && freeModule.require('util').types; + + if (types) { + return types; + } + + // Legacy `process.binding('util')` for Node.js < 10. + return freeProcess && freeProcess.binding && freeProcess.binding('util'); + } catch (e) {} +}()); + +module.exports = nodeUtil; + + +/***/ }), + +/***/ 4200: +/***/ ((module) => { + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var nativeObjectToString = objectProto.toString; + +/** + * Converts `value` to a string using `Object.prototype.toString`. + * + * @private + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + */ +function objectToString(value) { + return nativeObjectToString.call(value); +} + +module.exports = objectToString; + + +/***/ }), + +/***/ 6320: +/***/ ((module) => { + +/** + * Creates a unary function that invokes `func` with its argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ +function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; +} + +module.exports = overArg; + + +/***/ }), + +/***/ 9882: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var freeGlobal = __webpack_require__(2085); + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + +module.exports = root; + + +/***/ }), + +/***/ 5436: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var baseRandom = __webpack_require__(2183); + +/** + * A specialized version of `_.shuffle` which mutates and sets the size of `array`. + * + * @private + * @param {Array} array The array to shuffle. + * @param {number} [size=array.length] The size of `array`. + * @returns {Array} Returns `array`. + */ +function shuffleSelf(array, size) { + var index = -1, + length = array.length, + lastIndex = length - 1; + + size = size === undefined ? length : size; + while (++index < size) { + var rand = baseRandom(index, lastIndex), + value = array[rand]; + + array[rand] = array[index]; + array[index] = value; + } + array.length = size; + return array; +} + +module.exports = shuffleSelf; + + +/***/ }), + +/***/ 1901: +/***/ ((module) => { + +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ +function eq(value, other) { + return value === other || (value !== value && other !== other); +} + +module.exports = eq; + + +/***/ }), + +/***/ 8495: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var baseIsArguments = __webpack_require__(2177), + isObjectLike = __webpack_require__(5926); + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** Built-in value references. */ +var propertyIsEnumerable = objectProto.propertyIsEnumerable; + +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { + return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && + !propertyIsEnumerable.call(value, 'callee'); +}; + +module.exports = isArguments; + + +/***/ }), + +/***/ 4869: +/***/ ((module) => { + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + +module.exports = isArray; + + +/***/ }), + +/***/ 8017: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var isFunction = __webpack_require__(7799), + isLength = __webpack_require__(4530); + +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(value.length) && !isFunction(value); +} + +module.exports = isArrayLike; + + +/***/ }), + +/***/ 4190: +/***/ ((module, exports, __webpack_require__) => { + +/* module decorator */ module = __webpack_require__.nmd(module); +var root = __webpack_require__(9882), + stubFalse = __webpack_require__(7744); + +/** Detect free variable `exports`. */ +var freeExports = true && exports && !exports.nodeType && exports; + +/** Detect free variable `module`. */ +var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module; + +/** Detect the popular CommonJS extension `module.exports`. */ +var moduleExports = freeModule && freeModule.exports === freeExports; + +/** Built-in value references. */ +var Buffer = moduleExports ? root.Buffer : undefined; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined; + +/** + * Checks if `value` is a buffer. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. + * @example + * + * _.isBuffer(new Buffer(2)); + * // => true + * + * _.isBuffer(new Uint8Array(2)); + * // => false + */ +var isBuffer = nativeIsBuffer || stubFalse; + +module.exports = isBuffer; + + +/***/ }), + +/***/ 7799: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var baseGetTag = __webpack_require__(7497), + isObject = __webpack_require__(3334); + +/** `Object#toString` result references. */ +var asyncTag = '[object AsyncFunction]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + proxyTag = '[object Proxy]'; + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + if (!isObject(value)) { + return false; + } + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 9 which returns 'object' for typed arrays and other constructors. + var tag = baseGetTag(value); + return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; +} + +module.exports = isFunction; + + +/***/ }), + +/***/ 4530: +/***/ ((module) => { + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +module.exports = isLength; + + +/***/ }), + +/***/ 3334: +/***/ ((module) => { + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return value != null && (type == 'object' || type == 'function'); +} + +module.exports = isObject; + + +/***/ }), + +/***/ 5926: +/***/ ((module) => { + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return value != null && typeof value == 'object'; +} + +module.exports = isObjectLike; + + +/***/ }), + +/***/ 6403: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var baseGetTag = __webpack_require__(7497), + isObjectLike = __webpack_require__(5926); + +/** `Object#toString` result references. */ +var symbolTag = '[object Symbol]'; + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && baseGetTag(value) == symbolTag); +} + +module.exports = isSymbol; + + +/***/ }), + +/***/ 2496: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var baseIsTypedArray = __webpack_require__(1528), + baseUnary = __webpack_require__(9258), + nodeUtil = __webpack_require__(4643); + +/* Node.js helper references. */ +var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; + +/** + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */ +var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; + +module.exports = isTypedArray; + + +/***/ }), + +/***/ 7645: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var arrayLikeKeys = __webpack_require__(2237), + baseKeys = __webpack_require__(7164), + isArrayLike = __webpack_require__(8017); + +/** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * for more details. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ +function keys(object) { + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); +} + +module.exports = keys; + + +/***/ }), + +/***/ 2199: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var arraySampleSize = __webpack_require__(585), + baseSampleSize = __webpack_require__(8686), + isArray = __webpack_require__(4869), + isIterateeCall = __webpack_require__(8494), + toInteger = __webpack_require__(2722); + +/** + * Gets `n` random elements at unique keys from `collection` up to the + * size of `collection`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Collection + * @param {Array|Object} collection The collection to sample. + * @param {number} [n=1] The number of elements to sample. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the random elements. + * @example + * + * _.sampleSize([1, 2, 3], 2); + * // => [3, 1] + * + * _.sampleSize([1, 2, 3], 4); + * // => [2, 3, 1] + */ +function sampleSize(collection, n, guard) { + if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) { + n = 1; + } else { + n = toInteger(n); + } + var func = isArray(collection) ? arraySampleSize : baseSampleSize; + return func(collection, n); +} + +module.exports = sampleSize; + + +/***/ }), + +/***/ 7744: +/***/ ((module) => { + +/** + * This method returns `false`. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {boolean} Returns `false`. + * @example + * + * _.times(2, _.stubFalse); + * // => [false, false] + */ +function stubFalse() { + return false; +} + +module.exports = stubFalse; + + +/***/ }), + +/***/ 9323: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var toNumber = __webpack_require__(1235); + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0, + MAX_INTEGER = 1.7976931348623157e+308; + +/** + * Converts `value` to a finite number. + * + * @static + * @memberOf _ + * @since 4.12.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted number. + * @example + * + * _.toFinite(3.2); + * // => 3.2 + * + * _.toFinite(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toFinite(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toFinite('3.2'); + * // => 3.2 + */ +function toFinite(value) { + if (!value) { + return value === 0 ? value : 0; + } + value = toNumber(value); + if (value === INFINITY || value === -INFINITY) { + var sign = (value < 0 ? -1 : 1); + return sign * MAX_INTEGER; + } + return value === value ? value : 0; +} + +module.exports = toFinite; + + +/***/ }), + +/***/ 2722: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var toFinite = __webpack_require__(9323); + +/** + * Converts `value` to an integer. + * + * **Note:** This method is loosely based on + * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {number} Returns the converted integer. + * @example + * + * _.toInteger(3.2); + * // => 3 + * + * _.toInteger(Number.MIN_VALUE); + * // => 0 + * + * _.toInteger(Infinity); + * // => 1.7976931348623157e+308 + * + * _.toInteger('3.2'); + * // => 3 + */ +function toInteger(value) { + var result = toFinite(value), + remainder = result % 1; + + return result === result ? (remainder ? result - remainder : result) : 0; +} + +module.exports = toInteger; + + +/***/ }), + +/***/ 1235: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var isObject = __webpack_require__(3334), + isSymbol = __webpack_require__(6403); + +/** Used as references for various `Number` constants. */ +var NAN = 0 / 0; + +/** Used to match leading and trailing whitespace. */ +var reTrim = /^\s+|\s+$/g; + +/** Used to detect bad signed hexadecimal string values. */ +var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + +/** Used to detect binary string values. */ +var reIsBinary = /^0b[01]+$/i; + +/** Used to detect octal string values. */ +var reIsOctal = /^0o[0-7]+$/i; + +/** Built-in method references without a dependency on `root`. */ +var freeParseInt = parseInt; + +/** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3.2); + * // => 3.2 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3.2'); + * // => 3.2 + */ +function toNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + if (isObject(value)) { + var other = typeof value.valueOf == 'function' ? value.valueOf() : value; + value = isObject(other) ? (other + '') : other; + } + if (typeof value != 'string') { + return value === 0 ? value : +value; + } + value = value.replace(reTrim, ''); + var isBinary = reIsBinary.test(value); + return (isBinary || reIsOctal.test(value)) + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); +} + +module.exports = toNumber; + + +/***/ }), + +/***/ 5736: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var baseValues = __webpack_require__(5159), + keys = __webpack_require__(7645); + +/** + * Creates an array of the own enumerable string keyed property values of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property values. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.values(new Foo); + * // => [1, 2] (iteration order is not guaranteed) + * + * _.values('hi'); + * // => ['h', 'i'] + */ +function values(object) { + return object == null ? [] : baseValues(object, keys(object)); +} + +module.exports = values; + + /***/ }), /***/ 467: @@ -6044,7 +7575,7 @@ const { } = __webpack_require__(197); const { - dealInput, + dealStringToArr, matchKeyword, getPreMonth } = __webpack_require__(6254); @@ -6110,7 +7641,7 @@ async function doCheckIssue (owner, repo, issueNumber) { }); if (!!checkResult && assigneeIncludes) { - let assigneesCheck = dealInput(assigneeIncludes); + let assigneesCheck = dealStringToArr(assigneeIncludes); let checkAssignee = false; issue.data.assignees.forEach(it => { if (checkResult && !checkAssignee && assigneesCheck.includes(it.login)) { @@ -6123,8 +7654,8 @@ async function doCheckIssue (owner, repo, issueNumber) { if (!!checkResult && titleIncludes) { const titleArr = titleIncludes.split('/'); - const keyword1 = dealInput(titleArr[0]); - const keyword2 = dealInput(titleArr[1]); + const keyword1 = dealStringToArr(titleArr[0]); + const keyword2 = dealStringToArr(titleArr[1]); checkResult = keyword2.length ? matchKeyword(issue.data.title, keyword1) && matchKeyword(issue.data.title, keyword2) : @@ -6133,8 +7664,8 @@ async function doCheckIssue (owner, repo, issueNumber) { if (!!checkResult && bodyIncludes) { const bodyArr = bodyIncludes.split('/'); - const keyword1 = dealInput(bodyArr[0]); - const keyword2 = dealInput(bodyArr[1]); + const keyword1 = dealStringToArr(bodyArr[0]); + const keyword2 = dealStringToArr(bodyArr[1]); checkResult = keyword2.length ? matchKeyword(issue.data.body, keyword1) && matchKeyword(issue.data.body, keyword2) : @@ -6360,7 +7891,8 @@ const { } = __webpack_require__(197); const { - dealInput, + dealStringToArr, + dealRandomAssignees, testDuplicate, } = __webpack_require__(6254); @@ -6371,15 +7903,18 @@ const context = github.context; const contents = core.getInput("contents"); +const randomTo = core.getInput("random-to"); + // ************************************************************************** async function doAddAssignees (owner, repo, issueNumber, assignees) { + const arr = dealRandomAssignees(assignees, randomTo); await octokit.issues.addAssignees({ owner, repo, issue_number: issueNumber, - assignees: dealInput(assignees) + assignees: arr }); - core.info(`Actions: [add-assignees][${assignees}] success!`); + core.info(`Actions: [add-assignees][${arr}] success!`); }; async function doAddLabels (owner, repo, issueNumber, labels) { @@ -6387,7 +7922,7 @@ async function doAddLabels (owner, repo, issueNumber, labels) { owner, repo, issue_number: issueNumber, - labels: dealInput(labels) + labels: dealStringToArr(labels) }); core.info(`Actions: [add-labels][${labels}] success!`); }; @@ -6413,7 +7948,7 @@ async function doCreateComment (owner, repo, issueNumber, body) { core.setOutput("comment-id", data.id); if (contents) { - await doCreateCommentContent(owner, repo, data.id, dealInput(contents)); + await doCreateCommentContent(owner, repo, data.id, dealStringToArr(contents)); } }; @@ -6439,8 +7974,8 @@ async function doCreateIssue (owner, repo, title, body, labels, assignees) { repo, title, body, - labels: dealInput(labels), - assignees: dealInput(assignees), + labels: dealStringToArr(labels), + assignees: dealRandomAssignees(assignees, randomTo), }; const { data } = await octokit.issues.create(params); @@ -6448,7 +7983,7 @@ async function doCreateIssue (owner, repo, title, body, labels, assignees) { core.setOutput("issue-number", data.number); if (contents) { - await doCreateIssueContent(owner, repo, data.number, dealInput(contents)); + await doCreateIssueContent(owner, repo, data.number, dealStringToArr(contents)); } }; @@ -6500,7 +8035,7 @@ async function doMarkDuplicate (owner, repo, labels) { const duplicateLabels = core.getInput("duplicate-labels"); const removeLables = core.getInput("remove-labels"); const closeIssue = core.getInput("close-issue"); - + const commentId = context.payload.comment.id; const commentBody = context.payload.comment.body; const issueNumber = context.payload.issue.number; @@ -6512,7 +8047,7 @@ async function doMarkDuplicate (owner, repo, labels) { const nextBody = commentBody.replace(duplicateCommand, 'Duplicate of'); await doUpdateComment(owner, repo, commentId, nextBody, 'replace', true); } else if (contents) { - await doCreateCommentContent(owner, repo, commentId, dealInput(contents)); + await doCreateCommentContent(owner, repo, commentId, dealStringToArr(contents)); } if (duplicateLabels) { await doAddLabels(owner, repo, issueNumber, duplicateLabels); @@ -6546,7 +8081,7 @@ async function doRemoveAssignees (owner, repo, issueNumber, assignees) { owner, repo, issue_number: issueNumber, - assignees: dealInput(assignees), + assignees: dealStringToArr(assignees) }); core.info(`Actions: [remove-assignees][${assignees}] success!`); }; @@ -6557,7 +8092,7 @@ async function doRemoveLabels (owner, repo, issueNumber, labels) { repo, issue_number: issueNumber }); - const dealLabels = dealInput(labels); + const dealLabels = dealStringToArr(labels); let addLables = []; if (dealLabels.length) { issue.data.labels.forEach(item => { @@ -6578,7 +8113,7 @@ async function doSetLabels (owner, repo, issueNumber, labels) { owner, repo, issue_number: issueNumber, - labels: dealInput(labels) + labels: dealStringToArr(labels) }); core.info(`Actions: [set-labels][${labels}] success!`); }; @@ -6625,7 +8160,7 @@ async function doUpdateComment ( } if (contents) { - await doCreateCommentContent(owner, repo, commentId, dealInput(contents)); + await doCreateCommentContent(owner, repo, commentId, dealStringToArr(contents)); } }; @@ -6683,8 +8218,8 @@ async function doUpdateIssue ( } params.body = next_body; - params.labels = labels ? dealInput(labels) : issue_labels; - params.assignees = assignees ? dealInput(assignees) : issue_assignees; + params.labels = labels ? dealStringToArr(labels) : issue_labels; + params.assignees = assignees ? dealStringToArr(assignees) : issue_assignees; await octokit.issues.update(params); core.info(`Actions: [update-issue][${issueNumber}] success!`); @@ -6721,7 +8256,7 @@ async function doWelcome (owner, repo, assignees, labels, body) { } if (issueContents) { - await doCreateIssueContent(owner, repo, issueNumber, dealInput(issueContents)); + await doCreateIssueContent(owner, repo, issueNumber, dealStringToArr(issueContents)); } } else { core.info(`Actions: [welcome][${auth}] is not first time!`); @@ -7136,9 +8671,11 @@ module.exports = { /***/ }), /***/ 6254: -/***/ ((module) => { +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -function dealInput (para) { +const sampleSize = __webpack_require__(2199); + +function dealStringToArr (para) { /** * in 'x1,x2,x3' * out ['x1','x2','x3'] @@ -7155,6 +8692,14 @@ function dealInput (para) { return arr; }; +function dealRandomAssignees (assignees, randomTo) { + let arr = dealStringToArr(assignees); + if (randomTo && Number(randomTo) > 0 && Number(randomTo) < arr.length) { + arr = sampleSize(arr, randomTo); + } + return arr; +}; + function matchKeyword (content, keywords) { return keywords.find(item => content.toLowerCase().includes(item)); }; @@ -7177,7 +8722,8 @@ function getPreMonth (m) { }; module.exports = { - dealInput, + dealStringToArr, + dealRandomAssignees, getPreMonth, matchKeyword, testDuplicate, @@ -7311,8 +8857,8 @@ module.exports = require("zlib");; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed +/******/ id: moduleId, +/******/ loaded: false, /******/ exports: {} /******/ }; /******/ @@ -7325,11 +8871,23 @@ module.exports = require("zlib");; /******/ if(threw) delete __webpack_module_cache__[moduleId]; /******/ } /******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ +/******/ /* webpack/runtime/node module decorator */ +/******/ (() => { +/******/ __webpack_require__.nmd = (module) => { +/******/ module.paths = []; +/******/ if (!module.children) module.children = []; +/******/ return module; +/******/ }; +/******/ })(); +/******/ /******/ /* webpack/runtime/compat */ /******/ /******/ __webpack_require__.ab = __dirname + "/";/************************************************************************/ diff --git a/docs/advanced.en-US.md b/docs/advanced.en-US.md index 4462cb1..8b47522 100644 --- a/docs/advanced.en-US.md +++ b/docs/advanced.en-US.md @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest steps: - name: check-inactive - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'check-inactive' token: ${{ secrets.GITHUB_TOKEN }} @@ -73,7 +73,7 @@ jobs: runs-on: ubuntu-latest steps: - name: check-issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'check-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -110,7 +110,7 @@ jobs: runs-on: ubuntu-latest steps: - name: close-issues - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'close-issues' token: ${{ secrets.GITHUB_TOKEN }} @@ -142,7 +142,7 @@ Find the current warehouse issue No. 1, the creator is k and the content contain ```yml - name: Find comments - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'find-comments' token: ${{ secrets.GITHUB_TOKEN }} @@ -188,7 +188,7 @@ jobs: runs-on: ubuntu-latest steps: - name: lock-issues - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'lock-issues' token: ${{ secrets.GITHUB_TOKEN }} @@ -232,7 +232,7 @@ jobs: runs-on: ubuntu-latest steps: - name: month-statistics - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'month-statistics' token: ${{ secrets.GITHUB_TOKEN }} diff --git a/docs/advanced.md b/docs/advanced.md index ac7825d..c4f3710 100644 --- a/docs/advanced.md +++ b/docs/advanced.md @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest steps: - name: check-inactive - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'check-inactive' token: ${{ secrets.GITHUB_TOKEN }} @@ -69,7 +69,7 @@ jobs: runs-on: ubuntu-latest steps: - name: check-issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'check-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -106,7 +106,7 @@ jobs: runs-on: ubuntu-latest steps: - name: close-issues - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'close-issues' token: ${{ secrets.GITHUB_TOKEN }} @@ -138,7 +138,7 @@ jobs: ```yml - name: Find comments - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'find-comments' token: ${{ secrets.GITHUB_TOKEN }} @@ -184,7 +184,7 @@ jobs: runs-on: ubuntu-latest steps: - name: lock-issues - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'lock-issues' token: ${{ secrets.GITHUB_TOKEN }} @@ -228,7 +228,7 @@ jobs: runs-on: ubuntu-latest steps: - name: month-statistics - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'month-statistics' token: ${{ secrets.GITHUB_TOKEN }} diff --git a/docs/base.en-US.md b/docs/base.en-US.md index 1109e03..e0f622b 100644 --- a/docs/base.en-US.md +++ b/docs/base.en-US.md @@ -22,12 +22,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Add assigness - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'add-assignees' token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ github.event.issue.number }} assignees: 'xxx' or 'xx1,xx2' + random-to: 1 ``` | Param | Desc | Type | Required | @@ -36,6 +37,7 @@ jobs: | token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | | issue-number | The number of issue | number | ✔ | | assignees | Designated person. No operation when no input or empty character | string | ✖ | +| random-to | When set, it will be randomly selected in assignees | number | ✖ | - `actions` support multiple and separated by comma. Like: `add-assignees,add-labels` - The `name` can be modified according to the actual situation @@ -60,7 +62,7 @@ jobs: if: contains(github.event.issue.body, 'xxx') == false steps: - name: Add labels - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'add-labels' token: ${{ secrets.GITHUB_TOKEN }} @@ -83,7 +85,7 @@ Close the specified issue. ```yml - name: Close issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'close-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -114,7 +116,7 @@ jobs: if: github.event.label.name == 'xxx' steps: - name: Create comment - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'create-comment' token: ${{ secrets.GITHUB_TOKEN }} @@ -156,7 +158,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Create issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'create-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -175,6 +177,7 @@ jobs: | body | The body of the new issue | string | ✖ | | labels | The labels for the new issue | string | ✖ | | assignees | The assignees for the new issue | string | ✖ | +| random-to | When set, it will be randomly selected in assignees | number | ✖ | | contents | Add [reaction](/en-US/guide/ref#-reactions-type) | string | ✖ | - `title` default is `Default Title` @@ -186,7 +189,7 @@ According to [`comment-id`](/en-US/guide/ref#-comment-id) delete the specified c ```yml - name: Delete comment - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'delete-comment' token: ${{ secrets.GITHUB_TOKEN }} @@ -216,7 +219,7 @@ jobs: if: github.event.label.name == 'invalid' steps: - name: Lock issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'lock-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -245,7 +248,7 @@ jobs: runs-on: ubuntu-latest steps: - name: mark-duplicate - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'mark-duplicate' token: ${{ secrets.GITHUB_TOKEN }} @@ -277,7 +280,7 @@ Open the specified issue. ```yml - name: Open issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'open-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -296,7 +299,7 @@ Remove the person designated by issue. ```yml - name: Remove assignees - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'remove-assignees' token: ${{ secrets.GITHUB_TOKEN }} @@ -317,7 +320,7 @@ Remove the specified labels. ```yml - name: Remove labels - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'remove-labels' token: ${{ secrets.GITHUB_TOKEN }} @@ -340,7 +343,7 @@ Replace the labels of issue. ```yml - name: Set labels - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'set-labels' token: ${{ secrets.GITHUB_TOKEN }} @@ -361,7 +364,7 @@ Unlock the specified issue. ```yml - name: Unlock issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'unlock-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -392,7 +395,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Update comment - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'update-comment' token: ${{ secrets.GITHUB_TOKEN }} @@ -418,7 +421,7 @@ Update the specified issue according to the `issue-number`. ```yml - name: Update issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'update-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -466,7 +469,7 @@ jobs: runs-on: ubuntu-latest steps: - name: welcome - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'welcome' token: ${{ secrets.GITHUB_TOKEN }} diff --git a/docs/base.md b/docs/base.md index fa603fa..b58486b 100644 --- a/docs/base.md +++ b/docs/base.md @@ -22,12 +22,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Add assigness - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'add-assignees' token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ github.event.issue.number }} assignees: 'xxx' or 'xx1,xx2' + random-to: 1 ``` | 参数 | 描述 | 类型 | 必填 | @@ -36,6 +37,7 @@ jobs: | token | [token 说明](/guide/ref#-token-说明) | string | ✔ | | issue-number | 指定的 issue | number | ✔ | | assignees | 指定人。当不填或者为空字符时,不操作 | string | ✖ | +| random-to | 当设置时,会在 assignees 中随机选择 | number | ✖ | - `actions` 支持多个,需用逗号隔开。如:`add-assignees,add-labels` - 其中的 `name` 可根据自行根据实际情况修改 @@ -60,7 +62,7 @@ jobs: if: contains(github.event.issue.body, 'xxx') == false steps: - name: Add labels - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'add-labels' token: ${{ secrets.GITHUB_TOKEN }} @@ -83,7 +85,7 @@ jobs: ```yml - name: Close issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'close-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -114,7 +116,7 @@ jobs: if: github.event.label.name == 'xxx' steps: - name: Create comment - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'create-comment' token: ${{ secrets.GITHUB_TOKEN }} @@ -156,7 +158,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Create issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'create-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -175,6 +177,7 @@ jobs: | body | 新增 issue 的内容 | string | ✖ | | labels | 为新增 issue 添加 labels | string | ✖ | | assignees | 为新增 issue 添加 assignees | string | ✖ | +| random-to | 当设置时,会在 assignees 中随机选择 | number | ✖ | | contents | 为新增 issue 增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ | - `title` 默认为:`Default Title` @@ -186,7 +189,7 @@ jobs: ```yml - name: Delete comment - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'delete-comment' token: ${{ secrets.GITHUB_TOKEN }} @@ -216,7 +219,7 @@ jobs: if: github.event.label.name == 'invalid' steps: - name: Lock issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'lock-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -245,7 +248,7 @@ jobs: runs-on: ubuntu-latest steps: - name: mark-duplicate - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'mark-duplicate' token: ${{ secrets.GITHUB_TOKEN }} @@ -277,7 +280,7 @@ jobs: ```yml - name: Open issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'open-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -296,7 +299,7 @@ jobs: ```yml - name: Remove assignees - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'remove-assignees' token: ${{ secrets.GITHUB_TOKEN }} @@ -317,7 +320,7 @@ jobs: ```yml - name: Remove labels - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'remove-labels' token: ${{ secrets.GITHUB_TOKEN }} @@ -340,7 +343,7 @@ jobs: ```yml - name: Set labels - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'set-labels' token: ${{ secrets.GITHUB_TOKEN }} @@ -361,7 +364,7 @@ jobs: ```yml - name: Unlock issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'unlock-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -392,7 +395,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Update comment - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'update-comment' token: ${{ secrets.GITHUB_TOKEN }} @@ -418,7 +421,7 @@ jobs: ```yml - name: Update issue - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'update-issue' token: ${{ secrets.GITHUB_TOKEN }} @@ -465,7 +468,7 @@ jobs: runs-on: ubuntu-latest steps: - name: welcome - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'welcome' token: ${{ secrets.GITHUB_TOKEN }} diff --git a/docs/guide/note.en-US.md b/docs/guide/note.en-US.md index 6fa1942..d24c6a9 100644 --- a/docs/guide/note.en-US.md +++ b/docs/guide/note.en-US.md @@ -37,3 +37,8 @@ At the same time, the output is also in string format When an action is set, such as adding a label `x1` to an issue, Actions will automatically add a label `x2` to the issue. But if this is done by `GitHub Actions bot` (that is, the token in the actions is not passed, or the default `token: ${{ secrets.GITHUB_TOKEN }}` is used), the actions of label `x2` will not be triggered. + +## `assignees` scope + +- The owner or collaborator of the warehouse, if there is an organization, including members +- Participants of the issue, including creators and commenters diff --git a/docs/guide/note.md b/docs/guide/note.md index 00ca4b4..6b3b509 100644 --- a/docs/guide/note.md +++ b/docs/guide/note.md @@ -38,3 +38,8 @@ with: 当设置了一个 Actions,如为给一个 issue 新增 label `x1` 时,Actions 自动为该 issue 增加 `x2` label。 但如果这个是由 `GitHub Actions bot` 完成的(即 actions 中 token 不传,或使用默认 `token: ${{ secrets.GITHUB_TOKEN }}`),则不会触发 label `x2` 的 Actions。 + +## `assignees` 范围 + +- 仓库的所有者或协作者,若有组织,包括成员 +- issue 的参与者,包括创建者、评论者 diff --git a/docs/index.en-US.md b/docs/index.en-US.md index cedef4c..e706d72 100644 --- a/docs/index.en-US.md +++ b/docs/index.en-US.md @@ -38,7 +38,7 @@ jobs: steps: - name: help wanted if: github.event.label.name == 'help wanted' - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'create-comment' token: ${{ secrets.GITHUB_TOKEN }} diff --git a/docs/index.md b/docs/index.md index 5182622..9e22268 100644 --- a/docs/index.md +++ b/docs/index.md @@ -38,7 +38,7 @@ jobs: steps: - name: help wanted if: github.event.label.name == 'help wanted' - uses: actions-cool/issues-helper@v1.8 + uses: actions-cool/issues-helper@v1.9 with: actions: 'create-comment' token: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index 06d88d7..f64b9db 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "issue-helper", - "version": "1.7.0", + "version": "1.9.0", "private": true, "description": "Some operations on issue.", "main": "src/main.js", @@ -13,7 +13,7 @@ "package": "ncc build src/main.js -o dist", "users": "node ./script/update-users.js", "main": "node ./src/main.js", - "version": "node ./script/update-version.js" + "ver": "node ./script/update-version.js" }, "author": "xrkffgg", "license": "MIT", @@ -32,7 +32,8 @@ "@actions/core": "^1.2.6", "@actions/github": "^4.0.0", "@octokit/rest": "^18.0.12", - "dayjs": "^1.9.7" + "dayjs": "^1.9.7", + "lodash": "^4.17.20" }, "devDependencies": { "@vercel/ncc": "^0.25.1", diff --git a/script/update-version.js b/script/update-version.js index 58a5be5..7a768cf 100644 --- a/script/update-version.js +++ b/script/update-version.js @@ -1,7 +1,7 @@ const { readFileSync, writeFileSync } = require('fs'); -const last = /v1\.7/g; -const now = 'v1.8'; +const last = /v1\.8/g; +const now = 'v1.9'; let readme = readFileSync('./README.md', 'utf-8'); readme = readme.replace(last, now); diff --git a/src/advanced.js b/src/advanced.js index 63a5aa6..5d83bd6 100644 --- a/src/advanced.js +++ b/src/advanced.js @@ -17,7 +17,7 @@ const { } = require('./public.js'); const { - dealInput, + dealStringToArr, matchKeyword, getPreMonth } = require('./util.js'); @@ -83,7 +83,7 @@ async function doCheckIssue (owner, repo, issueNumber) { }); if (!!checkResult && assigneeIncludes) { - let assigneesCheck = dealInput(assigneeIncludes); + let assigneesCheck = dealStringToArr(assigneeIncludes); let checkAssignee = false; issue.data.assignees.forEach(it => { if (checkResult && !checkAssignee && assigneesCheck.includes(it.login)) { @@ -96,8 +96,8 @@ async function doCheckIssue (owner, repo, issueNumber) { if (!!checkResult && titleIncludes) { const titleArr = titleIncludes.split('/'); - const keyword1 = dealInput(titleArr[0]); - const keyword2 = dealInput(titleArr[1]); + const keyword1 = dealStringToArr(titleArr[0]); + const keyword2 = dealStringToArr(titleArr[1]); checkResult = keyword2.length ? matchKeyword(issue.data.title, keyword1) && matchKeyword(issue.data.title, keyword2) : @@ -106,8 +106,8 @@ async function doCheckIssue (owner, repo, issueNumber) { if (!!checkResult && bodyIncludes) { const bodyArr = bodyIncludes.split('/'); - const keyword1 = dealInput(bodyArr[0]); - const keyword2 = dealInput(bodyArr[1]); + const keyword1 = dealStringToArr(bodyArr[0]); + const keyword2 = dealStringToArr(bodyArr[1]); checkResult = keyword2.length ? matchKeyword(issue.data.body, keyword1) && matchKeyword(issue.data.body, keyword2) : diff --git a/src/base.js b/src/base.js index c8a917c..4d484e4 100644 --- a/src/base.js +++ b/src/base.js @@ -20,7 +20,8 @@ const { } = require('./public.js'); const { - dealInput, + dealStringToArr, + dealRandomAssignees, testDuplicate, } = require('./util.js'); @@ -31,15 +32,18 @@ const context = github.context; const contents = core.getInput("contents"); +const randomTo = core.getInput("random-to"); + // ************************************************************************** async function doAddAssignees (owner, repo, issueNumber, assignees) { + const arr = dealRandomAssignees(assignees, randomTo); await octokit.issues.addAssignees({ owner, repo, issue_number: issueNumber, - assignees: dealInput(assignees) + assignees: arr }); - core.info(`Actions: [add-assignees][${assignees}] success!`); + core.info(`Actions: [add-assignees][${arr}] success!`); }; async function doAddLabels (owner, repo, issueNumber, labels) { @@ -47,7 +51,7 @@ async function doAddLabels (owner, repo, issueNumber, labels) { owner, repo, issue_number: issueNumber, - labels: dealInput(labels) + labels: dealStringToArr(labels) }); core.info(`Actions: [add-labels][${labels}] success!`); }; @@ -73,7 +77,7 @@ async function doCreateComment (owner, repo, issueNumber, body) { core.setOutput("comment-id", data.id); if (contents) { - await doCreateCommentContent(owner, repo, data.id, dealInput(contents)); + await doCreateCommentContent(owner, repo, data.id, dealStringToArr(contents)); } }; @@ -99,8 +103,8 @@ async function doCreateIssue (owner, repo, title, body, labels, assignees) { repo, title, body, - labels: dealInput(labels), - assignees: dealInput(assignees), + labels: dealStringToArr(labels), + assignees: dealRandomAssignees(assignees, randomTo), }; const { data } = await octokit.issues.create(params); @@ -108,7 +112,7 @@ async function doCreateIssue (owner, repo, title, body, labels, assignees) { core.setOutput("issue-number", data.number); if (contents) { - await doCreateIssueContent(owner, repo, data.number, dealInput(contents)); + await doCreateIssueContent(owner, repo, data.number, dealStringToArr(contents)); } }; @@ -160,7 +164,7 @@ async function doMarkDuplicate (owner, repo, labels) { const duplicateLabels = core.getInput("duplicate-labels"); const removeLables = core.getInput("remove-labels"); const closeIssue = core.getInput("close-issue"); - + const commentId = context.payload.comment.id; const commentBody = context.payload.comment.body; const issueNumber = context.payload.issue.number; @@ -172,7 +176,7 @@ async function doMarkDuplicate (owner, repo, labels) { const nextBody = commentBody.replace(duplicateCommand, 'Duplicate of'); await doUpdateComment(owner, repo, commentId, nextBody, 'replace', true); } else if (contents) { - await doCreateCommentContent(owner, repo, commentId, dealInput(contents)); + await doCreateCommentContent(owner, repo, commentId, dealStringToArr(contents)); } if (duplicateLabels) { await doAddLabels(owner, repo, issueNumber, duplicateLabels); @@ -206,7 +210,7 @@ async function doRemoveAssignees (owner, repo, issueNumber, assignees) { owner, repo, issue_number: issueNumber, - assignees: dealInput(assignees), + assignees: dealStringToArr(assignees) }); core.info(`Actions: [remove-assignees][${assignees}] success!`); }; @@ -217,7 +221,7 @@ async function doRemoveLabels (owner, repo, issueNumber, labels) { repo, issue_number: issueNumber }); - const dealLabels = dealInput(labels); + const dealLabels = dealStringToArr(labels); let addLables = []; if (dealLabels.length) { issue.data.labels.forEach(item => { @@ -238,7 +242,7 @@ async function doSetLabels (owner, repo, issueNumber, labels) { owner, repo, issue_number: issueNumber, - labels: dealInput(labels) + labels: dealStringToArr(labels) }); core.info(`Actions: [set-labels][${labels}] success!`); }; @@ -285,7 +289,7 @@ async function doUpdateComment ( } if (contents) { - await doCreateCommentContent(owner, repo, commentId, dealInput(contents)); + await doCreateCommentContent(owner, repo, commentId, dealStringToArr(contents)); } }; @@ -343,8 +347,8 @@ async function doUpdateIssue ( } params.body = next_body; - params.labels = labels ? dealInput(labels) : issue_labels; - params.assignees = assignees ? dealInput(assignees) : issue_assignees; + params.labels = labels ? dealStringToArr(labels) : issue_labels; + params.assignees = assignees ? dealStringToArr(assignees) : issue_assignees; await octokit.issues.update(params); core.info(`Actions: [update-issue][${issueNumber}] success!`); @@ -381,7 +385,7 @@ async function doWelcome (owner, repo, assignees, labels, body) { } if (issueContents) { - await doCreateIssueContent(owner, repo, issueNumber, dealInput(issueContents)); + await doCreateIssueContent(owner, repo, issueNumber, dealStringToArr(issueContents)); } } else { core.info(`Actions: [welcome][${auth}] is not first time!`); diff --git a/src/less/dumi.less b/src/less/dumi.less index b2c5d9c..38de424 100644 --- a/src/less/dumi.less +++ b/src/less/dumi.less @@ -97,4 +97,10 @@ width: 14px; height: 14px; } -} \ No newline at end of file +} + +.__dumi-default-menu + .__dumi-default-layout-content { + tbody tr:hover { + background: #fafafa; + } +} diff --git a/src/util.js b/src/util.js index 48163a9..c728fc1 100644 --- a/src/util.js +++ b/src/util.js @@ -1,4 +1,6 @@ -function dealInput (para) { +const sampleSize = require('lodash/sampleSize'); + +function dealStringToArr (para) { /** * in 'x1,x2,x3' * out ['x1','x2','x3'] @@ -15,6 +17,14 @@ function dealInput (para) { return arr; }; +function dealRandomAssignees (assignees, randomTo) { + let arr = dealStringToArr(assignees); + if (randomTo && Number(randomTo) > 0 && Number(randomTo) < arr.length) { + arr = sampleSize(arr, randomTo); + } + return arr; +}; + function matchKeyword (content, keywords) { return keywords.find(item => content.toLowerCase().includes(item)); }; @@ -37,7 +47,8 @@ function getPreMonth (m) { }; module.exports = { - dealInput, + dealStringToArr, + dealRandomAssignees, getPreMonth, matchKeyword, testDuplicate,