mirror of
https://github.com/actions/stale.git
synced 2025-12-23 17:08:18 +00:00
Compare commits
168 Commits
v2.0.1
...
test-dash-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be4d1402c1 | ||
|
|
2af88ebbea | ||
|
|
713e405f0c | ||
|
|
2b520f1a1a | ||
|
|
98ed4cb500 | ||
|
|
523075947f | ||
|
|
5a36bdc457 | ||
|
|
4a6aba205d | ||
|
|
2a6d5d6990 | ||
|
|
ebd757c01b | ||
|
|
1ebe9f7454 | ||
|
|
a61d498059 | ||
|
|
0a21a5ec79 | ||
|
|
e7199f9c84 | ||
|
|
e307118008 | ||
|
|
b53e7be65a | ||
|
|
ff764c226b | ||
|
|
c11507e9b7 | ||
|
|
440fb174b5 | ||
|
|
043fbbdea3 | ||
|
|
c70e174d4a | ||
|
|
704929ea5a | ||
|
|
5e20aa8410 | ||
|
|
10eec4583b | ||
|
|
b717aa9f47 | ||
|
|
3b3c3f03cd | ||
|
|
70f07a7b62 | ||
|
|
6a2a52084e | ||
|
|
bea117ba11 | ||
|
|
c181784783 | ||
|
|
93cc018477 | ||
|
|
b80d40901f | ||
|
|
10e1968c4f | ||
|
|
ba1c02f61a | ||
|
|
419a53bc05 | ||
|
|
63ae8ac024 | ||
|
|
8f5f223d0c | ||
|
|
aac59820db | ||
|
|
4109d00d07 | ||
|
|
b3213c1ffa | ||
|
|
12d218f917 | ||
|
|
e1732283c7 | ||
|
|
8439944051 | ||
|
|
0e95ddbecb | ||
|
|
836169b81a | ||
|
|
ec96ff65b0 | ||
|
|
996798eb71 | ||
|
|
6a0398d581 | ||
|
|
7499904a44 | ||
|
|
a8c9fbca3b | ||
|
|
8df2fb36e6 | ||
|
|
d4d9b2a583 | ||
|
|
aee97aa05d | ||
|
|
d6e4b48a0d | ||
|
|
6a493760cf | ||
|
|
07f3f88b6d | ||
|
|
e2a65edb45 | ||
|
|
076138c5c7 | ||
|
|
bf7548e250 | ||
|
|
e96f31f877 | ||
|
|
9d6f46564a | ||
|
|
d21d307fd8 | ||
|
|
7164109781 | ||
|
|
079c368275 | ||
|
|
86561461b9 | ||
|
|
342b612d3c | ||
|
|
d09524cd2c | ||
|
|
f71123a6f7 | ||
|
|
1b9f13b607 | ||
|
|
f8321eb62b | ||
|
|
6a04021499 | ||
|
|
7e83de7bef | ||
|
|
a9eccc216e | ||
|
|
0fa41d1841 | ||
|
|
f698371c0d | ||
|
|
7f340a46f3 | ||
|
|
3f95874437 | ||
|
|
e6b77bc964 | ||
|
|
552e4c60f0 | ||
|
|
b12dccced8 | ||
|
|
7de5f1946d | ||
|
|
546a4e9fd6 | ||
|
|
b5b956deb3 | ||
|
|
6674e9130f | ||
|
|
73dbf86108 | ||
|
|
a0b4b61711 | ||
|
|
0f78ebc7dc | ||
|
|
b70b09d43a | ||
|
|
aca4d264ff | ||
|
|
44c3cb508b | ||
|
|
39de730f99 | ||
|
|
ddc7648635 | ||
|
|
107018c400 | ||
|
|
87c2b794b9 | ||
|
|
b7c7b1c5c3 | ||
|
|
08900ff5d1 | ||
|
|
6ea8297c81 | ||
|
|
23d5d28543 | ||
|
|
2c5799741a | ||
|
|
324009e5d0 | ||
|
|
9b82e8c1ef | ||
|
|
af40726159 | ||
|
|
658139a1f1 | ||
|
|
707ba4d103 | ||
|
|
62b357a603 | ||
|
|
f75b3c75ce | ||
|
|
44f9eae0ad | ||
|
|
822baa686f | ||
|
|
1849651e2a | ||
|
|
adc83cbd46 | ||
|
|
691fea805f | ||
|
|
65b38a69a5 | ||
|
|
1919ea432e | ||
|
|
1402601e7a | ||
|
|
655dd09f5f | ||
|
|
13b324e4b2 | ||
|
|
23eab295e2 | ||
|
|
eaf242a915 | ||
|
|
4a0a0749b5 | ||
|
|
1307cb353c | ||
|
|
b27322af5b | ||
|
|
dd4a97b31e | ||
|
|
a7478d45d8 | ||
|
|
98cd444728 | ||
|
|
ca45985add | ||
|
|
7f1a446107 | ||
|
|
1bf8703966 | ||
|
|
4a56be9b6f | ||
|
|
03812d1bb3 | ||
|
|
56abb00656 | ||
|
|
f71b93c3a7 | ||
|
|
42acadb62c | ||
|
|
b646156368 | ||
|
|
250a2d2fc5 | ||
|
|
e976731ae8 | ||
|
|
1e5e734da7 | ||
|
|
5420e6bbac | ||
|
|
fbaa974a12 | ||
|
|
213e2e3dbb | ||
|
|
d54efb59cb | ||
|
|
0c5c86b836 | ||
|
|
ade4f65ff5 | ||
|
|
1200f63335 | ||
|
|
321a0c1996 | ||
|
|
6599f03bfe | ||
|
|
facad6de84 | ||
|
|
2ede1ed234 | ||
|
|
c95554e7b3 | ||
|
|
93883857f8 | ||
|
|
f111c4f385 | ||
|
|
c2daa6ff62 | ||
|
|
32507178a3 | ||
|
|
e169e4e149 | ||
|
|
d7468118d7 | ||
|
|
c72e3d7ff2 | ||
|
|
db0a20585c | ||
|
|
b6f9559915 | ||
|
|
96b682d29f | ||
|
|
5ce6b77f2c | ||
|
|
71d46bfe23 | ||
|
|
e611bf905b | ||
|
|
1e900bc060 | ||
|
|
3838b887be | ||
|
|
4f9b6a7a5c | ||
|
|
8743296016 | ||
|
|
7328f2e6e5 | ||
|
|
2b063ba4d4 | ||
|
|
ae2c5c5308 |
118
.eslintrc.json
118
.eslintrc.json
@@ -1,55 +1,65 @@
|
||||
{
|
||||
"plugins": ["jest", "@typescript-eslint"],
|
||||
"extends": ["plugin:github/es6"],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 9,
|
||||
"sourceType": "module",
|
||||
"project": "./tsconfig.json"
|
||||
},
|
||||
"rules": {
|
||||
"eslint-comments/no-use": "off",
|
||||
"import/no-namespace": "off",
|
||||
"no-unused-vars": "off",
|
||||
"@typescript-eslint/no-unused-vars": "error",
|
||||
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
|
||||
"@typescript-eslint/no-require-imports": "error",
|
||||
"@typescript-eslint/array-type": "error",
|
||||
"@typescript-eslint/await-thenable": "error",
|
||||
"@typescript-eslint/ban-ts-ignore": "error",
|
||||
"camelcase": "off",
|
||||
"@typescript-eslint/class-name-casing": "error",
|
||||
"@typescript-eslint/func-call-spacing": ["error", "never"],
|
||||
"@typescript-eslint/generic-type-naming": ["error", "^[A-Z][A-Za-z]*$"],
|
||||
"@typescript-eslint/no-array-constructor": "error",
|
||||
"@typescript-eslint/no-empty-interface": "error",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/no-extraneous-class": "error",
|
||||
"@typescript-eslint/no-for-in-array": "error",
|
||||
"@typescript-eslint/no-inferrable-types": "error",
|
||||
"@typescript-eslint/no-misused-new": "error",
|
||||
"@typescript-eslint/no-namespace": "error",
|
||||
"@typescript-eslint/no-non-null-assertion": "warn",
|
||||
"@typescript-eslint/no-object-literal-type-assertion": "error",
|
||||
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
||||
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
||||
"@typescript-eslint/no-useless-constructor": "error",
|
||||
"@typescript-eslint/no-var-requires": "error",
|
||||
"@typescript-eslint/prefer-for-of": "warn",
|
||||
"@typescript-eslint/prefer-function-type": "warn",
|
||||
"@typescript-eslint/prefer-includes": "error",
|
||||
"@typescript-eslint/prefer-interface": "error",
|
||||
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
||||
"@typescript-eslint/promise-function-async": "error",
|
||||
"@typescript-eslint/require-array-sort-compare": "error",
|
||||
"@typescript-eslint/restrict-plus-operands": "error",
|
||||
"semi": "off",
|
||||
"@typescript-eslint/type-annotation-spacing": "error",
|
||||
"@typescript-eslint/unbound-method": "off"
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true,
|
||||
"jest/globals": true
|
||||
}
|
||||
}
|
||||
"plugins": ["jest", "@typescript-eslint"],
|
||||
"extends": ["plugin:github/recommended"],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 9,
|
||||
"sourceType": "module",
|
||||
"project": "./tsconfig.json"
|
||||
},
|
||||
"rules": {
|
||||
"eslint-comments/no-use": "off",
|
||||
"import/no-namespace": "off",
|
||||
"no-unused-vars": "off",
|
||||
"@typescript-eslint/no-unused-vars": "error",
|
||||
"@typescript-eslint/explicit-member-accessibility": [
|
||||
"error",
|
||||
{
|
||||
"accessibility": "no-public"
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/no-require-imports": "error",
|
||||
"@typescript-eslint/array-type": "error",
|
||||
"@typescript-eslint/await-thenable": "error",
|
||||
"@typescript-eslint/ban-ts-comment": "error",
|
||||
"camelcase": "off",
|
||||
"@typescript-eslint/consistent-type-assertions": "error",
|
||||
"@typescript-eslint/func-call-spacing": ["error", "never"],
|
||||
"@typescript-eslint/no-array-constructor": "error",
|
||||
"@typescript-eslint/no-empty-interface": "error",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/no-extraneous-class": "error",
|
||||
"@typescript-eslint/no-for-in-array": "error",
|
||||
"@typescript-eslint/no-inferrable-types": "error",
|
||||
"@typescript-eslint/no-misused-new": "error",
|
||||
"@typescript-eslint/no-namespace": "error",
|
||||
"@typescript-eslint/no-non-null-assertion": "warn",
|
||||
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
||||
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
||||
"@typescript-eslint/no-useless-constructor": "error",
|
||||
"@typescript-eslint/no-var-requires": "error",
|
||||
"@typescript-eslint/prefer-for-of": "warn",
|
||||
"@typescript-eslint/prefer-function-type": "warn",
|
||||
"@typescript-eslint/prefer-includes": "error",
|
||||
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
||||
"@typescript-eslint/promise-function-async": "error",
|
||||
"@typescript-eslint/require-array-sort-compare": "error",
|
||||
"@typescript-eslint/restrict-plus-operands": "error",
|
||||
"semi": "off",
|
||||
"@typescript-eslint/type-annotation-spacing": "error",
|
||||
"@typescript-eslint/unbound-method": "off",
|
||||
"no-shadow": "off",
|
||||
"@typescript-eslint/no-shadow": "error",
|
||||
"prettier/prettier": [
|
||||
"error",
|
||||
{
|
||||
"endOfLine": "auto"
|
||||
}
|
||||
]
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true,
|
||||
"jest/globals": true
|
||||
}
|
||||
}
|
||||
|
||||
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.licenses/** -diff linguist-generated=true
|
||||
1
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
1
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
blank_issues_enabled: false
|
||||
13
.github/ISSUE_TEMPLATE/other_issue_report.md
vendored
Normal file
13
.github/ISSUE_TEMPLATE/other_issue_report.md
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
name: Other issue report
|
||||
about: Report other issue
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
## Describe your issue
|
||||
|
||||
## Further context
|
||||
|
||||
<!-- If helpful please provide screenshots, logs, links to other related issues. -->
|
||||
29
.github/ISSUE_TEMPLATE/stale_issue_report.md
vendored
Normal file
29
.github/ISSUE_TEMPLATE/stale_issue_report.md
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
name: Stale issue report
|
||||
about: Report issues with using the stale action
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
<!-- Have you tried the [debugging](https://github.com/actions/stale#debugging) section of the readme? -->
|
||||
|
||||
## Describe your issue
|
||||
|
||||
## Your stale action configuration
|
||||
|
||||
<!-- This is an example config, please copy/paste your config into it. -->
|
||||
|
||||
```yml
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ...
|
||||
steps:
|
||||
- uses: actions/stale@...
|
||||
with:
|
||||
...
|
||||
```
|
||||
|
||||
## Further context
|
||||
|
||||
<!-- If helpful please provide screenshots, logs, links to other related issues. -->
|
||||
9
.github/dependabot.yml
vendored
Normal file
9
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
version: 2
|
||||
updates:
|
||||
# Enable version updates for npm
|
||||
- package-ecosystem: 'npm'
|
||||
# Look for `package.json` and `lock` files in the `root` directory
|
||||
directory: '/'
|
||||
# Check the npm registry for updates every day (weekdays)
|
||||
schedule:
|
||||
interval: 'daily'
|
||||
8
.github/pull_request_template.md
vendored
Normal file
8
.github/pull_request_template.md
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<!-- List the change(s) you're making with this PR. -->
|
||||
## Changes
|
||||
- [x] ...
|
||||
|
||||
## Context
|
||||
|
||||
<!-- Explain why you're making the change(s). -->
|
||||
<!-- If you're closing an issue with this PR, [link them with a keyword](https://docs.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword). -->
|
||||
25
.github/workflows/codeql.yml
vendored
Normal file
25
.github/workflows/codeql.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
name: 'Code scanning'
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: '0 19 * * 0'
|
||||
|
||||
jobs:
|
||||
CodeQL-Build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
20
.github/workflows/licensed.off
vendored
Normal file
20
.github/workflows/licensed.off
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
name: Licensed
|
||||
|
||||
on:
|
||||
push: {branches: main}
|
||||
pull_request: {branches: main}
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
name: Check licenses
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: npm ci
|
||||
- name: Install licensed
|
||||
run: |
|
||||
cd $RUNNER_TEMP
|
||||
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.12.2/licensed-2.12.2-linux-x64.tar.gz
|
||||
sudo tar -xzf licensed.tar.gz
|
||||
sudo mv licensed /usr/local/bin/licensed
|
||||
- run: licensed status
|
||||
16
.github/workflows/stale.yml
vendored
Normal file
16
.github/workflows/stale.yml
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
name: 'Stale issue handler'
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@main
|
||||
with:
|
||||
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days'
|
||||
days-before-stale: 30
|
||||
days-before-close: 5
|
||||
exempt-issue-labels: 'blocked,must,should,keep'
|
||||
25
.github/workflows/test.yml
vendored
25
.github/workflows/test.yml
vendored
@@ -1,26 +1,25 @@
|
||||
name: "Build"
|
||||
name: 'Build'
|
||||
on: # rebuild any PRs and main branch changes
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
- 'releases/*'
|
||||
|
||||
jobs:
|
||||
build: # make sure build/ci work properly
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: |
|
||||
npm install
|
||||
npm run all
|
||||
- uses: actions/checkout@v2
|
||||
- run: |
|
||||
npm ci
|
||||
npm run all
|
||||
test: # make sure the action works on a clean machine without building
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ./
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'This issue is stale'
|
||||
stale-pr-message: 'This PR is stale'
|
||||
debug-only: true
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ./
|
||||
with:
|
||||
stale-issue-message: 'This issue is stale'
|
||||
stale-pr-message: 'This PR is stale'
|
||||
debug-only: true
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,3 +2,4 @@
|
||||
node_modules/
|
||||
lib/
|
||||
__tests__/runner/*
|
||||
.idea
|
||||
|
||||
14
.licensed.yml
Normal file
14
.licensed.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
sources:
|
||||
npm: true
|
||||
|
||||
allowed:
|
||||
- apache-2.0
|
||||
- bsd-2-clause
|
||||
- bsd-3-clause
|
||||
- isc
|
||||
- mit
|
||||
- cc0-1.0
|
||||
- unlicense
|
||||
|
||||
reviewed:
|
||||
npm:
|
||||
30
.licenses/npm/@actions/core.dep.yml
generated
Normal file
30
.licenses/npm/@actions/core.dep.yml
generated
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
name: "@actions/core"
|
||||
version: 1.2.4
|
||||
type: npm
|
||||
summary: Actions core lib
|
||||
homepage: https://github.com/actions/toolkit/tree/master/packages/core
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: Auto-generated MIT license text
|
||||
text: |
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
notices: []
|
||||
30
.licenses/npm/@actions/github.dep.yml
generated
Normal file
30
.licenses/npm/@actions/github.dep.yml
generated
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
name: "@actions/github"
|
||||
version: 4.0.0
|
||||
type: npm
|
||||
summary: Actions github lib
|
||||
homepage: https://github.com/actions/toolkit/tree/master/packages/github
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: Auto-generated MIT license text
|
||||
text: |
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
notices: []
|
||||
32
.licenses/npm/@actions/http-client.dep.yml
generated
Normal file
32
.licenses/npm/@actions/http-client.dep.yml
generated
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: "@actions/http-client"
|
||||
version: 1.0.8
|
||||
type: npm
|
||||
summary: Actions Http Client
|
||||
homepage: https://github.com/actions/http-client#readme
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
Actions Http Client for Node.js
|
||||
|
||||
Copyright (c) GitHub, Inc.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
||||
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
notices: []
|
||||
34
.licenses/npm/@octokit/auth-token.dep.yml
generated
Normal file
34
.licenses/npm/@octokit/auth-token.dep.yml
generated
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
name: "@octokit/auth-token"
|
||||
version: 2.4.2
|
||||
type: npm
|
||||
summary: GitHub API token authentication for browsers and Node.js
|
||||
homepage: https://github.com/octokit/auth-token.js#readme
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2019 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
- sources: README.md
|
||||
text: "[MIT](LICENSE)"
|
||||
notices: []
|
||||
34
.licenses/npm/@octokit/core.dep.yml
generated
Normal file
34
.licenses/npm/@octokit/core.dep.yml
generated
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
name: "@octokit/core"
|
||||
version: 3.1.1
|
||||
type: npm
|
||||
summary: Extendable client for GitHub's REST & GraphQL APIs
|
||||
homepage: https://github.com/octokit/core.js#readme
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2019 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
- sources: README.md
|
||||
text: "[MIT](LICENSE)"
|
||||
notices: []
|
||||
34
.licenses/npm/@octokit/endpoint.dep.yml
generated
Normal file
34
.licenses/npm/@octokit/endpoint.dep.yml
generated
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
name: "@octokit/endpoint"
|
||||
version: 6.0.5
|
||||
type: npm
|
||||
summary: Turns REST API endpoints into generic request options
|
||||
homepage: https://github.com/octokit/endpoint.js#readme
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2018 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
- sources: README.md
|
||||
text: "[MIT](LICENSE)"
|
||||
notices: []
|
||||
34
.licenses/npm/@octokit/graphql.dep.yml
generated
Normal file
34
.licenses/npm/@octokit/graphql.dep.yml
generated
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
name: "@octokit/graphql"
|
||||
version: 4.5.2
|
||||
type: npm
|
||||
summary: GitHub GraphQL API client for browsers and Node
|
||||
homepage: https://github.com/octokit/graphql.js#readme
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2018 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
- sources: README.md
|
||||
text: "[MIT](LICENSE)"
|
||||
notices: []
|
||||
20
.licenses/npm/@octokit/plugin-paginate-rest.dep.yml
generated
Normal file
20
.licenses/npm/@octokit/plugin-paginate-rest.dep.yml
generated
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: "@octokit/plugin-paginate-rest"
|
||||
version: 2.2.4
|
||||
type: npm
|
||||
summary: Octokit plugin to paginate REST API endpoint responses
|
||||
homepage: https://github.com/octokit/plugin-paginate-rest.js#readme
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
MIT License Copyright (c) 2019 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
- sources: README.md
|
||||
text: "[MIT](LICENSE)"
|
||||
notices: []
|
||||
20
.licenses/npm/@octokit/plugin-request-log.dep.yml
generated
Normal file
20
.licenses/npm/@octokit/plugin-request-log.dep.yml
generated
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: "@octokit/plugin-request-log"
|
||||
version: 1.0.0
|
||||
type: npm
|
||||
summary: Log all requests and request errors
|
||||
homepage: https://github.com/octokit/plugin-request-log.js#readme
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
MIT License Copyright (c) 2020 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
- sources: README.md
|
||||
text: "[MIT](LICENSE)"
|
||||
notices: []
|
||||
20
.licenses/npm/@octokit/plugin-rest-endpoint-methods-4.1.1.dep.yml
generated
Normal file
20
.licenses/npm/@octokit/plugin-rest-endpoint-methods-4.1.1.dep.yml
generated
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: "@octokit/plugin-rest-endpoint-methods"
|
||||
version: 4.1.1
|
||||
type: npm
|
||||
summary: Octokit plugin adding one method for all of api.github.com REST API endpoints
|
||||
homepage: https://github.com/octokit/plugin-rest-endpoint-methods.js#readme
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
MIT License Copyright (c) 2019 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
- sources: README.md
|
||||
text: "[MIT](LICENSE)"
|
||||
notices: []
|
||||
20
.licenses/npm/@octokit/plugin-rest-endpoint-methods-4.1.2.dep.yml
generated
Normal file
20
.licenses/npm/@octokit/plugin-rest-endpoint-methods-4.1.2.dep.yml
generated
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: "@octokit/plugin-rest-endpoint-methods"
|
||||
version: 4.1.2
|
||||
type: npm
|
||||
summary: Octokit plugin adding one method for all of api.github.com REST API endpoints
|
||||
homepage: https://github.com/octokit/plugin-rest-endpoint-methods.js#readme
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
MIT License Copyright (c) 2019 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
- sources: README.md
|
||||
text: "[MIT](LICENSE)"
|
||||
notices: []
|
||||
34
.licenses/npm/@octokit/request-error.dep.yml
generated
Normal file
34
.licenses/npm/@octokit/request-error.dep.yml
generated
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
name: "@octokit/request-error"
|
||||
version: 2.0.2
|
||||
type: npm
|
||||
summary: Error class for Octokit request errors
|
||||
homepage: https://github.com/octokit/request-error.js#readme
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2019 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
- sources: README.md
|
||||
text: "[MIT](LICENSE)"
|
||||
notices: []
|
||||
35
.licenses/npm/@octokit/request.dep.yml
generated
Normal file
35
.licenses/npm/@octokit/request.dep.yml
generated
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
name: "@octokit/request"
|
||||
version: 5.4.7
|
||||
type: npm
|
||||
summary: Send parameterized requests to GitHub’s APIs with sensible defaults in browsers
|
||||
and Node
|
||||
homepage: https://github.com/octokit/request.js#readme
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2018 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
- sources: README.md
|
||||
text: "[MIT](LICENSE)"
|
||||
notices: []
|
||||
35
.licenses/npm/@octokit/rest.dep.yml
generated
Normal file
35
.licenses/npm/@octokit/rest.dep.yml
generated
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
name: "@octokit/rest"
|
||||
version: 18.0.2
|
||||
type: npm
|
||||
summary: GitHub REST API client for Node.js
|
||||
homepage: https://github.com/octokit/rest.js#readme
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2012 Cloud9 IDE, Inc. (Mike de Boer)
|
||||
Copyright (c) 2017-2018 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
- sources: README.md
|
||||
text: "[MIT](LICENSE)"
|
||||
notices: []
|
||||
20
.licenses/npm/@octokit/types.dep.yml
generated
Normal file
20
.licenses/npm/@octokit/types.dep.yml
generated
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: "@octokit/types"
|
||||
version: 5.1.2
|
||||
type: npm
|
||||
summary: Shared TypeScript definitions for Octokit projects
|
||||
homepage: https://github.com/octokit/types.ts#readme
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
MIT License Copyright (c) 2019 Octokit contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
- sources: README.md
|
||||
text: "[MIT](LICENSE)"
|
||||
notices: []
|
||||
32
.licenses/npm/@types/node.dep.yml
generated
Normal file
32
.licenses/npm/@types/node.dep.yml
generated
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: "@types/node"
|
||||
version: 14.6.0
|
||||
type: npm
|
||||
summary: TypeScript definitions for Node.js
|
||||
homepage: https://github.com/DefinitelyTyped/DefinitelyTyped#readme
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |2
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE
|
||||
notices: []
|
||||
214
.licenses/npm/before-after-hook.dep.yml
generated
Normal file
214
.licenses/npm/before-after-hook.dep.yml
generated
Normal file
@@ -0,0 +1,214 @@
|
||||
---
|
||||
name: before-after-hook
|
||||
version: 2.1.0
|
||||
type: npm
|
||||
summary: asynchronous before/error/after hooks for internal functionality
|
||||
homepage: https://github.com/gr2m/before-after-hook#readme
|
||||
license: apache-2.0
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |2
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2018 Gregor Martynus and other contributors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
- sources: README.md
|
||||
text: "[Apache 2.0](LICENSE)"
|
||||
notices: []
|
||||
28
.licenses/npm/deprecation.dep.yml
generated
Normal file
28
.licenses/npm/deprecation.dep.yml
generated
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
name: deprecation
|
||||
version: 2.3.1
|
||||
type: npm
|
||||
summary: Log a deprecation message with stack
|
||||
homepage: https://github.com/gr2m/deprecation#readme
|
||||
license: isc
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Gregor Martynus and contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
- sources: README.md
|
||||
text: "[ISC](LICENSE)"
|
||||
notices: []
|
||||
40
.licenses/npm/is-plain-object.dep.yml
generated
Normal file
40
.licenses/npm/is-plain-object.dep.yml
generated
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
name: is-plain-object
|
||||
version: 4.1.1
|
||||
type: npm
|
||||
summary: Returns true if an object was created by the `Object` constructor, or Object.create(null).
|
||||
homepage: https://github.com/jonschlinkert/is-plain-object
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
- sources: README.md
|
||||
text: |-
|
||||
Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 28, 2019._
|
||||
notices: []
|
||||
52
.licenses/npm/node-fetch.dep.yml
generated
Normal file
52
.licenses/npm/node-fetch.dep.yml
generated
Normal file
@@ -0,0 +1,52 @@
|
||||
---
|
||||
name: node-fetch
|
||||
version: 2.6.0
|
||||
type: npm
|
||||
summary: A light-weight module that brings window.fetch to node.js
|
||||
homepage: https://github.com/bitinn/node-fetch
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE.md
|
||||
text: |+
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 David Frank
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
- sources: README.md
|
||||
text: |-
|
||||
MIT
|
||||
|
||||
[npm-image]: https://flat.badgen.net/npm/v/node-fetch
|
||||
[npm-url]: https://www.npmjs.com/package/node-fetch
|
||||
[travis-image]: https://flat.badgen.net/travis/bitinn/node-fetch
|
||||
[travis-url]: https://travis-ci.org/bitinn/node-fetch
|
||||
[codecov-image]: https://flat.badgen.net/codecov/c/github/bitinn/node-fetch/master
|
||||
[codecov-url]: https://codecov.io/gh/bitinn/node-fetch
|
||||
[install-size-image]: https://flat.badgen.net/packagephobia/install/node-fetch
|
||||
[install-size-url]: https://packagephobia.now.sh/result?p=node-fetch
|
||||
[whatwg-fetch]: https://fetch.spec.whatwg.org/
|
||||
[response-init]: https://fetch.spec.whatwg.org/#responseinit
|
||||
[node-readable]: https://nodejs.org/api/stream.html#stream_readable_streams
|
||||
[mdn-headers]: https://developer.mozilla.org/en-US/docs/Web/API/Headers
|
||||
[LIMITS.md]: https://github.com/bitinn/node-fetch/blob/master/LIMITS.md
|
||||
[ERROR-HANDLING.md]: https://github.com/bitinn/node-fetch/blob/master/ERROR-HANDLING.md
|
||||
[UPGRADE-GUIDE.md]: https://github.com/bitinn/node-fetch/blob/master/UPGRADE-GUIDE.md
|
||||
notices: []
|
||||
26
.licenses/npm/once.dep.yml
generated
Normal file
26
.licenses/npm/once.dep.yml
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
name: once
|
||||
version: 1.4.0
|
||||
type: npm
|
||||
summary: Run a function exactly one time
|
||||
homepage: https://github.com/isaacs/once#readme
|
||||
license: isc
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
notices: []
|
||||
26
.licenses/npm/semver.dep.yml
generated
Normal file
26
.licenses/npm/semver.dep.yml
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
name: semver
|
||||
version: 7.3.2
|
||||
type: npm
|
||||
summary: The semantic version parser used by npm.
|
||||
homepage: https://github.com/npm/node-semver#readme
|
||||
license: isc
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
notices: []
|
||||
35
.licenses/npm/tunnel.dep.yml
generated
Normal file
35
.licenses/npm/tunnel.dep.yml
generated
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
name: tunnel
|
||||
version: 0.0.6
|
||||
type: npm
|
||||
summary: Node HTTP/HTTPS Agents for tunneling proxies
|
||||
homepage: https://github.com/koichik/node-tunnel/
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2012 Koichi Kobayashi
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
- sources: README.md
|
||||
text: Licensed under the [MIT](https://github.com/koichik/node-tunnel/blob/master/LICENSE)
|
||||
license.
|
||||
notices: []
|
||||
20
.licenses/npm/universal-user-agent.dep.yml
generated
Normal file
20
.licenses/npm/universal-user-agent.dep.yml
generated
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: universal-user-agent
|
||||
version: 6.0.0
|
||||
type: npm
|
||||
summary: Get a user agent string in both browser and node
|
||||
homepage: https://github.com/gr2m/universal-user-agent#readme
|
||||
license: other
|
||||
licenses:
|
||||
- sources: LICENSE.md
|
||||
text: |
|
||||
# [ISC License](https://spdx.org/licenses/ISC)
|
||||
|
||||
Copyright (c) 2018, Gregor Martynus (https://github.com/gr2m)
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
- sources: README.md
|
||||
text: "[ISC](LICENSE.md)"
|
||||
notices: []
|
||||
26
.licenses/npm/wrappy.dep.yml
generated
Normal file
26
.licenses/npm/wrappy.dep.yml
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
name: wrappy
|
||||
version: 1.0.2
|
||||
type: npm
|
||||
summary: Callback wrapping utility
|
||||
homepage: https://github.com/npm/wrappy
|
||||
license: isc
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
notices: []
|
||||
7
.prettierignore
Normal file
7
.prettierignore
Normal file
@@ -0,0 +1,7 @@
|
||||
.idea
|
||||
.licenses
|
||||
.vscode
|
||||
dist
|
||||
lib
|
||||
node_modules
|
||||
package-lock.json
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"printWidth": 80,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"bracketSpacing": false,
|
||||
"arrowParens": "avoid",
|
||||
"parser": "typescript"
|
||||
}
|
||||
"printWidth": 80,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"bracketSpacing": false,
|
||||
"arrowParens": "avoid",
|
||||
"endOfLine": "auto"
|
||||
}
|
||||
|
||||
20
.vscode/launch.json
vendored
Normal file
20
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Debug Jest Tests",
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"program": "${workspaceRoot}/node_modules/jest/bin/jest",
|
||||
"args": [
|
||||
"-i"
|
||||
],
|
||||
"preLaunchTask": "tsc: build - tsconfig.app.json",
|
||||
"internalConsoleOptions": "openOnSessionStart",
|
||||
"console": "integratedTerminal",
|
||||
"outFiles": [
|
||||
"${workspaceRoot}/build/dist/**/*"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
7
CHANGELOG.md
Normal file
7
CHANGELOG.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [4.0.1](https://github.com/actions/stale/compare/v3.0.19...v4.0.1) (2021-05-19)
|
||||
|
||||
### [2.0.1](https://github.com/actions/stale/compare/v3.0.19...v2.0.1) (2021-05-19)
|
||||
1
CODEOWNERS
Normal file
1
CODEOWNERS
Normal file
@@ -0,0 +1 @@
|
||||
* @actions/actions-runtime
|
||||
45
CONTRIBUTING.md
Normal file
45
CONTRIBUTING.md
Normal file
@@ -0,0 +1,45 @@
|
||||
### Building and testing
|
||||
|
||||
Install the dependencies.
|
||||
|
||||
```bash
|
||||
$ npm install
|
||||
```
|
||||
|
||||
Build the typescript and package it for distribution.
|
||||
|
||||
```bash
|
||||
$ npm run build && npm run pack
|
||||
```
|
||||
|
||||
Run the tests :heavy_check_mark:
|
||||
|
||||
```bash
|
||||
$ npm test
|
||||
```
|
||||
|
||||
Run the tests and display only the first failing tests :heavy_check_mark:
|
||||
|
||||
```bash
|
||||
$ npm test:only-errors
|
||||
```
|
||||
|
||||
Run the tests with the watch mode :heavy_check_mark:
|
||||
|
||||
```bash
|
||||
$ npm test:watch
|
||||
```
|
||||
|
||||
Run the linter and fix (almost) every issue for you :heavy_check_mark:
|
||||
|
||||
```bash
|
||||
$ npm lint:all:fix
|
||||
```
|
||||
|
||||
### Before creating a PR
|
||||
|
||||
Build, lint, package and test everything.
|
||||
|
||||
```bash
|
||||
$ npm all
|
||||
```
|
||||
331
README.md
331
README.md
@@ -2,86 +2,327 @@
|
||||
|
||||
Warns and then closes issues and PRs that have had no activity for a specified amount of time.
|
||||
|
||||
### Building and testing
|
||||
## All options
|
||||
|
||||
Install the dependencies
|
||||
```bash
|
||||
$ npm install
|
||||
```
|
||||
### List of options
|
||||
|
||||
Build the typescript and package it for distribution
|
||||
```bash
|
||||
$ npm run build && npm run pack
|
||||
```
|
||||
Every argument is optional.
|
||||
|
||||
Run the tests :heavy_check_mark:
|
||||
```bash
|
||||
$ npm test
|
||||
```
|
||||
| Input | Description |
|
||||
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `repo-token` | PAT (Personal Access Token) for authorizing the repository.<br>_Defaults to **${{ github.token }}**_. |
|
||||
| `days-before-stale` | Idle number of days before marking an issue/PR as stale.<br>_Defaults to **60**_. |
|
||||
| `days-before-issue-stale` | Idle number of days before marking an issue as stale.<br>_Override `days-before-stale`_. |
|
||||
| `days-before-pr-stale` | Idle number of days before marking a PR as stale.<br>_Override `days-before-stale`_. |
|
||||
| `days-before-close` | Idle number of days before closing a stale issue/PR.<br>_Defaults to **7**_. |
|
||||
| `days-before-issue-close` | Idle number of days before closing a stale issue.<br>_Override `days-before-close`_. |
|
||||
| `days-before-pr-close` | Idle number of days before closing a stale PR.<br>_Override `days-before-close`_. |
|
||||
| `stale-issue-message` | Message to post on the stale issue. |
|
||||
| `stale-pr-message` | Message to post on the stale PR. |
|
||||
| `close-issue-message` | Message to post on the stale issue while closing it. |
|
||||
| `close-pr-message` | Message to post on the stale PR while closing it. |
|
||||
| `stale-issue-label` | Label to apply on the stale issue.<br>_Defaults to **Stale**_. |
|
||||
| `close-issue-label` | Label to apply on closing issue.<br>Automatically removed if no longer closed nor locked). |
|
||||
| `stale-pr-label` | Label to apply on the stale PR.<br>_Defaults to **Stale**_. |
|
||||
| `close-pr-label` | Label to apply on the closing PR.<br>Automatically removed if no longer closed nor locked). |
|
||||
| `exempt-issue-labels` | Labels on an issue exempted from being marked as stale. |
|
||||
| `exempt-pr-labels` | Labels on the PR exempted from being marked as stale. |
|
||||
| `only-labels` | Only issues and PRs with ALL these labels are checked.<br>Separate multiple labels with commas (eg. "question,answered"). |
|
||||
| `only-issue-labels` | Only issues with ALL these labels are checked.<br>Separate multiple labels with commas (eg. "question,answered").<br>_Override `only-labels`_. |
|
||||
| `only-pr-labels` | Only PRs with ALL these labels are checked.<br>Separate multiple labels with commas (eg. "question,answered").<br>_Override `only-labels`_. |
|
||||
| `any-of-labels` | Only issues and PRs with ANY of these labels are checked.<br>Separate multiple labels with commas (eg. "incomplete,waiting-feedback"). |
|
||||
| `any-of-issue-labels` | Only issues with ANY of these labels are checked.<br>Separate multiple labels with commas (eg. "incomplete,waiting-feedback").<br>_Override `any-of-labels`_. |
|
||||
| `any-of-pr-labels` | Only PRs with ANY of these labels are checked.<br>Separate multiple labels with commas (eg. "incomplete,waiting-feedback").<br>_Override `any-of-labels`_. |
|
||||
| `operations-per-run` | Maximum number of operations per run.<br>GitHub API CRUD related.<br>_Defaults to **30**_. |
|
||||
| `remove-stale-when-updated` | Remove stale label from issue/PR on updates or comments.<br>_Defaults to **true**_. |
|
||||
| `remove-issue-stale-when-updated` | Remove stale label from issue on updates or comments.<br>_Defaults to **true**_.<br>_Override `remove-stale-when-updated`_. |
|
||||
| `remove-pr-stale-when-updated` | Remove stale label from PR on updates or comments.<br>_Defaults to **true**_.<br>_Override `remove-stale-when-updated`_. |
|
||||
| `remove-issue-stale-when-updated` | Remove stale label from issue on updates or comments.<br>_Defaults to **true**_.<br>_Override `remove-stale-when-updated`_. |
|
||||
| `remove-pr-stale-when-updated` | Remove stale label from PR on updates or comments.<br>_Defaults to **true**_.<br>_Override `remove-stale-when-updated`_. |
|
||||
| `debug-only` | Dry-run on action.<br>_Defaults to **false**_. |
|
||||
| `ascending` | Order to get issues/PR.<br>`true` is ascending, `false` is descending.<br>_Defaults to **false**_. |
|
||||
| `skip-stale-issue-message` | Skip adding stale message on stale issue.<br>_Defaults to **false**_. |
|
||||
| `skip-stale-pr-message` | Skip adding stale message on stale PR.<br>_Defaults to **false**_. |
|
||||
| `start-date` | The date used to skip the stale action on issue/PR created before it.<br>ISO 8601 or RFC 2822. |
|
||||
| `delete-branch` | Delete the git branch after closing a stale pull request.<br>_Defaults to **false**_. |
|
||||
| `exempt-milestones` | Milestones on an issue or a PR exempted from being marked as stale. |
|
||||
| `exempt-issue-milestones` | Milestones on an issue exempted from being marked as stale.<br>_Override `exempt-milestones`_. |
|
||||
| `exempt-pr-milestones` | Milestones on the PR exempted from being marked as stale.<br>_Override `exempt-milestones`_. |
|
||||
| `exempt-all-milestones` | Exempt all issues and PRs with milestones from being marked as stale.<br>_Priority over `exempt-milestones` rules_. |
|
||||
| `exempt-all-issue-milestones` | Exempt all issues with milestones from being marked as stale.<br>_Override `exempt-all-milestones`_. |
|
||||
| `exempt-all-pr-milestones` | Exempt all PRs with milestones from being marked as stale.<br>_Override `exempt-all-milestones`_. |
|
||||
| `exempt-assignees` | Assignees on an issue or a PR exempted from being marked as stale. |
|
||||
| `exempt-issue-assignees` | Assignees on an issue exempted from being marked as stale.<br>_Override `exempt-assignees`_. |
|
||||
| `exempt-pr-assignees` | Assignees on the PR exempted from being marked as stale.<br>_Override `exempt-assignees`_. |
|
||||
| `exempt-all-assignees` | Exempt all issues and PRs with assignees from being marked as stale.<br>_Priority over `exempt-assignees` rules_. |
|
||||
| `exempt-all-issue-assignees` | Exempt all issues with assignees from being marked as stale.<br>_Override `exempt-all-assignees`_. |
|
||||
| `exempt-all-pr-assignees` | Exempt all PRs with assignees from being marked as stale.<br>_Override `exempt-all-assignees`_. |
|
||||
| `enable-statistics` | Display some statistics at the end of the logs regarding the stale workflow.<br>Only when the logs are enabled.<br>_Defaults to **true**_. |
|
||||
|
||||
### Detailed options
|
||||
|
||||
#### operations-per-run
|
||||
|
||||
_Context:_
|
||||
This action performs some API calls to GitHub to fetch or close issues and pull requests, set or update labels, add comments, delete branches, etc.
|
||||
These operations are made in a very short period of time - because the action is very fast to run - and can be numerous based on your project action configuration and the quantity of issues and pull requests within it.
|
||||
GitHub has a [rate limit](https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting) and if reached will block all of these API calls for one hour (or API calls from other actions using the same user (a.k.a: the github-token from the [repo-token](#repo-token) option)).
|
||||
This option helps you to stay within the GitHub rate limits, as you can use this option to limit the number of operations for a single run.
|
||||
|
||||
_Purpose:_
|
||||
This option aims to limit the number of operations made with the GitHub API to avoid reaching the [rate limit](https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting).
|
||||
|
||||
Based on your project, your GitHub business plan and the date of the cron job you set for this action, you can increase this limit to a higher number.
|
||||
If you are not sure which is the right value for you or if the default value is good enough, you could enable the logs and look at the end of the stale action.
|
||||
If you reached the limit, you will see a warning message in the logs, telling you that you should increase the number of operations.
|
||||
If you choose not to increase the limit, you might end up with un-processed issues or pull requests after a stale action run.
|
||||
|
||||
When [debugging](#Debugging), you can set it to a much higher number like `1000` since there will be fewer operations made with the GitHub API.
|
||||
Only the [actor](#repo-token) and the batch of issues (100 per batch) will consume the operations.
|
||||
|
||||
Default value: `30`
|
||||
|
||||
### Usage
|
||||
|
||||
See [action.yml](./action.yml) For comprehensive list of options.
|
||||
|
||||
See also [action.yml](./action.yml) for a comprehensive list of all the options.
|
||||
|
||||
Basic:
|
||||
|
||||
```yaml
|
||||
name: "Close stale issues"
|
||||
name: 'Close stale issues and PRs'
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
- cron: '30 1 * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v1.1.0
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'Message to comment on stale issues. If none provided, will not mark issues stale'
|
||||
stale-pr-message: 'Message to comment on stale PRs. If none provided, will not mark PRs stale'
|
||||
- uses: actions/stale@v3
|
||||
with:
|
||||
stale-issue-message: 'Message to comment on stale issues. If none provided, will not mark issues stale'
|
||||
stale-pr-message: 'Message to comment on stale PRs. If none provided, will not mark PRs stale'
|
||||
```
|
||||
|
||||
|
||||
Configure stale timeouts:
|
||||
|
||||
```yaml
|
||||
name: "Close stale issues"
|
||||
name: 'Close stale issues and PRs'
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
- cron: '30 1 * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v1.1.0
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days'
|
||||
days-before-stale: 30
|
||||
days-before-close: 5
|
||||
- uses: actions/stale@v3
|
||||
with:
|
||||
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
|
||||
days-before-stale: 30
|
||||
days-before-close: 5
|
||||
```
|
||||
|
||||
Configure labels:
|
||||
|
||||
Configure different stale timeouts but never close a PR:
|
||||
|
||||
```yaml
|
||||
name: "Close stale issues"
|
||||
name: 'Close stale issues and PR'
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
- cron: '30 1 * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v1.1.0
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'Stale issue message'
|
||||
stale-pr-message: 'Stale issue message'
|
||||
stale-issue-label: 'no-issue-activity'
|
||||
exempt-issue-labels: 'awaiting-approval,work-in-progress'
|
||||
stale-pr-label: 'no-pr-activity'
|
||||
exempt-pr-labels: 'awaiting-approval,work-in-progress'
|
||||
- uses: actions/stale@v3
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
|
||||
stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.'
|
||||
close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.'
|
||||
days-before-stale: 30
|
||||
days-before-close: 5
|
||||
days-before-pr-close: -1
|
||||
```
|
||||
|
||||
Configure different stale timeouts:
|
||||
|
||||
```yaml
|
||||
name: 'Close stale issues and PRs'
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 1 * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v3
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
|
||||
stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.'
|
||||
close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.'
|
||||
close-pr-message: 'This PR was closed because it has been stalled for 10 days with no activity.'
|
||||
days-before-issue-stale: 30
|
||||
days-before-pr-stale: 45
|
||||
days-before-issue-close: 5
|
||||
days-before-pr-close: 10
|
||||
```
|
||||
|
||||
Configure labels:
|
||||
|
||||
```yaml
|
||||
name: 'Close stale issues and PRs'
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 1 * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v3
|
||||
with:
|
||||
stale-issue-message: 'Stale issue message'
|
||||
stale-pr-message: 'Stale pull request message'
|
||||
stale-issue-label: 'no-issue-activity'
|
||||
exempt-issue-labels: 'awaiting-approval,work-in-progress'
|
||||
stale-pr-label: 'no-pr-activity'
|
||||
exempt-pr-labels: 'awaiting-approval,work-in-progress'
|
||||
only-labels: 'awaiting-feedback,awaiting-answers'
|
||||
```
|
||||
|
||||
Configure the stale action to only stale issue/PR created after the 18th april 2020:
|
||||
|
||||
```yaml
|
||||
name: 'Close stale issues and PRs'
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 1 * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v3
|
||||
with:
|
||||
start-date: '2020-18-04T00:00:00Z' // ISO 8601 or RFC 2822
|
||||
```
|
||||
|
||||
Avoid stale for specific milestones:
|
||||
|
||||
```yaml
|
||||
name: 'Close stale issues and PRs'
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 1 * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v3
|
||||
with:
|
||||
exempt-issue-milestones: 'future,alpha,beta'
|
||||
exempt-pr-milestones: 'bugfix,improvement'
|
||||
```
|
||||
|
||||
Avoid stale for all PR with milestones:
|
||||
|
||||
```yaml
|
||||
name: 'Close stale issues and PRs'
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 1 * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v3
|
||||
with:
|
||||
exempt-all-pr-milestones: true
|
||||
```
|
||||
|
||||
Check stale for specific labels:
|
||||
|
||||
```yaml
|
||||
name: 'Close stale issues and PRs'
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 1 * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v3
|
||||
with:
|
||||
any-of-labels: 'needs-more-info,needs-demo'
|
||||
# You can opt for 'only-labels' instead if your use-case requires all labels
|
||||
# to be present in the issue/PR
|
||||
```
|
||||
|
||||
Avoid stale for specific assignees:
|
||||
|
||||
```yaml
|
||||
name: 'Close stale issues and PRs'
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 1 * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v3
|
||||
with:
|
||||
exempt-issue-assignees: 'marco,polo'
|
||||
exempt-pr-assignees: 'marco'
|
||||
```
|
||||
|
||||
Avoid stale for all PR with assignees:
|
||||
|
||||
```yaml
|
||||
name: 'Close stale issues and PRs'
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 1 * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v3
|
||||
with:
|
||||
exempt-all-pr-assignees: true
|
||||
```
|
||||
|
||||
### Debugging
|
||||
|
||||
To see debug ouput from this action, you must set the secret `ACTIONS_STEP_DEBUG` to `true` in your repository. You can run this action in debug only mode (no actions will be taken on your issues) by passing `debug-only` `true` as an argument to the action.
|
||||
**Logs:**
|
||||
To see the debug output from this action, you must set the secret `ACTIONS_STEP_DEBUG` to `true` in your repository.
|
||||
There is a lot of logs so this can be very helpful!
|
||||
|
||||
**Statistics:**
|
||||
If the logs are enabled, you can also enable the statistics log which will be visible at the end of the logs once all issues were processed.
|
||||
This is very helpful to have a quick understanding of the whole stale workflow.
|
||||
Set `enable-statistics` to `true` in your workflow configuration file.
|
||||
|
||||
**Dry-run:**
|
||||
You can run this action in debug only mode (no actions will be taken on your issues and pull requests) by passing `debug-only` to `true` as an argument to the action.
|
||||
|
||||
**More operations:**
|
||||
You can increase the maximum number of operations per run by passing `operations-per-run` to `1000` for example which will help you to handle more operations in a single stale workflow run.
|
||||
If the `debug-only` option is enabled, this is very helpful because the workflow will (almost) never reach the GitHub API rate, and you will be able to deep-dive into the logs.
|
||||
|
||||
**Job frequency:**
|
||||
You could change the cron job frequency in the stale workflow to run the stale workflow more often.
|
||||
Usually this is not very helpful though.
|
||||
|
||||
### Contributing
|
||||
|
||||
You wish to contribute?
|
||||
Check out the [contributing](CONTRIBUTING.md) file before helping us.
|
||||
|
||||
1152
__tests__/any-of-labels.spec.ts
Normal file
1152
__tests__/any-of-labels.spec.ts
Normal file
File diff suppressed because it is too large
Load Diff
413
__tests__/assignees.spec.ts
Normal file
413
__tests__/assignees.spec.ts
Normal file
@@ -0,0 +1,413 @@
|
||||
import {Issue} from '../src/classes/issue';
|
||||
import {IIssuesProcessorOptions} from '../src/interfaces/issues-processor-options';
|
||||
import {IssuesProcessorMock} from './classes/issues-processor-mock';
|
||||
import {DefaultProcessorOptions} from './constants/default-processor-options';
|
||||
import {generateIssue} from './functions/generate-issue';
|
||||
|
||||
interface ITestData {
|
||||
id: number;
|
||||
isPullRequest: boolean;
|
||||
assignees: string[];
|
||||
exemptAllAssignees: boolean;
|
||||
exemptAllIssueAssignees: boolean | undefined;
|
||||
exemptAllPrAssignees: boolean | undefined;
|
||||
exemptAssignees: string;
|
||||
exemptIssueAssignees: string;
|
||||
exemptPrAssignees: string;
|
||||
shouldStale: boolean;
|
||||
description: string;
|
||||
}
|
||||
|
||||
describe('assignees options', (): void => {
|
||||
let opts: IIssuesProcessorOptions;
|
||||
let testIssueList: Issue[];
|
||||
let processor: IssuesProcessorMock;
|
||||
|
||||
const setTestIssueList = (
|
||||
isPullRequest: boolean,
|
||||
assignees: string[],
|
||||
id: number
|
||||
) => {
|
||||
testIssueList = [
|
||||
generateIssue(
|
||||
opts,
|
||||
id,
|
||||
'My first issue',
|
||||
'2020-01-01T17:00:00Z',
|
||||
'2020-01-01T17:00:00Z',
|
||||
isPullRequest,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
assignees
|
||||
)
|
||||
];
|
||||
};
|
||||
|
||||
const setProcessor = () => {
|
||||
processor = new IssuesProcessorMock(
|
||||
opts,
|
||||
async () => 'abot',
|
||||
async p => (p === 1 ? testIssueList : []),
|
||||
async () => [],
|
||||
async () => new Date().toDateString()
|
||||
);
|
||||
};
|
||||
|
||||
beforeEach((): void => {
|
||||
opts = {...DefaultProcessorOptions};
|
||||
});
|
||||
|
||||
describe.each`
|
||||
id | isPullRequest | assignees | exemptAllAssignees | exemptAllIssueAssignees | exemptAllPrAssignees | exemptAssignees | exemptIssueAssignees | exemptPrAssignees | shouldStale | description
|
||||
${100} | ${false} | ${[]} | ${false} | ${undefined} | ${undefined} | ${''} | ${''} | ${''} | ${true} | ${'when the issue does not have an assignee'}
|
||||
${101} | ${false} | ${[]} | ${true} | ${undefined} | ${undefined} | ${''} | ${''} | ${''} | ${true} | ${'when the issue does not have an assignee and only exemptAllAssignees is enabled'}
|
||||
${102} | ${false} | ${[]} | ${false} | ${true} | ${undefined} | ${''} | ${''} | ${''} | ${true} | ${'when the issue does not have an assignee and only exemptAllIssueAssignees is enabled'}
|
||||
${103} | ${false} | ${[]} | ${false} | ${undefined} | ${true} | ${''} | ${''} | ${''} | ${true} | ${'when the issue does not have an assignee and only exemptAllPrAssignees is enabled'}
|
||||
${104} | ${false} | ${[]} | ${true} | ${false} | ${undefined} | ${''} | ${''} | ${''} | ${true} | ${'when the issue does not have an assignee and exemptAllAssignees is enabled and exemptAllIssueAssignees is disabled'}
|
||||
${105} | ${false} | ${[]} | ${true} | ${true} | ${undefined} | ${''} | ${''} | ${''} | ${true} | ${'when the issue does not have an assignee and exemptAllAssignees is enabled and exemptAllIssueAssignees is enabled'}
|
||||
${106} | ${false} | ${[]} | ${true} | ${undefined} | ${false} | ${''} | ${''} | ${''} | ${true} | ${'when the issue does not have an assignee and exemptAllAssignees is enabled and exemptAllPrAssignees is disabled'}
|
||||
${107} | ${false} | ${[]} | ${true} | ${undefined} | ${true} | ${''} | ${''} | ${''} | ${true} | ${'when the issue does not have an assignee and exemptAllAssignees is enabled and exemptAllPrAssignees is enabled'}
|
||||
${108} | ${false} | ${[]} | ${false} | ${false} | ${undefined} | ${''} | ${''} | ${''} | ${true} | ${'when the issue does not have an assignee and exemptAllAssignees is disabled and exemptAllIssueAssignees is disabled'}
|
||||
${109} | ${false} | ${[]} | ${false} | ${true} | ${undefined} | ${''} | ${''} | ${''} | ${true} | ${'when the issue does not have an assignee and exemptAllAssignees is disabled and exemptAllIssueAssignees is enabled'}
|
||||
${200} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${''} | ${''} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled and exemptAllPrAssignees is disabled'}
|
||||
${201} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${''} | ${''} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled and exemptAllPrAssignees is enabled'}
|
||||
${202} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${undefined} | ${''} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and only exemptAllAssignees is enabled'}
|
||||
${203} | ${false} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${''} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and only exemptAllIssueAssignees is enabled'}
|
||||
${204} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${''} | ${''} | ${''} | ${true} | ${'when the issue has an assignee and only exemptAllPrAssignees is enabled'}
|
||||
${205} | ${false} | ${['assignee']} | ${true} | ${false} | ${undefined} | ${''} | ${''} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is enabled and exemptAllIssueAssignees is disabled'}
|
||||
${206} | ${false} | ${['assignee']} | ${true} | ${true} | ${undefined} | ${''} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled and exemptAllIssueAssignees is enabled'}
|
||||
${207} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${false} | ${''} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled and exemptAllPrAssignees is disabled'}
|
||||
${208} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${true} | ${''} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled and exemptAllPrAssignees is enabled'}
|
||||
${209} | ${false} | ${['assignee']} | ${false} | ${false} | ${undefined} | ${''} | ${''} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled and exemptAllIssueAssignees is disabled'}
|
||||
${210} | ${false} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${''} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled and exemptAllIssueAssignees is enabled'}
|
||||
${211} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${''} | ${''} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled and exemptAllPrAssignees is disabled'}
|
||||
${212} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${''} | ${''} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled and exemptAllPrAssignees is enabled'}
|
||||
${213} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${''} | ${''} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled and exemptAllPrAssignees is disabled'}
|
||||
${300} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'bad'} | ${''} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled and exemptAssignees has a different assignee'}
|
||||
${301} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${''} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled and exemptAssignees has a different assignee'}
|
||||
${302} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${undefined} | ${'bad'} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled and exemptAssignees has a different assignee'}
|
||||
${303} | ${false} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'bad'} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllIssueAssignees is enabled and exemptAssignees has a different assignee'}
|
||||
${304} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${''} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllPrAssignees is enabled and exemptAssignees has a different assignee'}
|
||||
${305} | ${false} | ${['assignee']} | ${true} | ${false} | ${undefined} | ${'bad'} | ${''} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is disabled and exemptAssignees has a different assignee'}
|
||||
${306} | ${false} | ${['assignee']} | ${true} | ${true} | ${undefined} | ${'bad'} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is enabled and exemptAssignees has a different assignee'}
|
||||
${307} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${false} | ${'bad'} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is disabled and exemptAssignees has a different assignee'}
|
||||
${308} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${true} | ${'bad'} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is enabled and exemptAssignees has a different assignee'}
|
||||
${309} | ${false} | ${['assignee']} | ${false} | ${false} | ${undefined} | ${'bad'} | ${''} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is disabled and exemptAssignees has a different assignee'}
|
||||
${310} | ${false} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'bad'} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is enabled and exemptAssignees has a different assignee'}
|
||||
${311} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'bad'} | ${''} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled and exemptAssignees has a different assignee'}
|
||||
${312} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${''} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled and exemptAssignees has a different assignee'}
|
||||
${313} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'bad'} | ${''} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled and exemptAssignees has a different assignee'}
|
||||
${400} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled and exemptAssignees has the same assignee'}
|
||||
${401} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled and exemptAssignees has the same assignee'}
|
||||
${402} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${undefined} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled and exemptAssignees has the same assignee'}
|
||||
${403} | ${false} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllIssueAssignees is enabled and exemptAssignees has the same assignee'}
|
||||
${404} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllPrAssignees is enabled and exemptAssignees has the same assignee'}
|
||||
${405} | ${false} | ${['assignee']} | ${true} | ${false} | ${undefined} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is disabled and exemptAssignees has the same assignee'}
|
||||
${406} | ${false} | ${['assignee']} | ${true} | ${true} | ${undefined} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is enabled and exemptAssignees has the same assignee'}
|
||||
${407} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${false} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is disabled and exemptAssignees has the same assignee'}
|
||||
${408} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${true} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is enabled and exemptAssignees has the same assignee'}
|
||||
${409} | ${false} | ${['assignee']} | ${false} | ${false} | ${undefined} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is disabled and exemptAssignees has the same assignee'}
|
||||
${410} | ${false} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is enabled and exemptAssignees has the same assignee'}
|
||||
${411} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled and exemptAssignees has the same assignee'}
|
||||
${412} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled and exemptAssignees has the same assignee'}
|
||||
${413} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled and exemptAssignees has the same assignee'}
|
||||
${500} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'bad'} | ${'bad'} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${501} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${'bad'} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${502} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${undefined} | ${'bad'} | ${'bad'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${503} | ${false} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'bad'} | ${'bad'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllIssueAssignees is enabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${504} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${'bad'} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllPrAssignees is enabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${505} | ${false} | ${['assignee']} | ${true} | ${false} | ${undefined} | ${'bad'} | ${'bad'} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is disabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${506} | ${false} | ${['assignee']} | ${true} | ${true} | ${undefined} | ${'bad'} | ${'bad'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is enabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${507} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${false} | ${'bad'} | ${'bad'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is disabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${508} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${true} | ${'bad'} | ${'bad'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is enabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${509} | ${false} | ${['assignee']} | ${false} | ${false} | ${undefined} | ${'bad'} | ${'bad'} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is disabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${510} | ${false} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'bad'} | ${'bad'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is enabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${511} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'bad'} | ${'bad'} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${512} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${'bad'} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${513} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'bad'} | ${'bad'} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${600} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'bad'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${601} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${602} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${undefined} | ${'bad'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${603} | ${false} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'bad'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllIssueAssignees is enabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${604} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllPrAssignees is enabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${605} | ${false} | ${['assignee']} | ${true} | ${false} | ${undefined} | ${'bad'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is disabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${606} | ${false} | ${['assignee']} | ${true} | ${true} | ${undefined} | ${'bad'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is enabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${607} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${false} | ${'bad'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is disabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${608} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${true} | ${'bad'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is enabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${609} | ${false} | ${['assignee']} | ${false} | ${false} | ${undefined} | ${'bad'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is disabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${610} | ${false} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'bad'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is enabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${611} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'bad'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${612} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${613} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'bad'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${700} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'bad'} | ${''} | ${'bad'} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${701} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${''} | ${'bad'} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${702} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${undefined} | ${'bad'} | ${''} | ${'bad'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${703} | ${false} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'bad'} | ${''} | ${'bad'} | ${false} | ${'when the issue has an assignee and exemptAllIssueAssignees is enabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${704} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${''} | ${'bad'} | ${true} | ${'when the issue has an assignee and exemptAllPrAssignees is enabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${705} | ${false} | ${['assignee']} | ${true} | ${false} | ${undefined} | ${'bad'} | ${''} | ${'bad'} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is disabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${706} | ${false} | ${['assignee']} | ${true} | ${true} | ${undefined} | ${'bad'} | ${''} | ${'bad'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is enabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${707} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${false} | ${'bad'} | ${''} | ${'bad'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is disabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${708} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${true} | ${'bad'} | ${''} | ${'bad'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is enabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${709} | ${false} | ${['assignee']} | ${false} | ${false} | ${undefined} | ${'bad'} | ${''} | ${'bad'} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is disabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${710} | ${false} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'bad'} | ${''} | ${'bad'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is enabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${711} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'bad'} | ${''} | ${'bad'} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${712} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${''} | ${'bad'} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${713} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'bad'} | ${''} | ${'bad'} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${800} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'bad'} | ${''} | ${'assignee'} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${801} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${''} | ${'assignee'} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${802} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${undefined} | ${'bad'} | ${''} | ${'assignee'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${803} | ${false} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'bad'} | ${''} | ${'assignee'} | ${false} | ${'when the issue has an assignee and exemptAllIssueAssignees is enabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${804} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${''} | ${'assignee'} | ${true} | ${'when the issue has an assignee and exemptAllPrAssignees is enabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${805} | ${false} | ${['assignee']} | ${true} | ${false} | ${undefined} | ${'bad'} | ${''} | ${'assignee'} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is disabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${806} | ${false} | ${['assignee']} | ${true} | ${true} | ${undefined} | ${'bad'} | ${''} | ${'assignee'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is enabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${807} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${false} | ${'bad'} | ${''} | ${'assignee'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is disabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${808} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${true} | ${'bad'} | ${''} | ${'assignee'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is enabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${809} | ${false} | ${['assignee']} | ${false} | ${false} | ${undefined} | ${'bad'} | ${''} | ${'assignee'} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is disabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${810} | ${false} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'bad'} | ${''} | ${'assignee'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is enabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${811} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'bad'} | ${''} | ${'assignee'} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${812} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${''} | ${'assignee'} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${813} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'bad'} | ${''} | ${'assignee'} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${900} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${'bad'} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${901} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${'bad'} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${902} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${undefined} | ${'assignee'} | ${'bad'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${903} | ${false} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'assignee'} | ${'bad'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllIssueAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${904} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${'bad'} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${905} | ${false} | ${['assignee']} | ${true} | ${false} | ${undefined} | ${'assignee'} | ${'bad'} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is disabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${906} | ${false} | ${['assignee']} | ${true} | ${true} | ${undefined} | ${'assignee'} | ${'bad'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${907} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${false} | ${'assignee'} | ${'bad'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${908} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${true} | ${'assignee'} | ${'bad'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${909} | ${false} | ${['assignee']} | ${false} | ${false} | ${undefined} | ${'assignee'} | ${'bad'} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is disabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${910} | ${false} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'assignee'} | ${'bad'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${911} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${'bad'} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${912} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${'bad'} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${913} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${'bad'} | ${''} | ${true} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${1000} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1001} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1002} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${undefined} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1003} | ${false} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllIssueAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1004} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1005} | ${false} | ${['assignee']} | ${true} | ${false} | ${undefined} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is disabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1006} | ${false} | ${['assignee']} | ${true} | ${true} | ${undefined} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1007} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${false} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1008} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${true} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1009} | ${false} | ${['assignee']} | ${false} | ${false} | ${undefined} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is disabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1010} | ${false} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1011} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1012} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1013} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1100} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${''} | ${'bad'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${1101} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${''} | ${'bad'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${1102} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${undefined} | ${'assignee'} | ${''} | ${'bad'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${1103} | ${false} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'assignee'} | ${''} | ${'bad'} | ${false} | ${'when the issue has an assignee and exemptAllIssueAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${1104} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${''} | ${'bad'} | ${false} | ${'when the issue has an assignee and exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${1105} | ${false} | ${['assignee']} | ${true} | ${false} | ${undefined} | ${'assignee'} | ${''} | ${'bad'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is disabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${1106} | ${false} | ${['assignee']} | ${true} | ${true} | ${undefined} | ${'assignee'} | ${''} | ${'bad'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${1107} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${false} | ${'assignee'} | ${''} | ${'bad'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${1108} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${true} | ${'assignee'} | ${''} | ${'bad'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${1109} | ${false} | ${['assignee']} | ${false} | ${false} | ${undefined} | ${'assignee'} | ${''} | ${'bad'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is disabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${1110} | ${false} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'assignee'} | ${''} | ${'bad'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${1111} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${''} | ${'bad'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${1112} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${''} | ${'bad'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${1113} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${''} | ${'bad'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${1200} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${1201} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${1202} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${undefined} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${1203} | ${false} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the issue has an assignee and exemptAllIssueAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${1204} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the issue has an assignee and exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${1205} | ${false} | ${['assignee']} | ${true} | ${false} | ${undefined} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is disabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${1206} | ${false} | ${['assignee']} | ${true} | ${true} | ${undefined} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${1207} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${false} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${1208} | ${false} | ${['assignee']} | ${true} | ${undefined} | ${true} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${1209} | ${false} | ${['assignee']} | ${false} | ${false} | ${undefined} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is disabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${1210} | ${false} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${1211} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${1212} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${1213} | ${false} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the issue has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${1300} | ${true} | ${[]} | ${false} | ${undefined} | ${undefined} | ${''} | ${''} | ${''} | ${true} | ${'when the pull request does not have an assignee'}
|
||||
${1301} | ${true} | ${[]} | ${true} | ${undefined} | ${undefined} | ${''} | ${''} | ${''} | ${true} | ${'when the pull request does not have an assignee and only exemptAllAssignees is enabled'}
|
||||
${1302} | ${true} | ${[]} | ${false} | ${true} | ${undefined} | ${''} | ${''} | ${''} | ${true} | ${'when the pull request does not have an assignee and only exemptAllIssueAssignees is enabled'}
|
||||
${1303} | ${true} | ${[]} | ${false} | ${undefined} | ${true} | ${''} | ${''} | ${''} | ${true} | ${'when the pull request does not have an assignee and only exemptAllPrAssignees is enabled'}
|
||||
${1304} | ${true} | ${[]} | ${true} | ${false} | ${undefined} | ${''} | ${''} | ${''} | ${true} | ${'when the pull request does not have an assignee and exemptAllAssignees is enabled and exemptAllIssueAssignees is disabled'}
|
||||
${1305} | ${true} | ${[]} | ${true} | ${true} | ${undefined} | ${''} | ${''} | ${''} | ${true} | ${'when the pull request does not have an assignee and exemptAllAssignees is enabled and exemptAllIssueAssignees is enabled'}
|
||||
${1306} | ${true} | ${[]} | ${true} | ${undefined} | ${false} | ${''} | ${''} | ${''} | ${true} | ${'when the pull request does not have an assignee and exemptAllAssignees is enabled and exemptAllPrAssignees is disabled'}
|
||||
${1307} | ${true} | ${[]} | ${true} | ${undefined} | ${true} | ${''} | ${''} | ${''} | ${true} | ${'when the pull request does not have an assignee and exemptAllAssignees is enabled and exemptAllPrAssignees is enabled'}
|
||||
${1308} | ${true} | ${[]} | ${false} | ${false} | ${undefined} | ${''} | ${''} | ${''} | ${true} | ${'when the pull request does not have an assignee and exemptAllAssignees is disabled and exemptAllIssueAssignees is disabled'}
|
||||
${1309} | ${true} | ${[]} | ${false} | ${true} | ${undefined} | ${''} | ${''} | ${''} | ${true} | ${'when the pull request does not have an assignee and exemptAllAssignees is disabled and exemptAllIssueAssignees is enabled'}
|
||||
${1400} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${''} | ${''} | ${''} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is disabled and exemptAllPrAssignees is disabled'}
|
||||
${1401} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${''} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled and exemptAllPrAssignees is enabled'}
|
||||
${1402} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${undefined} | ${''} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and only exemptAllAssignees is enabled'}
|
||||
${1403} | ${true} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${''} | ${''} | ${''} | ${true} | ${'when the pull request has an assignee and only exemptAllIssueAssignees is enabled'}
|
||||
${1404} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${''} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and only exemptAllPrAssignees is enabled'}
|
||||
${1405} | ${true} | ${['assignee']} | ${true} | ${false} | ${undefined} | ${''} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled and exemptAllIssueAssignees is disabled'}
|
||||
${1406} | ${true} | ${['assignee']} | ${true} | ${true} | ${undefined} | ${''} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled and exemptAllIssueAssignees is enabled'}
|
||||
${1407} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${false} | ${''} | ${''} | ${''} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is enabled and exemptAllPrAssignees is disabled'}
|
||||
${1408} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${true} | ${''} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled and exemptAllPrAssignees is enabled'}
|
||||
${1409} | ${true} | ${['assignee']} | ${false} | ${false} | ${undefined} | ${''} | ${''} | ${''} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is disabled and exemptAllIssueAssignees is disabled'}
|
||||
${1410} | ${true} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${''} | ${''} | ${''} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is disabled and exemptAllIssueAssignees is enabled'}
|
||||
${1411} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${''} | ${''} | ${''} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is disabled and exemptAllPrAssignees is disabled'}
|
||||
${1412} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${''} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled and exemptAllPrAssignees is enabled'}
|
||||
${1413} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${''} | ${''} | ${''} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is disabled and exemptAllPrAssignees is disabled'}
|
||||
${1500} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'bad'} | ${''} | ${''} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled and exemptAssignees has a different assignee'}
|
||||
${1501} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled and exemptAssignees has a different assignee'}
|
||||
${1502} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${undefined} | ${'bad'} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled and exemptAssignees has a different assignee'}
|
||||
${1503} | ${true} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'bad'} | ${''} | ${''} | ${true} | ${'when the pull request has an assignee and exemptAllIssueAssignees is enabled and exemptAssignees has a different assignee'}
|
||||
${1504} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllPrAssignees is enabled and exemptAssignees has a different assignee'}
|
||||
${1505} | ${true} | ${['assignee']} | ${true} | ${false} | ${undefined} | ${'bad'} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is disabled and exemptAssignees has a different assignee'}
|
||||
${1506} | ${true} | ${['assignee']} | ${true} | ${true} | ${undefined} | ${'bad'} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is enabled and exemptAssignees has a different assignee'}
|
||||
${1507} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${false} | ${'bad'} | ${''} | ${''} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is disabled and exemptAssignees has a different assignee'}
|
||||
${1508} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${true} | ${'bad'} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is enabled and exemptAssignees has a different assignee'}
|
||||
${1509} | ${true} | ${['assignee']} | ${false} | ${false} | ${undefined} | ${'bad'} | ${''} | ${''} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is disabled and exemptAssignees has a different assignee'}
|
||||
${1510} | ${true} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'bad'} | ${''} | ${''} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is enabled and exemptAssignees has a different assignee'}
|
||||
${1511} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'bad'} | ${''} | ${''} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled and exemptAssignees has a different assignee'}
|
||||
${1513} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'bad'} | ${''} | ${''} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled and exemptAssignees has a different assignee'}
|
||||
${1600} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled and exemptAssignees has the same assignee'}
|
||||
${1601} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled and exemptAssignees has the same assignee'}
|
||||
${1602} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${undefined} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled and exemptAssignees has the same assignee'}
|
||||
${1603} | ${true} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllIssueAssignees is enabled and exemptAssignees has the same assignee'}
|
||||
${1604} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllPrAssignees is enabled and exemptAssignees has the same assignee'}
|
||||
${1605} | ${true} | ${['assignee']} | ${true} | ${false} | ${undefined} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is disabled and exemptAssignees has the same assignee'}
|
||||
${1606} | ${true} | ${['assignee']} | ${true} | ${true} | ${undefined} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is enabled and exemptAssignees has the same assignee'}
|
||||
${1607} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${false} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is disabled and exemptAssignees has the same assignee'}
|
||||
${1608} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${true} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is enabled and exemptAssignees has the same assignee'}
|
||||
${1609} | ${true} | ${['assignee']} | ${false} | ${false} | ${undefined} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is disabled and exemptAssignees has the same assignee'}
|
||||
${1610} | ${true} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is enabled and exemptAssignees has the same assignee'}
|
||||
${1611} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled and exemptAssignees has the same assignee'}
|
||||
${1612} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled and exemptAssignees has the same assignee'}
|
||||
${1613} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${''} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled and exemptAssignees has the same assignee'}
|
||||
${1701} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${'bad'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${1702} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${undefined} | ${'bad'} | ${'bad'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${1703} | ${true} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'bad'} | ${'bad'} | ${''} | ${true} | ${'when the pull request has an assignee and exemptAllIssueAssignees is enabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${1704} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${'bad'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllPrAssignees is enabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${1705} | ${true} | ${['assignee']} | ${true} | ${false} | ${undefined} | ${'bad'} | ${'bad'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is disabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${1706} | ${true} | ${['assignee']} | ${true} | ${true} | ${undefined} | ${'bad'} | ${'bad'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is enabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${1707} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${false} | ${'bad'} | ${'bad'} | ${''} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is disabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${1708} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${true} | ${'bad'} | ${'bad'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is enabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${1709} | ${true} | ${['assignee']} | ${false} | ${false} | ${undefined} | ${'bad'} | ${'bad'} | ${''} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is disabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${1710} | ${true} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'bad'} | ${'bad'} | ${''} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is enabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${1711} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'bad'} | ${'bad'} | ${''} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled and exemptAssignees and exemptIssueAssignees has a different assignee'}
|
||||
${1800} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${undefined} | ${'bad'} | ${'assignee'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1801} | ${true} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'bad'} | ${'assignee'} | ${''} | ${true} | ${'when the pull request has an assignee and exemptAllIssueAssignees is enabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1802} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${'assignee'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllPrAssignees is enabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1803} | ${true} | ${['assignee']} | ${true} | ${false} | ${undefined} | ${'bad'} | ${'assignee'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is disabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1804} | ${true} | ${['assignee']} | ${true} | ${true} | ${undefined} | ${'bad'} | ${'assignee'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is enabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1805} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${false} | ${'bad'} | ${'assignee'} | ${''} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is disabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1806} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${true} | ${'bad'} | ${'assignee'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is enabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1807} | ${true} | ${['assignee']} | ${false} | ${false} | ${undefined} | ${'bad'} | ${'assignee'} | ${''} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is disabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1808} | ${true} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'bad'} | ${'assignee'} | ${''} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is enabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1809} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${'assignee'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1810} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'bad'} | ${'assignee'} | ${''} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has a different assignee and exemptIssueAssignees has the same assignee'}
|
||||
${1900} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${''} | ${'bad'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${1901} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${undefined} | ${'bad'} | ${''} | ${'bad'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${1902} | ${true} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'bad'} | ${''} | ${'bad'} | ${true} | ${'when the pull request has an assignee and exemptAllIssueAssignees is enabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${1903} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${''} | ${'bad'} | ${false} | ${'when the pull request has an assignee and exemptAllPrAssignees is enabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${1904} | ${true} | ${['assignee']} | ${true} | ${false} | ${undefined} | ${'bad'} | ${''} | ${'bad'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is disabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${1905} | ${true} | ${['assignee']} | ${true} | ${true} | ${undefined} | ${'bad'} | ${''} | ${'bad'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is enabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${1906} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${false} | ${'bad'} | ${''} | ${'bad'} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is disabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${1907} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${true} | ${'bad'} | ${''} | ${'bad'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is enabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${1908} | ${true} | ${['assignee']} | ${false} | ${false} | ${undefined} | ${'bad'} | ${''} | ${'bad'} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is disabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${1909} | ${true} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'bad'} | ${''} | ${'bad'} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is enabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${1910} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${''} | ${'bad'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${1911} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'bad'} | ${''} | ${'bad'} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled and exemptAssignees and exemptPrAssignees has a different assignee'}
|
||||
${2000} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${undefined} | ${'bad'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${2001} | ${true} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'bad'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllIssueAssignees is enabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${2002} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllPrAssignees is enabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${2003} | ${true} | ${['assignee']} | ${true} | ${false} | ${undefined} | ${'bad'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is disabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${2004} | ${true} | ${['assignee']} | ${true} | ${true} | ${undefined} | ${'bad'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is enabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${2005} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${false} | ${'bad'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is disabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${2006} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${true} | ${'bad'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is enabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${2007} | ${true} | ${['assignee']} | ${false} | ${false} | ${undefined} | ${'bad'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is disabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${2008} | ${true} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'bad'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is enabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${2009} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'bad'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${2010} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'bad'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has a different assignee and exemptPrAssignees has the same assignee'}
|
||||
${2100} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${'bad'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${2101} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${undefined} | ${'assignee'} | ${'bad'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${2102} | ${true} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'assignee'} | ${'bad'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllIssueAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${2103} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${'bad'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${2104} | ${true} | ${['assignee']} | ${true} | ${false} | ${undefined} | ${'assignee'} | ${'bad'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is disabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${2105} | ${true} | ${['assignee']} | ${true} | ${true} | ${undefined} | ${'assignee'} | ${'bad'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${2106} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${false} | ${'assignee'} | ${'bad'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${2107} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${true} | ${'assignee'} | ${'bad'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${2108} | ${true} | ${['assignee']} | ${false} | ${false} | ${undefined} | ${'assignee'} | ${'bad'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is disabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${2109} | ${true} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'assignee'} | ${'bad'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${2110} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${'bad'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptIssueAssignees has a different assignee'}
|
||||
${2200} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${2201} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${2202} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${undefined} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${2203} | ${true} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllIssueAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${2204} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${2205} | ${true} | ${['assignee']} | ${true} | ${false} | ${undefined} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is disabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${2206} | ${true} | ${['assignee']} | ${true} | ${true} | ${undefined} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${2207} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${false} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${2208} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${true} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${2209} | ${true} | ${['assignee']} | ${false} | ${false} | ${undefined} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is disabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${2210} | ${true} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${2311} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${2312} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${2313} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${'assignee'} | ${''} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptIssueAssignees has the same assignee'}
|
||||
${2300} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${''} | ${'bad'} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${2301} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${''} | ${'bad'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${2302} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${undefined} | ${'assignee'} | ${''} | ${'bad'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${2303} | ${true} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'assignee'} | ${''} | ${'bad'} | ${true} | ${'when the pull request has an assignee and exemptAllIssueAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${2304} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${''} | ${'bad'} | ${false} | ${'when the pull request has an assignee and exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${2305} | ${true} | ${['assignee']} | ${true} | ${false} | ${undefined} | ${'assignee'} | ${''} | ${'bad'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is disabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${2306} | ${true} | ${['assignee']} | ${true} | ${true} | ${undefined} | ${'assignee'} | ${''} | ${'bad'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${2307} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${false} | ${'assignee'} | ${''} | ${'bad'} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${2308} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${true} | ${'assignee'} | ${''} | ${'bad'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${2309} | ${true} | ${['assignee']} | ${false} | ${false} | ${undefined} | ${'assignee'} | ${''} | ${'bad'} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is disabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${2310} | ${true} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'assignee'} | ${''} | ${'bad'} | ${true} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${2311} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${''} | ${'bad'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has a different assignee'}
|
||||
${2400} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${2401} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${2402} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${undefined} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${2403} | ${true} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllIssueAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${2404} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${2405} | ${true} | ${['assignee']} | ${true} | ${false} | ${undefined} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is disabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${2406} | ${true} | ${['assignee']} | ${true} | ${true} | ${undefined} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllIssueAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${2407} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${false} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${2408} | ${true} | ${['assignee']} | ${true} | ${undefined} | ${true} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is enabled, exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${2409} | ${true} | ${['assignee']} | ${false} | ${false} | ${undefined} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is disabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${2410} | ${true} | ${['assignee']} | ${false} | ${true} | ${undefined} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllIssueAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${2411} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${2412} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${true} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is enabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
${2413} | ${true} | ${['assignee']} | ${false} | ${undefined} | ${false} | ${'assignee'} | ${''} | ${'assignee'} | ${false} | ${'when the pull request has an assignee and exemptAllAssignees is disabled, exemptAllPrAssignees is disabled, exemptAssignees has the same assignee and exemptPrAssignees has the same assignee'}
|
||||
`(
|
||||
'$description',
|
||||
({
|
||||
id,
|
||||
isPullRequest,
|
||||
assignees,
|
||||
exemptAllAssignees,
|
||||
exemptAllIssueAssignees,
|
||||
exemptAllPrAssignees,
|
||||
exemptAssignees,
|
||||
exemptIssueAssignees,
|
||||
exemptPrAssignees,
|
||||
shouldStale
|
||||
}: ITestData): void => {
|
||||
beforeEach((): void => {
|
||||
opts.exemptAllAssignees = exemptAllAssignees;
|
||||
opts.exemptAllIssueAssignees = exemptAllIssueAssignees;
|
||||
opts.exemptAllPrAssignees = exemptAllPrAssignees;
|
||||
opts.exemptAssignees = exemptAssignees;
|
||||
opts.exemptIssueAssignees = exemptIssueAssignees;
|
||||
opts.exemptPrAssignees = exemptPrAssignees;
|
||||
setTestIssueList(isPullRequest, assignees, id);
|
||||
setProcessor();
|
||||
});
|
||||
|
||||
test(`should${
|
||||
shouldStale ? '' : ' not'
|
||||
} be marked as stale`, async () => {
|
||||
expect.assertions(3);
|
||||
|
||||
await processor.processIssues(1);
|
||||
|
||||
expect(processor.staleIssues).toHaveLength(shouldStale ? 1 : 0);
|
||||
expect(processor.closedIssues).toHaveLength(0);
|
||||
expect(processor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
38
__tests__/classes/issues-processor-mock.ts
Normal file
38
__tests__/classes/issues-processor-mock.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import {Issue} from '../../src/classes/issue';
|
||||
import {IssuesProcessor} from '../../src/classes/issues-processor';
|
||||
import {IComment} from '../../src/interfaces/comment';
|
||||
import {IIssuesProcessorOptions} from '../../src/interfaces/issues-processor-options';
|
||||
|
||||
export class IssuesProcessorMock extends IssuesProcessor {
|
||||
constructor(
|
||||
options: IIssuesProcessorOptions,
|
||||
getActor?: () => Promise<string>,
|
||||
getIssues?: (page: number) => Promise<Issue[]>,
|
||||
listIssueComments?: (
|
||||
issueNumber: number,
|
||||
sinceDate: string
|
||||
) => Promise<IComment[]>,
|
||||
getLabelCreationDate?: (
|
||||
issue: Issue,
|
||||
label: string
|
||||
) => Promise<string | undefined>
|
||||
) {
|
||||
super(options);
|
||||
|
||||
if (getActor) {
|
||||
this.getActor = getActor;
|
||||
}
|
||||
|
||||
if (getIssues) {
|
||||
this.getIssues = getIssues;
|
||||
}
|
||||
|
||||
if (listIssueComments) {
|
||||
this.listIssueComments = listIssueComments;
|
||||
}
|
||||
|
||||
if (getLabelCreationDate) {
|
||||
this.getLabelCreationDate = getLabelCreationDate;
|
||||
}
|
||||
}
|
||||
}
|
||||
50
__tests__/constants/default-processor-options.ts
Normal file
50
__tests__/constants/default-processor-options.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import {IIssuesProcessorOptions} from '../../src/interfaces/issues-processor-options';
|
||||
|
||||
export const DefaultProcessorOptions: IIssuesProcessorOptions = Object.freeze({
|
||||
repoToken: 'none',
|
||||
staleIssueMessage: 'This issue is stale',
|
||||
stalePrMessage: 'This PR is stale',
|
||||
closeIssueMessage: 'This issue is being closed',
|
||||
closePrMessage: 'This PR is being closed',
|
||||
daysBeforeStale: 1,
|
||||
daysBeforeIssueStale: NaN,
|
||||
daysBeforePrStale: NaN,
|
||||
daysBeforeClose: 30,
|
||||
daysBeforeIssueClose: NaN,
|
||||
daysBeforePrClose: NaN,
|
||||
staleIssueLabel: 'Stale',
|
||||
closeIssueLabel: '',
|
||||
exemptIssueLabels: '',
|
||||
stalePrLabel: 'Stale',
|
||||
closePrLabel: '',
|
||||
exemptPrLabels: '',
|
||||
onlyLabels: '',
|
||||
onlyIssueLabels: '',
|
||||
onlyPrLabels: '',
|
||||
anyOfLabels: '',
|
||||
anyOfIssueLabels: '',
|
||||
anyOfPrLabels: '',
|
||||
operationsPerRun: 100,
|
||||
debugOnly: true,
|
||||
removeStaleWhenUpdated: false,
|
||||
removeIssueStaleWhenUpdated: undefined,
|
||||
removePrStaleWhenUpdated: undefined,
|
||||
ascending: false,
|
||||
skipStaleIssueMessage: false,
|
||||
skipStalePrMessage: false,
|
||||
deleteBranch: false,
|
||||
startDate: '',
|
||||
exemptMilestones: '',
|
||||
exemptIssueMilestones: '',
|
||||
exemptPrMilestones: '',
|
||||
exemptAllMilestones: false,
|
||||
exemptAllIssueMilestones: undefined,
|
||||
exemptAllPrMilestones: undefined,
|
||||
exemptAssignees: '',
|
||||
exemptIssueAssignees: '',
|
||||
exemptPrAssignees: '',
|
||||
exemptAllAssignees: false,
|
||||
exemptAllIssueAssignees: undefined,
|
||||
exemptAllPrAssignees: undefined,
|
||||
enableStatistics: true
|
||||
});
|
||||
19
__tests__/functions/generate-iissue.ts
Normal file
19
__tests__/functions/generate-iissue.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import {IIssue} from '../../src/interfaces/issue';
|
||||
|
||||
export function generateIIssue(
|
||||
partialIssue?: Readonly<Partial<IIssue>>
|
||||
): IIssue {
|
||||
return {
|
||||
milestone: undefined,
|
||||
assignees: [],
|
||||
labels: [],
|
||||
created_at: new Date().toISOString(),
|
||||
updated_at: new Date().toISOString(),
|
||||
number: Math.round(Math.random() * 5000),
|
||||
pull_request: null,
|
||||
title: 'dummy-title',
|
||||
locked: false,
|
||||
state: 'dummy-state',
|
||||
...partialIssue
|
||||
};
|
||||
}
|
||||
43
__tests__/functions/generate-issue.ts
Normal file
43
__tests__/functions/generate-issue.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import {Issue} from '../../src/classes/issue';
|
||||
import {IAssignee} from '../../src/interfaces/assignee';
|
||||
import {IIssuesProcessorOptions} from '../../src/interfaces/issues-processor-options';
|
||||
import {IsoDateString} from '../../src/types/iso-date-string';
|
||||
|
||||
export function generateIssue(
|
||||
options: IIssuesProcessorOptions,
|
||||
id: number,
|
||||
title: string,
|
||||
updatedAt: IsoDateString,
|
||||
createdAt: IsoDateString = updatedAt,
|
||||
isPullRequest = false,
|
||||
labels: string[] = [],
|
||||
isClosed = false,
|
||||
isLocked = false,
|
||||
milestone: string | undefined = undefined,
|
||||
assignees: string[] = []
|
||||
): Issue {
|
||||
return new Issue(options, {
|
||||
number: id,
|
||||
labels: labels.map(l => {
|
||||
return {name: l};
|
||||
}),
|
||||
title,
|
||||
created_at: createdAt,
|
||||
updated_at: updatedAt,
|
||||
pull_request: isPullRequest ? {} : null,
|
||||
state: isClosed ? 'closed' : 'open',
|
||||
locked: isLocked,
|
||||
milestone: milestone
|
||||
? {
|
||||
title: milestone
|
||||
}
|
||||
: undefined,
|
||||
assignees: assignees.map(
|
||||
(assignee: Readonly<string>): IAssignee => {
|
||||
return {
|
||||
login: assignee
|
||||
};
|
||||
}
|
||||
)
|
||||
});
|
||||
}
|
||||
2288
__tests__/main.spec.ts
Normal file
2288
__tests__/main.spec.ts
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,202 +0,0 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as github from '@actions/github';
|
||||
import {Octokit} from '@octokit/rest';
|
||||
|
||||
import {
|
||||
IssueProcessor,
|
||||
Issue,
|
||||
Label,
|
||||
IssueProcessorOptions
|
||||
} from '../src/IssueProcessor';
|
||||
|
||||
function generateIssue(
|
||||
id: number,
|
||||
title: string,
|
||||
updatedAt: string,
|
||||
isPullRequest: boolean = false,
|
||||
labels: string[] = []
|
||||
): Issue {
|
||||
return {
|
||||
number: id,
|
||||
labels: labels.map(l => {
|
||||
return {name: l};
|
||||
}),
|
||||
title: title,
|
||||
updated_at: updatedAt,
|
||||
pull_request: isPullRequest ? {} : null
|
||||
};
|
||||
}
|
||||
|
||||
const DefaultProcessorOptions: IssueProcessorOptions = {
|
||||
repoToken: 'none',
|
||||
staleIssueMessage: 'This issue is stale',
|
||||
stalePrMessage: 'This PR is stale',
|
||||
daysBeforeStale: 1,
|
||||
daysBeforeClose: 1,
|
||||
staleIssueLabel: 'Stale',
|
||||
exemptIssueLabels: '',
|
||||
stalePrLabel: 'Stale',
|
||||
exemptPrLabels: '',
|
||||
onlyLabels: '',
|
||||
operationsPerRun: 100,
|
||||
debugOnly: true
|
||||
};
|
||||
|
||||
test('empty issue list results in 1 operation', async () => {
|
||||
const processor = new IssueProcessor(DefaultProcessorOptions, async () => []);
|
||||
|
||||
// process our fake issue list
|
||||
const operationsLeft = await processor.processIssues(1);
|
||||
|
||||
// processing an empty issue list should result in 1 operation
|
||||
expect(operationsLeft).toEqual(99);
|
||||
});
|
||||
|
||||
test('processing an issue with no label will make it stale', async () => {
|
||||
const TestIssueList: Issue[] = [
|
||||
generateIssue(1, 'My first issue', '2020-01-01T17:00:00Z')
|
||||
];
|
||||
|
||||
const processor = new IssueProcessor(DefaultProcessorOptions, async p =>
|
||||
p == 1 ? TestIssueList : []
|
||||
);
|
||||
|
||||
// process our fake issue list
|
||||
await processor.processIssues(1);
|
||||
|
||||
expect(processor.staleIssues.length).toEqual(1);
|
||||
expect(processor.closedIssues.length).toEqual(0);
|
||||
});
|
||||
|
||||
test('processing a stale issue will close it', async () => {
|
||||
const TestIssueList: Issue[] = [
|
||||
generateIssue(1, 'My first issue', '2020-01-01T17:00:00Z', false, ['Stale'])
|
||||
];
|
||||
|
||||
const processor = new IssueProcessor(DefaultProcessorOptions, async p =>
|
||||
p == 1 ? TestIssueList : []
|
||||
);
|
||||
|
||||
// process our fake issue list
|
||||
await processor.processIssues(1);
|
||||
|
||||
expect(processor.staleIssues.length).toEqual(0);
|
||||
expect(processor.closedIssues.length).toEqual(1);
|
||||
});
|
||||
|
||||
test('processing a stale PR will close it', async () => {
|
||||
const TestIssueList: Issue[] = [
|
||||
generateIssue(1, 'My first PR', '2020-01-01T17:00:00Z', true, ['Stale'])
|
||||
];
|
||||
|
||||
const processor = new IssueProcessor(DefaultProcessorOptions, async p =>
|
||||
p == 1 ? TestIssueList : []
|
||||
);
|
||||
|
||||
// process our fake issue list
|
||||
await processor.processIssues(1);
|
||||
|
||||
expect(processor.staleIssues.length).toEqual(0);
|
||||
expect(processor.closedIssues.length).toEqual(1);
|
||||
});
|
||||
|
||||
test('exempt issue labels will not be marked stale', async () => {
|
||||
const TestIssueList: Issue[] = [
|
||||
generateIssue(1, 'My first issue', '2020-01-01T17:00:00Z', false, [
|
||||
'Exempt'
|
||||
])
|
||||
];
|
||||
|
||||
let opts = DefaultProcessorOptions;
|
||||
opts.exemptIssueLabels = 'Exempt';
|
||||
|
||||
const processor = new IssueProcessor(DefaultProcessorOptions, async p =>
|
||||
p == 1 ? TestIssueList : []
|
||||
);
|
||||
|
||||
// process our fake issue list
|
||||
await processor.processIssues(1);
|
||||
|
||||
expect(processor.staleIssues.length).toEqual(0);
|
||||
expect(processor.closedIssues.length).toEqual(0);
|
||||
});
|
||||
|
||||
test('exempt issue labels will not be marked stale (multi issue label with spaces)', async () => {
|
||||
const TestIssueList: Issue[] = [
|
||||
generateIssue(1, 'My first issue', '2020-01-01T17:00:00Z', false, ['Cool'])
|
||||
];
|
||||
|
||||
let opts = DefaultProcessorOptions;
|
||||
opts.exemptIssueLabels = 'Exempt, Cool, None';
|
||||
|
||||
const processor = new IssueProcessor(DefaultProcessorOptions, async p =>
|
||||
p == 1 ? TestIssueList : []
|
||||
);
|
||||
|
||||
// process our fake issue list
|
||||
await processor.processIssues(1);
|
||||
|
||||
expect(processor.staleIssues.length).toEqual(0);
|
||||
expect(processor.closedIssues.length).toEqual(0);
|
||||
});
|
||||
|
||||
test('exempt issue labels will not be marked stale (multi issue label)', async () => {
|
||||
const TestIssueList: Issue[] = [
|
||||
generateIssue(1, 'My first issue', '2020-01-01T17:00:00Z', false, ['Cool'])
|
||||
];
|
||||
|
||||
let opts = DefaultProcessorOptions;
|
||||
opts.exemptIssueLabels = 'Exempt,Cool,None';
|
||||
|
||||
const processor = new IssueProcessor(DefaultProcessorOptions, async p =>
|
||||
p == 1 ? TestIssueList : []
|
||||
);
|
||||
|
||||
// process our fake issue list
|
||||
await processor.processIssues(1);
|
||||
|
||||
expect(processor.staleIssues.length).toEqual(0);
|
||||
expect(processor.closedIssues.length).toEqual(0);
|
||||
});
|
||||
|
||||
test('exempt pr labels will not be marked stale', async () => {
|
||||
const TestIssueList: Issue[] = [
|
||||
generateIssue(1, 'My first issue', '2020-01-01T17:00:00Z', false, ['Cool']),
|
||||
generateIssue(2, 'My first PR', '2020-01-01T17:00:00Z', true, ['Cool']),
|
||||
generateIssue(3, 'Another issue', '2020-01-01T17:00:00Z', false)
|
||||
];
|
||||
|
||||
let opts = DefaultProcessorOptions;
|
||||
opts.exemptIssueLabels = 'Cool';
|
||||
|
||||
const processor = new IssueProcessor(DefaultProcessorOptions, async p =>
|
||||
p == 1 ? TestIssueList : []
|
||||
);
|
||||
|
||||
// process our fake issue list
|
||||
await processor.processIssues(1);
|
||||
|
||||
expect(processor.staleIssues.length).toEqual(2); // PR should get processed even though it has an exempt **issue** label
|
||||
});
|
||||
|
||||
test('stale issues should not be closed if days is set to -1', async () => {
|
||||
const TestIssueList: Issue[] = [
|
||||
generateIssue(1, 'My first issue', '2020-01-01T17:00:00Z', false, [
|
||||
'Stale'
|
||||
]),
|
||||
generateIssue(2, 'My first PR', '2020-01-01T17:00:00Z', true, ['Stale']),
|
||||
generateIssue(3, 'Another issue', '2020-01-01T17:00:00Z', false, ['Stale'])
|
||||
];
|
||||
|
||||
let opts = DefaultProcessorOptions;
|
||||
opts.daysBeforeClose = -1;
|
||||
|
||||
const processor = new IssueProcessor(DefaultProcessorOptions, async p =>
|
||||
p == 1 ? TestIssueList : []
|
||||
);
|
||||
|
||||
// process our fake issue list
|
||||
await processor.processIssues(1);
|
||||
|
||||
expect(processor.closedIssues.length).toEqual(0);
|
||||
});
|
||||
3412
__tests__/milestones.spec.ts
Normal file
3412
__tests__/milestones.spec.ts
Normal file
File diff suppressed because it is too large
Load Diff
1152
__tests__/only-labels.spec.ts
Normal file
1152
__tests__/only-labels.spec.ts
Normal file
File diff suppressed because it is too large
Load Diff
567
__tests__/remove-stale-when-updated.spec.ts
Normal file
567
__tests__/remove-stale-when-updated.spec.ts
Normal file
@@ -0,0 +1,567 @@
|
||||
import {Issue} from '../src/classes/issue';
|
||||
import {IIssue} from '../src/interfaces/issue';
|
||||
import {IIssuesProcessorOptions} from '../src/interfaces/issues-processor-options';
|
||||
import {ILabel} from '../src/interfaces/label';
|
||||
import {IssuesProcessorMock} from './classes/issues-processor-mock';
|
||||
import {DefaultProcessorOptions} from './constants/default-processor-options';
|
||||
import {generateIssue} from './functions/generate-issue';
|
||||
|
||||
let issuesProcessorBuilder: IssuesProcessorBuilder;
|
||||
let issuesProcessor: IssuesProcessorMock;
|
||||
|
||||
/**
|
||||
* @description
|
||||
* Assuming there is a comment on the issue
|
||||
*/
|
||||
describe('remove-stale-when-updated option', (): void => {
|
||||
beforeEach((): void => {
|
||||
issuesProcessorBuilder = new IssuesProcessorBuilder();
|
||||
});
|
||||
|
||||
describe('when the option "remove-stale-when-updated" is disabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
issuesProcessorBuilder.keepStaleWhenUpdated();
|
||||
});
|
||||
|
||||
test('should not remove the stale label on the issue', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.staleIssues([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
|
||||
test('should not remove the stale label on the pull request', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.stalePrs([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the option "remove-stale-when-updated" is enabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
issuesProcessorBuilder.removeStaleWhenUpdated();
|
||||
});
|
||||
|
||||
test('should remove the stale label on the issue', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.staleIssues([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(1);
|
||||
});
|
||||
|
||||
test('should remove the stale label on the pull request', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.stalePrs([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('remove-issue-stale-when-updated option', (): void => {
|
||||
beforeEach((): void => {
|
||||
issuesProcessorBuilder = new IssuesProcessorBuilder();
|
||||
});
|
||||
|
||||
describe('when the option "remove-stale-when-updated" is disabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
issuesProcessorBuilder.keepStaleWhenUpdated();
|
||||
});
|
||||
|
||||
describe('when the option "remove-issue-stale-when-updated" is unset', (): void => {
|
||||
beforeEach((): void => {
|
||||
issuesProcessorBuilder.unsetIssueStaleWhenUpdated();
|
||||
});
|
||||
|
||||
test('should not remove the stale label on the issue', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.staleIssues([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
|
||||
test('should not remove the stale label on the pull request', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.stalePrs([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the option "remove-issue-stale-when-updated" is disabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
issuesProcessorBuilder.keepIssueStaleWhenUpdated();
|
||||
});
|
||||
|
||||
test('should not remove the stale label on the issue', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.staleIssues([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
|
||||
test('should not remove the stale label on the pull request', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.stalePrs([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the option "remove-issue-stale-when-updated" is enabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
issuesProcessorBuilder.removeIssueStaleWhenUpdated();
|
||||
});
|
||||
|
||||
test('should remove the stale label on the issue', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.staleIssues([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(1);
|
||||
});
|
||||
|
||||
test('should not remove the stale label on the pull request', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.stalePrs([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the option "remove-stale-when-updated" is enabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
issuesProcessorBuilder.removeStaleWhenUpdated();
|
||||
});
|
||||
|
||||
describe('when the option "remove-issue-stale-when-updated" is unset', (): void => {
|
||||
beforeEach((): void => {
|
||||
issuesProcessorBuilder.unsetIssueStaleWhenUpdated();
|
||||
});
|
||||
|
||||
test('should remove the stale label on the issue', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.staleIssues([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(1);
|
||||
});
|
||||
|
||||
test('should remove the stale label on the pull request', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.stalePrs([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the option "remove-issue-stale-when-updated" is disabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
issuesProcessorBuilder.keepIssueStaleWhenUpdated();
|
||||
});
|
||||
|
||||
test('should not remove the stale label on the issue', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.staleIssues([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
|
||||
test('should remove the stale label on the pull request', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.stalePrs([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the option "remove-issue-stale-when-updated" is enabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
issuesProcessorBuilder.removeIssueStaleWhenUpdated();
|
||||
});
|
||||
|
||||
test('should remove the stale label on the issue', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.staleIssues([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(1);
|
||||
});
|
||||
|
||||
test('should remove the stale label on the pull request', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.stalePrs([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('remove-pr-stale-when-updated option', (): void => {
|
||||
beforeEach((): void => {
|
||||
issuesProcessorBuilder = new IssuesProcessorBuilder();
|
||||
});
|
||||
|
||||
describe('when the option "remove-stale-when-updated" is disabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
issuesProcessorBuilder.keepStaleWhenUpdated();
|
||||
});
|
||||
|
||||
describe('when the option "remove-pr-stale-when-updated" is unset', (): void => {
|
||||
beforeEach((): void => {
|
||||
issuesProcessorBuilder.unsetPrStaleWhenUpdated();
|
||||
});
|
||||
|
||||
test('should not remove the stale label on the issue', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.staleIssues([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
|
||||
test('should not remove the stale label on the pull request', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.stalePrs([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the option "remove-pr-stale-when-updated" is disabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
issuesProcessorBuilder.keepPrStaleWhenUpdated();
|
||||
});
|
||||
|
||||
test('should not remove the stale label on the issue', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.staleIssues([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
|
||||
test('should not remove the stale label on the pull request', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.stalePrs([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the option "remove-pr-stale-when-updated" is enabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
issuesProcessorBuilder.removePrStaleWhenUpdated();
|
||||
});
|
||||
|
||||
test('should not remove the stale label on the issue', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.staleIssues([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
|
||||
test('should remove the stale label on the pull request', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.stalePrs([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the option "remove-stale-when-updated" is enabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
issuesProcessorBuilder.removeStaleWhenUpdated();
|
||||
});
|
||||
|
||||
describe('when the option "remove-pr-stale-when-updated" is unset', (): void => {
|
||||
beforeEach((): void => {
|
||||
issuesProcessorBuilder.unsetPrStaleWhenUpdated();
|
||||
});
|
||||
|
||||
test('should remove the stale label on the issue', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.staleIssues([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(1);
|
||||
});
|
||||
|
||||
test('should remove the stale label on the pull request', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.stalePrs([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the option "remove-pr-stale-when-updated" is disabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
issuesProcessorBuilder.keepPrStaleWhenUpdated();
|
||||
});
|
||||
|
||||
test('should remove the stale label on the issue', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.staleIssues([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(1);
|
||||
});
|
||||
|
||||
test('should not remove the stale label on the pull request', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.stalePrs([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the option "remove-pr-stale-when-updated" is enabled', (): void => {
|
||||
beforeEach((): void => {
|
||||
issuesProcessorBuilder.removePrStaleWhenUpdated();
|
||||
});
|
||||
|
||||
test('should remove the stale label on the issue', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.staleIssues([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(1);
|
||||
});
|
||||
|
||||
test('should remove the stale label on the pull request', async (): Promise<void> => {
|
||||
expect.assertions(1);
|
||||
issuesProcessor = issuesProcessorBuilder.stalePrs([{}]).build();
|
||||
|
||||
await issuesProcessor.processIssues();
|
||||
|
||||
expect(issuesProcessor.removedLabelIssues).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
class IssuesProcessorBuilder {
|
||||
private _options: IIssuesProcessorOptions = {
|
||||
...DefaultProcessorOptions
|
||||
};
|
||||
private _issues: Issue[] = [];
|
||||
|
||||
keepStaleWhenUpdated(): IssuesProcessorBuilder {
|
||||
this._options.removeStaleWhenUpdated = false;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
removeStaleWhenUpdated(): IssuesProcessorBuilder {
|
||||
this._options.removeStaleWhenUpdated = true;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
unsetIssueStaleWhenUpdated(): IssuesProcessorBuilder {
|
||||
delete this._options.removeIssueStaleWhenUpdated;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
keepIssueStaleWhenUpdated(): IssuesProcessorBuilder {
|
||||
this._options.removeIssueStaleWhenUpdated = false;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
removeIssueStaleWhenUpdated(): IssuesProcessorBuilder {
|
||||
this._options.removeIssueStaleWhenUpdated = true;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
unsetPrStaleWhenUpdated(): IssuesProcessorBuilder {
|
||||
delete this._options.removePrStaleWhenUpdated;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
keepPrStaleWhenUpdated(): IssuesProcessorBuilder {
|
||||
this._options.removePrStaleWhenUpdated = false;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
removePrStaleWhenUpdated(): IssuesProcessorBuilder {
|
||||
this._options.removePrStaleWhenUpdated = true;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
issuesOrPrs(issues: Partial<IIssue>[]): IssuesProcessorBuilder {
|
||||
this._issues = issues.map(
|
||||
(issue: Readonly<Partial<IIssue>>, index: Readonly<number>): Issue =>
|
||||
generateIssue(
|
||||
this._options,
|
||||
index,
|
||||
issue.title ?? 'dummy-title',
|
||||
issue.updated_at ?? new Date().toDateString(),
|
||||
issue.created_at ?? new Date().toDateString(),
|
||||
!!issue.pull_request,
|
||||
issue.labels ? issue.labels.map(label => label.name) : []
|
||||
)
|
||||
);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
issues(issues: Partial<IIssue>[]): IssuesProcessorBuilder {
|
||||
this.issuesOrPrs(
|
||||
issues.map(
|
||||
(issue: Readonly<Partial<IIssue>>): Partial<IIssue> => {
|
||||
return {
|
||||
...issue,
|
||||
pull_request: null
|
||||
};
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
staleIssues(issues: Partial<IIssue>[]): IssuesProcessorBuilder {
|
||||
this.issues(
|
||||
issues.map(
|
||||
(issue: Readonly<Partial<IIssue>>): Partial<IIssue> => {
|
||||
return {
|
||||
...issue,
|
||||
updated_at: '2020-01-01T17:00:00Z',
|
||||
created_at: '2020-01-01T17:00:00Z',
|
||||
labels: issue.labels?.map(
|
||||
(label: Readonly<ILabel>): ILabel => {
|
||||
return {
|
||||
...label,
|
||||
name: 'Stale'
|
||||
};
|
||||
}
|
||||
) ?? [
|
||||
{
|
||||
name: 'Stale'
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
prs(issues: Partial<IIssue>[]): IssuesProcessorBuilder {
|
||||
this.issuesOrPrs(
|
||||
issues.map(
|
||||
(issue: Readonly<Partial<IIssue>>): Partial<IIssue> => {
|
||||
return {
|
||||
...issue,
|
||||
pull_request: {key: 'value'}
|
||||
};
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
stalePrs(issues: Partial<IIssue>[]): IssuesProcessorBuilder {
|
||||
this.prs(
|
||||
issues.map(
|
||||
(issue: Readonly<Partial<IIssue>>): Partial<IIssue> => {
|
||||
return {
|
||||
...issue,
|
||||
updated_at: '2020-01-01T17:00:00Z',
|
||||
created_at: '2020-01-01T17:00:00Z',
|
||||
labels: issue.labels?.map(
|
||||
(label: Readonly<ILabel>): ILabel => {
|
||||
return {
|
||||
...label,
|
||||
name: 'Stale'
|
||||
};
|
||||
}
|
||||
) ?? [
|
||||
{
|
||||
name: 'Stale'
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
build(): IssuesProcessorMock {
|
||||
return new IssuesProcessorMock(
|
||||
this._options,
|
||||
async () => 'abot',
|
||||
async p => (p === 1 ? this._issues : []),
|
||||
async () => [
|
||||
{
|
||||
user: {
|
||||
login: 'notme',
|
||||
type: 'User'
|
||||
}
|
||||
}
|
||||
],
|
||||
async () => new Date().toDateString()
|
||||
);
|
||||
}
|
||||
}
|
||||
164
action.yml
164
action.yml
@@ -4,38 +4,178 @@ author: 'GitHub'
|
||||
inputs:
|
||||
repo-token:
|
||||
description: 'Token for the repository. Can be passed in using `{{ secrets.GITHUB_TOKEN }}`.'
|
||||
required: true
|
||||
required: false
|
||||
default: ${{ github.token }}
|
||||
stale-issue-message:
|
||||
description: 'The message to post on the issue when tagging it. If none provided, will not mark issues stale.'
|
||||
required: false
|
||||
stale-pr-message:
|
||||
description: 'The message to post on the pr when tagging it. If none provided, will not mark pull requests stale.'
|
||||
description: 'The message to post on the pull request when tagging it. If none provided, will not mark pull requests stale.'
|
||||
required: false
|
||||
close-issue-message:
|
||||
description: 'The message to post on the issue when closing it. If none provided, will not comment when closing an issue.'
|
||||
required: false
|
||||
close-pr-message:
|
||||
description: 'The message to post on the pull request when closing it. If none provided, will not comment when closing a pull requests.'
|
||||
required: false
|
||||
days-before-stale:
|
||||
description: 'The number of days old an issue can be before marking it stale.'
|
||||
default: 60
|
||||
description: 'The number of days old an issue or a pull request can be before marking it stale. Set to -1 to never mark issues or pull requests as stale automatically.'
|
||||
required: false
|
||||
default: '60'
|
||||
days-before-issue-stale:
|
||||
description: 'The number of days old an issue can be before marking it stale. Set to -1 to never mark issues as stale automatically. Override "days-before-stale" option regarding only the issues.'
|
||||
required: false
|
||||
days-before-pr-stale:
|
||||
description: 'The number of days old a pull request can be before marking it stale. Set to -1 to never mark pull requests as stale automatically. Override "days-before-stale" option regarding only the pull requests.'
|
||||
required: false
|
||||
days-before-close:
|
||||
description: 'The number of days to wait to close an issue or pull request after it being marked stale. Set to -1 to never close stale issues.'
|
||||
default: 7
|
||||
description: 'The number of days to wait to close an issue or a pull request after it being marked stale. Set to -1 to never close stale issues or pull requests.'
|
||||
required: false
|
||||
default: '7'
|
||||
days-before-issue-close:
|
||||
description: 'The number of days to wait to close an issue after it being marked stale. Set to -1 to never close stale issues. Override "days-before-close" option regarding only the issues.'
|
||||
required: false
|
||||
days-before-pr-close:
|
||||
description: 'The number of days to wait to close a pull request after it being marked stale. Set to -1 to never close stale pull requests. Override "days-before-close" option regarding only the pull requests.'
|
||||
required: false
|
||||
stale-issue-label:
|
||||
description: 'The label to apply when an issue is stale.'
|
||||
required: false
|
||||
default: 'Stale'
|
||||
close-issue-label:
|
||||
description: 'The label to apply when an issue is closed.'
|
||||
required: false
|
||||
exempt-issue-labels:
|
||||
description: 'The labels to apply when an issue is exempt from being marked stale. Separate multiple labels with commas (eg. "label1,label2")'
|
||||
description: 'The labels that mean an issue is exempt from being marked stale. Separate multiple labels with commas (eg. "label1,label2").'
|
||||
default: ''
|
||||
required: false
|
||||
stale-pr-label:
|
||||
description: 'The label to apply when a pull request is stale.'
|
||||
default: 'Stale'
|
||||
required: false
|
||||
close-pr-label:
|
||||
description: 'The label to apply when a pull request is closed.'
|
||||
required: false
|
||||
exempt-pr-labels:
|
||||
description: 'The labels to apply when a pull request is exempt from being marked stale. Separate multiple labels with commas (eg. "label1,label2")'
|
||||
description: 'The labels that mean a pull request is exempt from being marked as stale. Separate multiple labels with commas (eg. "label1,label2").'
|
||||
default: ''
|
||||
required: false
|
||||
exempt-milestones:
|
||||
description: 'The milestones that mean an issue or a pull request is exempt from being marked as stale. Separate multiple milestones with commas (eg. "milestone1,milestone2").'
|
||||
default: ''
|
||||
required: false
|
||||
exempt-issue-milestones:
|
||||
description: 'The milestones that mean an issue is exempt from being marked as stale. Separate multiple milestones with commas (eg. "milestone1,milestone2"). Override "exempt-milestones" option regarding only the issues.'
|
||||
default: ''
|
||||
required: false
|
||||
exempt-pr-milestones:
|
||||
description: 'The milestones that mean a pull request is exempt from being marked as stale. Separate multiple milestones with commas (eg. "milestone1,milestone2"). Override "exempt-milestones" option regarding only the pull requests.'
|
||||
default: ''
|
||||
required: false
|
||||
exempt-all-milestones:
|
||||
description: 'Exempt all issues and pull requests with milestones from being marked as stale. Default to false.'
|
||||
default: 'false'
|
||||
required: false
|
||||
exempt-all-issue-milestones:
|
||||
description: 'Exempt all issues with milestones from being marked as stale. Override "exempt-all-milestones" option regarding only the issues.'
|
||||
default: ''
|
||||
required: false
|
||||
exempt-all-pr-milestones:
|
||||
description: 'Exempt all pull requests with milestones from being marked as stale. Override "exempt-all-milestones" option regarding only the pull requests.'
|
||||
default: ''
|
||||
required: false
|
||||
only-labels:
|
||||
description: 'Only issues or pull requests with all of these labels are checked if stale. Defaults to `[]` (disabled) and can be a comma-separated list of labels.'
|
||||
description: 'Only issues or pull requests with all of these labels are checked if stale. Defaults to `` (disabled) and can be a comma-separated list of labels.'
|
||||
default: ''
|
||||
required: false
|
||||
any-of-labels:
|
||||
description: 'Only issues or pull requests with at least one of these labels are checked if stale. Defaults to `` (disabled) and can be a comma-separated list of labels.'
|
||||
default: ''
|
||||
required: false
|
||||
any-of-issue-labels:
|
||||
description: 'Only issues with at least one of these labels are checked if stale. Defaults to `` (disabled) and can be a comma-separated list of labels. Override "any-of-labels" option regarding only the issues.'
|
||||
default: ''
|
||||
required: false
|
||||
any-of-pr-labels:
|
||||
description: 'Only pull requests with at least one of these labels are checked if stale. Defaults to `` (disabled) and can be a comma-separated list of labels. Override "any-of-labels" option regarding only the pull requests.'
|
||||
default: ''
|
||||
required: false
|
||||
only-issue-labels:
|
||||
description: 'Only issues with all of these labels are checked if stale. Defaults to `[]` (disabled) and can be a comma-separated list of labels. Override "only-labels" option regarding only the issues.'
|
||||
default: ''
|
||||
required: false
|
||||
only-pr-labels:
|
||||
description: 'Only pull requests with all of these labels are checked if stale. Defaults to `[]` (disabled) and can be a comma-separated list of labels. Override "only-labels" option regarding only the pull requests.'
|
||||
default: ''
|
||||
required: false
|
||||
operations-per-run:
|
||||
description: 'The maximum number of operations per run, used to control rate limiting.'
|
||||
default: 30
|
||||
description: 'The maximum number of operations per run, used to control rate limiting (GitHub API CRUD related).'
|
||||
default: '30'
|
||||
required: false
|
||||
remove-stale-when-updated:
|
||||
description: 'Remove stale labels from issues and pull requests when they are updated or commented on.'
|
||||
default: 'true'
|
||||
required: false
|
||||
remove-issue-stale-when-updated:
|
||||
description: 'Remove stale labels from issues when they are updated or commented on. Override "remove-stale-when-updated" option regarding only the issues.'
|
||||
default: 'true'
|
||||
required: false
|
||||
remove-pr-stale-when-updated:
|
||||
description: 'Remove stale labels from pull requests when they are updated or commented on. Override "remove-stale-when-updated" option regarding only the pull requests.'
|
||||
default: 'true'
|
||||
required: false
|
||||
debug-only:
|
||||
description: 'Run the processor in debug mode without actually performing any operations on live issues.'
|
||||
default: false
|
||||
default: 'false'
|
||||
required: false
|
||||
ascending:
|
||||
description: 'The order to get issues or pull requests. Defaults to false, which is descending.'
|
||||
default: 'false'
|
||||
required: false
|
||||
skip-stale-pr-message:
|
||||
description: 'Skip adding stale message when marking a pull request as stale.'
|
||||
default: 'false'
|
||||
required: false
|
||||
skip-stale-issue-message:
|
||||
description: 'Skip adding stale message when marking an issue as stale.'
|
||||
default: 'false'
|
||||
required: false
|
||||
delete-branch:
|
||||
description: 'Delete the git branch after closing a stale pull request.'
|
||||
default: 'false'
|
||||
required: false
|
||||
start-date:
|
||||
description: 'The date used to skip the stale action on issue/pull request created before it (ISO 8601 or RFC 2822).'
|
||||
default: ''
|
||||
required: false
|
||||
exempt-assignees:
|
||||
description: 'The assignees which exempt an issue or a pull request from being marked as stale. Separate multiple assignees with commas (eg. "user1,user2").'
|
||||
default: ''
|
||||
required: false
|
||||
exempt-issue-assignees:
|
||||
description: 'The assignees which exempt an issue from being marked as stale. Separate multiple assignees with commas (eg. "user1,user2"). Override "exempt-assignees" option regarding only the issues.'
|
||||
default: ''
|
||||
required: false
|
||||
exempt-pr-assignees:
|
||||
description: 'The assignees which exempt a pull request from being marked as stale. Separate multiple assignees with commas (eg. "user1,user2"). Override "exempt-assignees" option regarding only the pull requests.'
|
||||
default: ''
|
||||
required: false
|
||||
exempt-all-assignees:
|
||||
description: 'Exempt all issues and pull requests with assignees from being marked as stale. Default to false.'
|
||||
default: 'false'
|
||||
required: false
|
||||
exempt-all-issue-assignees:
|
||||
description: 'Exempt all issues with assignees from being marked as stale. Override "exempt-all-assignees" option regarding only the issues.'
|
||||
default: ''
|
||||
required: false
|
||||
exempt-all-pr-assignees:
|
||||
description: 'Exempt all pull requests with assignees from being marked as stale. Override "exempt-all-assignees" option regarding only the pull requests.'
|
||||
default: ''
|
||||
required: false
|
||||
enable-statistics:
|
||||
description: 'Display some statistics at the end regarding the stale workflow (only when the logs are enabled).'
|
||||
default: 'true'
|
||||
required: false
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'dist/index.js'
|
||||
|
||||
31232
dist/index.js
vendored
31232
dist/index.js
vendored
File diff suppressed because it is too large
Load Diff
@@ -2,10 +2,11 @@ module.exports = {
|
||||
clearMocks: true,
|
||||
moduleFileExtensions: ['js', 'ts'],
|
||||
testEnvironment: 'node',
|
||||
testMatch: ['**/*.test.ts'],
|
||||
testMatch: ['**/*.test.ts', '**/*.spec.ts'],
|
||||
testRunner: 'jest-circus/runner',
|
||||
transform: {
|
||||
'^.+\\.ts$': 'ts-jest'
|
||||
},
|
||||
verbose: true
|
||||
}
|
||||
verbose: true,
|
||||
setupFilesAfterEnv: [`./jest/test.ts`]
|
||||
};
|
||||
|
||||
11
jest/test.ts
Normal file
11
jest/test.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import chalk from 'chalk';
|
||||
|
||||
// Disabled the colors to:
|
||||
// - improve the performances
|
||||
// - avoid to mock chalk
|
||||
// - avoid to have failing tests when testing the logs due to the extra text the log message will contains
|
||||
//
|
||||
// Note:
|
||||
// If you need to debug the log colours you can remove this line temporarily
|
||||
// But some tests will fail
|
||||
chalk.level = 0;
|
||||
10058
package-lock.json
generated
10058
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
55
package.json
55
package.json
@@ -1,16 +1,21 @@
|
||||
{
|
||||
"name": "stale-action",
|
||||
"version": "2.0.0",
|
||||
"version": "4.0.1",
|
||||
"private": true,
|
||||
"description": "Marks old issues and PRs as stale",
|
||||
"main": "lib/main.js",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"format": "prettier --write **/*.ts",
|
||||
"format-check": "prettier --check **/*.ts",
|
||||
"build": "tsc --project tsconfig.app.json",
|
||||
"format": "prettier --write --ignore-unknown **/*.{md,json,yml,ts}",
|
||||
"format-check": "prettier --check --ignore-unknown **/*.{md,json,yml,ts}",
|
||||
"lint": "eslint src/**/*.ts",
|
||||
"lint:fix": "eslint src/**/*.ts --fix",
|
||||
"lint:all": "npm run format-check && npm run lint",
|
||||
"lint:all:fix": "npm run format && npm run lint:fix",
|
||||
"pack": "ncc build",
|
||||
"test": "jest",
|
||||
"test:only-errors": "jest --reporters jest-silent-reporter --silent",
|
||||
"test:watch": "jest --watch --notify --expand",
|
||||
"all": "npm run build && npm run format && npm run lint && npm run pack && npm test"
|
||||
},
|
||||
"repository": {
|
||||
@@ -25,25 +30,31 @@
|
||||
"author": "GitHub",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.3",
|
||||
"@actions/github": "^2.1.1",
|
||||
"@octokit/rest": "^16.43.1",
|
||||
"semver": "^6.1.1"
|
||||
"@actions/core": "file:../toolkit/packages/core",
|
||||
"@actions/github": "^4.0.0",
|
||||
"lodash.deburr": "^4.1.0",
|
||||
"semver": "^7.3.5",
|
||||
"standard-version": "^9.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/semver": "^6.0.0",
|
||||
"@types/jest": "^24.0.23",
|
||||
"@types/node": "^12.7.12",
|
||||
"@typescript-eslint/parser": "^2.8.0",
|
||||
"@zeit/ncc": "^0.20.5",
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-plugin-github": "^2.0.0",
|
||||
"eslint-plugin-jest": "^22.21.0",
|
||||
"jest": "^24.9.0",
|
||||
"jest-circus": "^24.9.0",
|
||||
"js-yaml": "^3.13.1",
|
||||
"prettier": "^1.19.1",
|
||||
"ts-jest": "^24.2.0",
|
||||
"typescript": "^3.6.4"
|
||||
"@types/jest": "^26.0.20",
|
||||
"@types/lodash.deburr": "^4.1.6",
|
||||
"@types/node": "^15.0.2",
|
||||
"@types/semver": "^7.3.5",
|
||||
"@typescript-eslint/eslint-plugin": "^4.16.1",
|
||||
"@typescript-eslint/parser": "^4.22.1",
|
||||
"@vercel/ncc": "^0.27.0",
|
||||
"chalk": "^4.1.0",
|
||||
"eslint": "^7.21.0",
|
||||
"eslint-plugin-github": "^4.1.2",
|
||||
"eslint-plugin-jest": "^24.3.6",
|
||||
"jest": "^26.6.3",
|
||||
"jest-circus": "^26.6.3",
|
||||
"jest-silent-reporter": "^0.4.0",
|
||||
"js-yaml": "^4.0.0",
|
||||
"prettier": "^2.2.1",
|
||||
"terminal-link": "^2.1.1",
|
||||
"ts-jest": "^26.5.3",
|
||||
"typescript": "^4.2.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,230 +0,0 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as github from '@actions/github';
|
||||
import {Octokit} from '@octokit/rest';
|
||||
|
||||
type OcotoKitIssueList = Octokit.Response<Octokit.IssuesListForRepoResponse>;
|
||||
|
||||
export interface Issue {
|
||||
title: string;
|
||||
number: number;
|
||||
updated_at: string;
|
||||
labels: Label[];
|
||||
pull_request: any;
|
||||
}
|
||||
|
||||
export interface Label {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface IssueProcessorOptions {
|
||||
repoToken: string;
|
||||
staleIssueMessage: string;
|
||||
stalePrMessage: string;
|
||||
daysBeforeStale: number;
|
||||
daysBeforeClose: number;
|
||||
staleIssueLabel: string;
|
||||
exemptIssueLabels: string;
|
||||
stalePrLabel: string;
|
||||
exemptPrLabels: string;
|
||||
onlyLabels: string;
|
||||
operationsPerRun: number;
|
||||
debugOnly: boolean;
|
||||
}
|
||||
|
||||
/***
|
||||
* Handle processing of issues for staleness/closure.
|
||||
*/
|
||||
export class IssueProcessor {
|
||||
readonly client: github.GitHub;
|
||||
readonly options: IssueProcessorOptions;
|
||||
private operationsLeft: number = 0;
|
||||
|
||||
readonly staleIssues: Issue[] = [];
|
||||
readonly closedIssues: Issue[] = [];
|
||||
|
||||
constructor(
|
||||
options: IssueProcessorOptions,
|
||||
getIssues?: (page: number) => Promise<Issue[]>
|
||||
) {
|
||||
this.options = options;
|
||||
this.operationsLeft = options.operationsPerRun;
|
||||
this.client = new github.GitHub(options.repoToken);
|
||||
|
||||
if (getIssues) {
|
||||
this.getIssues = getIssues;
|
||||
}
|
||||
|
||||
if (this.options.debugOnly) {
|
||||
core.warning(
|
||||
'Executing in debug mode. Debug output will be written but no issues will be processed.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async processIssues(page: number = 1): Promise<number> {
|
||||
if (this.operationsLeft <= 0) {
|
||||
core.warning('Reached max number of operations to process. Exiting.');
|
||||
return 0;
|
||||
}
|
||||
|
||||
// get the next batch of issues
|
||||
const issues: Issue[] = await this.getIssues(page);
|
||||
this.operationsLeft -= 1;
|
||||
|
||||
if (issues.length <= 0) {
|
||||
core.debug('No more issues found to process. Exiting.');
|
||||
return this.operationsLeft;
|
||||
}
|
||||
|
||||
for (const issue of issues.values()) {
|
||||
const isPr = !!issue.pull_request;
|
||||
|
||||
core.debug(
|
||||
`Found issue: issue #${issue.number} - ${issue.title} last updated ${issue.updated_at} (is pr? ${isPr})`
|
||||
);
|
||||
|
||||
// calculate string based messages for this issue
|
||||
const staleMessage: string = isPr
|
||||
? this.options.stalePrMessage
|
||||
: this.options.staleIssueMessage;
|
||||
const staleLabel: string = isPr
|
||||
? this.options.stalePrLabel
|
||||
: this.options.staleIssueLabel;
|
||||
const exemptLabels = IssueProcessor.parseCommaSeparatedString(
|
||||
isPr ? this.options.exemptPrLabels : this.options.exemptIssueLabels
|
||||
);
|
||||
const issueType: string = isPr ? 'pr' : 'issue';
|
||||
|
||||
if (!staleMessage) {
|
||||
core.debug(`Skipping ${issueType} due to empty stale message`);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
exemptLabels.some((exemptLabel: string) =>
|
||||
IssueProcessor.isLabeled(issue, exemptLabel)
|
||||
)
|
||||
) {
|
||||
core.debug(`Skipping ${issueType} because it has an exempt label`);
|
||||
continue; // don't process exempt issues
|
||||
}
|
||||
|
||||
if (IssueProcessor.isLabeled(issue, staleLabel)) {
|
||||
core.debug(`Found a stale ${issueType}`);
|
||||
if (
|
||||
this.options.daysBeforeClose >= 0 &&
|
||||
IssueProcessor.wasLastUpdatedBefore(
|
||||
issue,
|
||||
this.options.daysBeforeClose
|
||||
)
|
||||
) {
|
||||
core.debug(
|
||||
`Closing ${issueType} because it was last updated on ${issue.updated_at}`
|
||||
);
|
||||
await this.closeIssue(issue);
|
||||
this.operationsLeft -= 1;
|
||||
} else {
|
||||
core.debug(
|
||||
`Ignoring stale ${issueType} because it was updated recenlty`
|
||||
);
|
||||
}
|
||||
} else if (
|
||||
IssueProcessor.wasLastUpdatedBefore(issue, this.options.daysBeforeStale)
|
||||
) {
|
||||
core.debug(
|
||||
`Marking ${issueType} stale because it was last updated on ${issue.updated_at}`
|
||||
);
|
||||
await this.markStale(issue, staleMessage, staleLabel);
|
||||
this.operationsLeft -= 2;
|
||||
}
|
||||
}
|
||||
|
||||
// do the next batch
|
||||
return this.processIssues(page + 1);
|
||||
}
|
||||
|
||||
// grab issues from github in baches of 100
|
||||
private async getIssues(page: number): Promise<Issue[]> {
|
||||
const issueResult: OcotoKitIssueList = await this.client.issues.listForRepo(
|
||||
{
|
||||
owner: github.context.repo.owner,
|
||||
repo: github.context.repo.repo,
|
||||
state: 'open',
|
||||
labels: this.options.onlyLabels,
|
||||
per_page: 100,
|
||||
page
|
||||
}
|
||||
);
|
||||
|
||||
return issueResult.data;
|
||||
}
|
||||
|
||||
// Mark an issue as stale with a comment and a label
|
||||
private async markStale(
|
||||
issue: Issue,
|
||||
staleMessage: string,
|
||||
staleLabel: string
|
||||
): Promise<void> {
|
||||
core.debug(`Marking issue #${issue.number} - ${issue.title} as stale`);
|
||||
|
||||
this.staleIssues.push(issue);
|
||||
|
||||
if (this.options.debugOnly) {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.client.issues.createComment({
|
||||
owner: github.context.repo.owner,
|
||||
repo: github.context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
body: staleMessage
|
||||
});
|
||||
|
||||
await this.client.issues.addLabels({
|
||||
owner: github.context.repo.owner,
|
||||
repo: github.context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
labels: [staleLabel]
|
||||
});
|
||||
}
|
||||
|
||||
/// Close an issue based on staleness
|
||||
private async closeIssue(issue: Issue): Promise<void> {
|
||||
core.debug(
|
||||
`Closing issue #${issue.number} - ${issue.title} for being stale`
|
||||
);
|
||||
|
||||
this.closedIssues.push(issue);
|
||||
|
||||
if (this.options.debugOnly) {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.client.issues.update({
|
||||
owner: github.context.repo.owner,
|
||||
repo: github.context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
state: 'closed'
|
||||
});
|
||||
}
|
||||
|
||||
private static isLabeled(issue: Issue, label: string): boolean {
|
||||
const labelComparer: (l: Label) => boolean = l =>
|
||||
label.localeCompare(l.name, undefined, {sensitivity: 'accent'}) === 0;
|
||||
return issue.labels.filter(labelComparer).length > 0;
|
||||
}
|
||||
|
||||
private static wasLastUpdatedBefore(issue: Issue, num_days: number): boolean {
|
||||
const daysInMillis = 1000 * 60 * 60 * 24 * num_days;
|
||||
const millisSinceLastUpdated =
|
||||
new Date().getTime() - new Date(issue.updated_at).getTime();
|
||||
return millisSinceLastUpdated >= daysInMillis;
|
||||
}
|
||||
|
||||
private static parseCommaSeparatedString(s: string): string[] {
|
||||
// String.prototype.split defaults to [''] when called on an empty string
|
||||
// In this case, we'd prefer to just return an empty array indicating no labels
|
||||
if (!s.length) return [];
|
||||
return s.split(',').map(l => l.trim());
|
||||
}
|
||||
}
|
||||
849
src/classes/assignees.spec.ts
Normal file
849
src/classes/assignees.spec.ts
Normal file
@@ -0,0 +1,849 @@
|
||||
import {DefaultProcessorOptions} from '../../__tests__/constants/default-processor-options';
|
||||
import {generateIIssue} from '../../__tests__/functions/generate-iissue';
|
||||
import {IIssue} from '../interfaces/issue';
|
||||
import {IIssuesProcessorOptions} from '../interfaces/issues-processor-options';
|
||||
import {Assignees} from './assignees';
|
||||
import {Issue} from './issue';
|
||||
|
||||
describe('Assignees', (): void => {
|
||||
let assignees: Assignees;
|
||||
let optionsInterface: IIssuesProcessorOptions;
|
||||
let issue: Issue;
|
||||
let issueInterface: IIssue;
|
||||
|
||||
beforeEach((): void => {
|
||||
optionsInterface = {
|
||||
...DefaultProcessorOptions,
|
||||
exemptAllAssignees: false
|
||||
};
|
||||
issueInterface = generateIIssue();
|
||||
});
|
||||
|
||||
describe('shouldExemptAssignees()', (): void => {
|
||||
describe('when the given issue is not a pull request', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.pull_request = undefined;
|
||||
});
|
||||
|
||||
describe('when the given options are not configured to exempt an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptAssignees = '';
|
||||
});
|
||||
|
||||
describe('when the given options are not configured to exempt an issue with an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptIssueAssignees = '';
|
||||
});
|
||||
|
||||
describe('when the given issue does not have an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue does have an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-login'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are configured to exempt an issue with an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptIssueAssignees =
|
||||
'dummy-exempt-issue-assignee';
|
||||
});
|
||||
|
||||
describe('when the given issue does not have an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue does have an assignee different than the exempt issue assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-login'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue does have an assignee equaling the exempt issue assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-exempt-issue-assignee'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are configured to exempt an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptAssignees = 'dummy-exempt-assignee';
|
||||
});
|
||||
|
||||
describe('when the given options are not configured to exempt an issue with an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptIssueAssignees = '';
|
||||
});
|
||||
|
||||
describe('when the given issue does not have an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue does have an assignee different than the exempt assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-login'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue does have an assignee equaling the exempt assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-exempt-assignee'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are configured to exempt an issue with an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptIssueAssignees =
|
||||
'dummy-exempt-issue-assignee';
|
||||
});
|
||||
|
||||
describe('when the given issue does not have an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue does have an assignee different than the exempt issue assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-login'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue does have an assignee equaling the exempt issue assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-exempt-issue-assignee'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue does have an assignee different than the exempt assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-login'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue does have an assignee equaling the exempt assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-exempt-assignee'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are configured to exempt all assignees', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptAllAssignees = true;
|
||||
});
|
||||
|
||||
describe('when the given issue does not have an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue does have an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-exempt-assignee'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are not configured to exempt all issue assignees', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptAllIssueAssignees = false;
|
||||
});
|
||||
|
||||
describe('when the given issue does not have an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue does have an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-exempt-assignee'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are configured to exempt all issue assignees', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptAllIssueAssignees = true;
|
||||
});
|
||||
|
||||
describe('when the given issue does not have an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue does have an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-exempt-issue-assignee'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue is a pull request', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.pull_request = {};
|
||||
});
|
||||
|
||||
describe('when the given options are not configured to exempt an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptAssignees = '';
|
||||
});
|
||||
|
||||
describe('when the given options are not configured to exempt a pull request with an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptPrAssignees = '';
|
||||
});
|
||||
|
||||
describe('when the given pull request does not have an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given pull request does have an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-login'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are configured to exempt a pull request with an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptPrAssignees = 'dummy-exempt-pr-assignee';
|
||||
});
|
||||
|
||||
describe('when the given pull request does not have an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given pull request does have an assignee different than the exempt pull request assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-login'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given pull request does have an assignee equaling the exempt pull request assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-exempt-pr-assignee'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are configured to exempt an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptAssignees = 'dummy-exempt-assignee';
|
||||
});
|
||||
|
||||
describe('when the given options are not configured to exempt a pull request with an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptPrAssignees = '';
|
||||
});
|
||||
|
||||
describe('when the given pull request does not have an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given pull request does have an assignee different than the exempt assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-login'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given pull request does have an assignee equaling the exempt assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-exempt-assignee'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are configured to exempt a pull request with an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptPrAssignees = 'dummy-exempt-pr-assignee';
|
||||
});
|
||||
|
||||
describe('when the given pull request does not have an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given pull request does have an assignee different than the exempt pull request assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-login'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given pull request does have an assignee equaling the exempt pull request assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-exempt-pr-assignee'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given pull request does have an assignee different than the exempt assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-login'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given pull request does have an assignee equaling the exempt assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-exempt-assignee'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are configured to exempt all assignees', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptAllAssignees = true;
|
||||
});
|
||||
|
||||
describe('when the given pull request does not have an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given pull request does have an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-exempt-assignee'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are not configured to exempt all pull request assignees', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptAllPrAssignees = false;
|
||||
});
|
||||
|
||||
describe('when the given pull request does not have an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given pull request does have an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-exempt-assignee'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are configured to exempt all pull request assignees', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptAllPrAssignees = true;
|
||||
});
|
||||
|
||||
describe('when the given pull request does not have an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [];
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given pull request does have an assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-exempt-issue-assignee'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
assignees = new Assignees(optionsInterface, issue);
|
||||
|
||||
const result = assignees.shouldExemptAssignees();
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
287
src/classes/assignees.ts
Normal file
287
src/classes/assignees.ts
Normal file
@@ -0,0 +1,287 @@
|
||||
import chalk from 'chalk';
|
||||
import deburr from 'lodash.deburr';
|
||||
import {Option} from '../enums/option';
|
||||
import {wordsToList} from '../functions/words-to-list';
|
||||
import {IAssignee} from '../interfaces/assignee';
|
||||
import {IIssuesProcessorOptions} from '../interfaces/issues-processor-options';
|
||||
import {Issue} from './issue';
|
||||
import {IssueLogger} from './loggers/issue-logger';
|
||||
|
||||
type CleanAssignee = string;
|
||||
|
||||
export class Assignees {
|
||||
private static _cleanAssignee(assignee: Readonly<string>): CleanAssignee {
|
||||
return deburr(assignee.toLowerCase());
|
||||
}
|
||||
|
||||
private readonly _options: IIssuesProcessorOptions;
|
||||
private readonly _issue: Issue;
|
||||
private readonly _issueLogger: IssueLogger;
|
||||
|
||||
constructor(options: Readonly<IIssuesProcessorOptions>, issue: Issue) {
|
||||
this._options = options;
|
||||
this._issue = issue;
|
||||
this._issueLogger = new IssueLogger(issue);
|
||||
}
|
||||
|
||||
shouldExemptAssignees(): boolean {
|
||||
if (!this._issue.hasAssignees) {
|
||||
this._issueLogger.info('This $$type has no assignee');
|
||||
this._logSkip();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this._shouldExemptAllAssignees()) {
|
||||
this._issueLogger.info(
|
||||
chalk.white('└──'),
|
||||
'Skipping this $$type because it has an exempt assignee'
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const exemptAssignees: string[] = this._getExemptAssignees();
|
||||
|
||||
if (exemptAssignees.length === 0) {
|
||||
this._issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
`No assignee option was specified to skip the stale process for this $$type`
|
||||
);
|
||||
this._logSkip();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
this._issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
`Found ${chalk.cyan(exemptAssignees.length)} assignee${
|
||||
exemptAssignees.length > 1 ? 's' : ''
|
||||
} that can exempt stale on this $$type`
|
||||
);
|
||||
|
||||
const hasExemptAssignee: boolean = exemptAssignees.some(
|
||||
(exemptAssignee: Readonly<string>): boolean =>
|
||||
this._hasAssignee(exemptAssignee)
|
||||
);
|
||||
|
||||
if (!hasExemptAssignee) {
|
||||
this._issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
'No assignee on this $$type can exempt the stale process'
|
||||
);
|
||||
this._logSkip();
|
||||
} else {
|
||||
this._issueLogger.info(
|
||||
chalk.white('└──'),
|
||||
'Skipping this $$type because it has an exempt assignee'
|
||||
);
|
||||
}
|
||||
|
||||
return hasExemptAssignee;
|
||||
}
|
||||
|
||||
private _getExemptAssignees(): string[] {
|
||||
return this._issue.isPullRequest
|
||||
? this._getExemptPullRequestAssignees()
|
||||
: this._getExemptIssueAssignees();
|
||||
}
|
||||
|
||||
private _getExemptIssueAssignees(): string[] {
|
||||
if (this._options.exemptIssueAssignees === '') {
|
||||
this._issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptIssueAssignees
|
||||
)} is disabled. No specific assignee can skip the stale process for this $$type`
|
||||
);
|
||||
|
||||
if (this._options.exemptAssignees === '') {
|
||||
this._issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptAssignees
|
||||
)} is disabled. No specific assignee can skip the stale process for this $$type`
|
||||
);
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
const exemptAssignees: string[] = wordsToList(
|
||||
this._options.exemptAssignees
|
||||
);
|
||||
|
||||
this._issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptAssignees
|
||||
)} is set. ${chalk.cyan(exemptAssignees.length)} assignee${
|
||||
exemptAssignees.length === 1 ? '' : 's'
|
||||
} can skip the stale process for this $$type`
|
||||
);
|
||||
|
||||
return exemptAssignees;
|
||||
}
|
||||
|
||||
const exemptAssignees: string[] = wordsToList(
|
||||
this._options.exemptIssueAssignees
|
||||
);
|
||||
|
||||
this._issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptIssueAssignees
|
||||
)} is set. ${chalk.cyan(exemptAssignees.length)} assignee${
|
||||
exemptAssignees.length === 1 ? '' : 's'
|
||||
} can skip the stale process for this $$type`
|
||||
);
|
||||
|
||||
return exemptAssignees;
|
||||
}
|
||||
|
||||
private _getExemptPullRequestAssignees(): string[] {
|
||||
if (this._options.exemptPrAssignees === '') {
|
||||
this._issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptPrAssignees
|
||||
)} is disabled. No specific assignee can skip the stale process for this $$type`
|
||||
);
|
||||
|
||||
if (this._options.exemptAssignees === '') {
|
||||
this._issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptAssignees
|
||||
)} is disabled. No specific assignee can skip the stale process for this $$type`
|
||||
);
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
const exemptAssignees: string[] = wordsToList(
|
||||
this._options.exemptAssignees
|
||||
);
|
||||
|
||||
this._issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptAssignees
|
||||
)} is set. ${chalk.cyan(exemptAssignees.length)} assignee${
|
||||
exemptAssignees.length === 1 ? '' : 's'
|
||||
} can skip the stale process for this $$type`
|
||||
);
|
||||
|
||||
return exemptAssignees;
|
||||
}
|
||||
|
||||
const exemptAssignees: string[] = wordsToList(
|
||||
this._options.exemptPrAssignees
|
||||
);
|
||||
|
||||
this._issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptPrAssignees
|
||||
)} is set. ${chalk.cyan(exemptAssignees.length)} assignee${
|
||||
exemptAssignees.length === 1 ? '' : 's'
|
||||
} can skip the stale process for this $$type`
|
||||
);
|
||||
|
||||
return exemptAssignees;
|
||||
}
|
||||
|
||||
private _hasAssignee(assignee: Readonly<string>): boolean {
|
||||
const cleanAssignee: CleanAssignee = Assignees._cleanAssignee(assignee);
|
||||
|
||||
return this._issue.assignees.some(
|
||||
(issueAssignee: Readonly<IAssignee>): boolean => {
|
||||
const isSameAssignee: boolean =
|
||||
cleanAssignee === Assignees._cleanAssignee(issueAssignee.login);
|
||||
|
||||
if (isSameAssignee) {
|
||||
this._issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
`@${issueAssignee.login} is assigned on this $$type and is an exempt assignee`
|
||||
);
|
||||
}
|
||||
|
||||
return isSameAssignee;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private _shouldExemptAllAssignees(): boolean {
|
||||
return this._issue.isPullRequest
|
||||
? this._shouldExemptAllPullRequestAssignees()
|
||||
: this._shouldExemptAllIssueAssignees();
|
||||
}
|
||||
|
||||
private _shouldExemptAllIssueAssignees(): boolean {
|
||||
if (this._options.exemptAllIssueAssignees === true) {
|
||||
this._issueLogger.info(
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptAllIssueAssignees
|
||||
)} is enabled. Any assignee on this $$type will skip the stale process`
|
||||
);
|
||||
|
||||
return true;
|
||||
} else if (this._options.exemptAllIssueAssignees === false) {
|
||||
this._issueLogger.info(
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptAllIssueAssignees
|
||||
)} is disabled. Only some specific assignees on this $$type will skip the stale process`
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
this._logExemptAllAssigneesOption();
|
||||
|
||||
return this._options.exemptAllAssignees;
|
||||
}
|
||||
|
||||
private _shouldExemptAllPullRequestAssignees(): boolean {
|
||||
if (this._options.exemptAllPrAssignees === true) {
|
||||
this._issueLogger.info(
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptAllPrAssignees
|
||||
)} is enabled. Any assignee on this $$type will skip the stale process`
|
||||
);
|
||||
|
||||
return true;
|
||||
} else if (this._options.exemptAllPrAssignees === false) {
|
||||
this._issueLogger.info(
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptAllPrAssignees
|
||||
)} is disabled. Only some specific assignees on this $$type will skip the stale process`
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
this._logExemptAllAssigneesOption();
|
||||
|
||||
return this._options.exemptAllAssignees;
|
||||
}
|
||||
|
||||
private _logExemptAllAssigneesOption(): void {
|
||||
if (this._options.exemptAllAssignees) {
|
||||
this._issueLogger.info(
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptAllAssignees
|
||||
)} is enabled. Any assignee on this $$type will skip the stale process`
|
||||
);
|
||||
} else {
|
||||
this._issueLogger.info(
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptAllAssignees
|
||||
)} is disabled. Only some specific assignees on this $$type will skip the stale process`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private _logSkip(): void {
|
||||
this._issueLogger.info(chalk.white('└──'), 'Skip the assignees checks');
|
||||
}
|
||||
}
|
||||
290
src/classes/issue.spec.ts
Normal file
290
src/classes/issue.spec.ts
Normal file
@@ -0,0 +1,290 @@
|
||||
import {IAssignee} from '../interfaces/assignee';
|
||||
import {IIssue} from '../interfaces/issue';
|
||||
import {IIssuesProcessorOptions} from '../interfaces/issues-processor-options';
|
||||
import {ILabel} from '../interfaces/label';
|
||||
import {IMilestone} from '../interfaces/milestone';
|
||||
import {Issue} from './issue';
|
||||
|
||||
describe('Issue', (): void => {
|
||||
let issue: Issue;
|
||||
let optionsInterface: IIssuesProcessorOptions;
|
||||
let issueInterface: IIssue;
|
||||
|
||||
beforeEach((): void => {
|
||||
optionsInterface = {
|
||||
ascending: false,
|
||||
closeIssueLabel: '',
|
||||
closeIssueMessage: '',
|
||||
closePrLabel: '',
|
||||
closePrMessage: '',
|
||||
daysBeforeClose: 0,
|
||||
daysBeforeIssueClose: 0,
|
||||
daysBeforeIssueStale: 0,
|
||||
daysBeforePrClose: 0,
|
||||
daysBeforePrStale: 0,
|
||||
daysBeforeStale: 0,
|
||||
debugOnly: false,
|
||||
deleteBranch: false,
|
||||
exemptIssueLabels: '',
|
||||
exemptPrLabels: '',
|
||||
onlyLabels: '',
|
||||
onlyIssueLabels: '',
|
||||
onlyPrLabels: '',
|
||||
anyOfLabels: '',
|
||||
anyOfIssueLabels: '',
|
||||
anyOfPrLabels: '',
|
||||
operationsPerRun: 0,
|
||||
removeStaleWhenUpdated: false,
|
||||
removeIssueStaleWhenUpdated: undefined,
|
||||
removePrStaleWhenUpdated: undefined,
|
||||
repoToken: '',
|
||||
skipStaleIssueMessage: false,
|
||||
skipStalePrMessage: false,
|
||||
staleIssueMessage: '',
|
||||
stalePrMessage: '',
|
||||
startDate: undefined,
|
||||
stalePrLabel: 'dummy-stale-pr-label',
|
||||
staleIssueLabel: 'dummy-stale-issue-label',
|
||||
exemptMilestones: '',
|
||||
exemptIssueMilestones: '',
|
||||
exemptPrMilestones: '',
|
||||
exemptAllMilestones: false,
|
||||
exemptAllIssueMilestones: undefined,
|
||||
exemptAllPrMilestones: undefined,
|
||||
exemptAssignees: '',
|
||||
exemptIssueAssignees: '',
|
||||
exemptPrAssignees: '',
|
||||
exemptAllAssignees: false,
|
||||
exemptAllIssueAssignees: undefined,
|
||||
exemptAllPrAssignees: undefined,
|
||||
enableStatistics: false
|
||||
};
|
||||
issueInterface = {
|
||||
title: 'dummy-title',
|
||||
number: 8,
|
||||
created_at: 'dummy-created-at',
|
||||
updated_at: 'dummy-updated-at',
|
||||
labels: [
|
||||
{
|
||||
name: 'dummy-name'
|
||||
}
|
||||
],
|
||||
pull_request: {},
|
||||
state: 'dummy-state',
|
||||
locked: false,
|
||||
milestone: {
|
||||
title: 'dummy-milestone'
|
||||
},
|
||||
assignees: [
|
||||
{
|
||||
login: 'dummy-login'
|
||||
}
|
||||
]
|
||||
};
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
});
|
||||
|
||||
describe('constructor()', (): void => {
|
||||
it('should set the title with the given issue title', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
expect(issue.title).toStrictEqual('dummy-title');
|
||||
});
|
||||
|
||||
it('should set the number with the given issue number', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
expect(issue.number).toStrictEqual(8);
|
||||
});
|
||||
|
||||
it('should set the created_at with the given issue created_at', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
expect(issue.created_at).toStrictEqual('dummy-created-at');
|
||||
});
|
||||
|
||||
it('should set the updated_at with the given issue updated_at', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
expect(issue.updated_at).toStrictEqual('dummy-updated-at');
|
||||
});
|
||||
|
||||
it('should set the labels with the given issue labels', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
expect(issue.labels).toStrictEqual([
|
||||
{
|
||||
name: 'dummy-name'
|
||||
} as ILabel
|
||||
]);
|
||||
});
|
||||
|
||||
it('should set the pull_request with the given issue pull_request', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
expect(issue.pull_request).toStrictEqual({});
|
||||
});
|
||||
|
||||
it('should set the state with the given issue state', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
expect(issue.state).toStrictEqual('dummy-state');
|
||||
});
|
||||
|
||||
it('should set the locked with the given issue locked', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
expect(issue.locked).toStrictEqual(false);
|
||||
});
|
||||
|
||||
it('should set the milestone with the given issue milestone', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
expect(issue.milestone).toStrictEqual({
|
||||
title: 'dummy-milestone'
|
||||
} as IMilestone);
|
||||
});
|
||||
|
||||
it('should set the assignees with the given issue assignees', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
expect(issue.assignees).toStrictEqual([
|
||||
{
|
||||
login: 'dummy-login'
|
||||
} as IAssignee
|
||||
]);
|
||||
});
|
||||
|
||||
describe('when the given issue does not contains the stale label', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.pull_request = undefined;
|
||||
issueInterface.labels = [];
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
});
|
||||
|
||||
it('should set the isStale to false', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
expect(issue.isStale).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue contains the stale label', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.pull_request = undefined;
|
||||
issueInterface.labels = [
|
||||
{
|
||||
name: 'dummy-stale-issue-label'
|
||||
} as ILabel
|
||||
];
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
});
|
||||
|
||||
it('should set the isStale to true', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
expect(issue.isStale).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('get isPullRequest', (): void => {
|
||||
describe('when the issue pull_request is not set', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.pull_request = undefined;
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = issue.isPullRequest;
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the issue pull_request is set', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.pull_request = {};
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = issue.isPullRequest;
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('get staleLabel', (): void => {
|
||||
describe('when the issue is not a pull request', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.pull_request = undefined;
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
});
|
||||
|
||||
it('should return the issue stale label', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = issue.staleLabel;
|
||||
|
||||
expect(result).toStrictEqual('dummy-stale-issue-label');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue is a pull request', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.pull_request = {};
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
});
|
||||
|
||||
it('should return the pull request stale label', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = issue.staleLabel;
|
||||
|
||||
expect(result).toStrictEqual('dummy-stale-pr-label');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('get hasAssignees', (): void => {
|
||||
describe('when the issue has no assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [];
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = issue.hasAssignees;
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the issue has at least one assignee', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.assignees = [
|
||||
{
|
||||
login: 'dummy-login'
|
||||
}
|
||||
];
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = issue.hasAssignees;
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
62
src/classes/issue.ts
Normal file
62
src/classes/issue.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import {isLabeled} from '../functions/is-labeled';
|
||||
import {isPullRequest} from '../functions/is-pull-request';
|
||||
import {IAssignee} from '../interfaces/assignee';
|
||||
import {IIssue} from '../interfaces/issue';
|
||||
import {IIssuesProcessorOptions} from '../interfaces/issues-processor-options';
|
||||
import {ILabel} from '../interfaces/label';
|
||||
import {IMilestone} from '../interfaces/milestone';
|
||||
import {IsoDateString} from '../types/iso-date-string';
|
||||
import {Operations} from './operations';
|
||||
|
||||
export class Issue implements IIssue {
|
||||
private readonly _options: IIssuesProcessorOptions;
|
||||
readonly title: string;
|
||||
readonly number: number;
|
||||
created_at: IsoDateString;
|
||||
updated_at: IsoDateString;
|
||||
readonly labels: ILabel[];
|
||||
readonly pull_request: Object | null | undefined;
|
||||
readonly state: string | 'closed' | 'open';
|
||||
readonly locked: boolean;
|
||||
readonly milestone: IMilestone | undefined;
|
||||
readonly assignees: IAssignee[];
|
||||
isStale: boolean;
|
||||
operations = new Operations();
|
||||
|
||||
get isPullRequest(): boolean {
|
||||
return isPullRequest(this);
|
||||
}
|
||||
|
||||
get staleLabel(): string {
|
||||
return this._getStaleLabel();
|
||||
}
|
||||
|
||||
get hasAssignees(): boolean {
|
||||
return this.assignees.length > 0;
|
||||
}
|
||||
|
||||
constructor(
|
||||
options: Readonly<IIssuesProcessorOptions>,
|
||||
issue: Readonly<IIssue>
|
||||
) {
|
||||
this._options = options;
|
||||
this.title = issue.title;
|
||||
this.number = issue.number;
|
||||
this.created_at = issue.created_at;
|
||||
this.updated_at = issue.updated_at;
|
||||
this.labels = issue.labels;
|
||||
this.pull_request = issue.pull_request;
|
||||
this.state = issue.state;
|
||||
this.locked = issue.locked;
|
||||
this.milestone = issue.milestone;
|
||||
this.assignees = issue.assignees;
|
||||
|
||||
this.isStale = isLabeled(this, this.staleLabel);
|
||||
}
|
||||
|
||||
private _getStaleLabel(): string {
|
||||
return this.isPullRequest
|
||||
? this._options.stalePrLabel
|
||||
: this._options.staleIssueLabel;
|
||||
}
|
||||
}
|
||||
987
src/classes/issues-processor.ts
Normal file
987
src/classes/issues-processor.ts
Normal file
@@ -0,0 +1,987 @@
|
||||
import * as core from '@actions/core';
|
||||
import {context, getOctokit} from '@actions/github';
|
||||
import {GitHub} from '@actions/github/lib/utils';
|
||||
import {GetResponseTypeFromEndpointMethod} from '@octokit/types';
|
||||
import chalk from 'chalk';
|
||||
import {Option} from '../enums/option';
|
||||
import {getHumanizedDate} from '../functions/dates/get-humanized-date';
|
||||
import {isDateMoreRecentThan} from '../functions/dates/is-date-more-recent-than';
|
||||
import {isValidDate} from '../functions/dates/is-valid-date';
|
||||
import {isBoolean} from '../functions/is-boolean';
|
||||
import {isLabeled} from '../functions/is-labeled';
|
||||
import {shouldMarkWhenStale} from '../functions/should-mark-when-stale';
|
||||
import {wordsToList} from '../functions/words-to-list';
|
||||
import {IComment} from '../interfaces/comment';
|
||||
import {IIssue} from '../interfaces/issue';
|
||||
import {IIssueEvent} from '../interfaces/issue-event';
|
||||
import {IIssuesProcessorOptions} from '../interfaces/issues-processor-options';
|
||||
import {IPullRequest} from '../interfaces/pull-request';
|
||||
import {Assignees} from './assignees';
|
||||
import {Issue} from './issue';
|
||||
import {IssueLogger} from './loggers/issue-logger';
|
||||
import {Logger} from './loggers/logger';
|
||||
import {Milestones} from './milestones';
|
||||
import {StaleOperations} from './stale-operations';
|
||||
import {Statistics} from './statistics';
|
||||
|
||||
/***
|
||||
* Handle processing of issues for staleness/closure.
|
||||
*/
|
||||
export class IssuesProcessor {
|
||||
private static _updatedSince(timestamp: string, num_days: number): boolean {
|
||||
const daysInMillis = 1000 * 60 * 60 * 24 * num_days;
|
||||
const millisSinceLastUpdated =
|
||||
new Date().getTime() - new Date(timestamp).getTime();
|
||||
|
||||
return millisSinceLastUpdated <= daysInMillis;
|
||||
}
|
||||
|
||||
private static _endIssueProcessing(issue: Issue): void {
|
||||
const consumedOperationsCount: number = issue.operations.getConsumedOperationsCount();
|
||||
|
||||
if (consumedOperationsCount > 0) {
|
||||
const issueLogger: IssueLogger = new IssueLogger(issue);
|
||||
|
||||
issueLogger.info(
|
||||
chalk.cyan(consumedOperationsCount),
|
||||
`operation${
|
||||
consumedOperationsCount > 1 ? 's' : ''
|
||||
} consumed for this $$type`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private static _getStaleMessageUsedOptionName(
|
||||
issue: Readonly<Issue>
|
||||
): Option.StalePrMessage | Option.StaleIssueMessage {
|
||||
return issue.isPullRequest
|
||||
? Option.StalePrMessage
|
||||
: Option.StaleIssueMessage;
|
||||
}
|
||||
|
||||
private readonly _logger: Logger = new Logger();
|
||||
private readonly _operations: StaleOperations;
|
||||
private readonly _statistics: Statistics | undefined;
|
||||
readonly client: InstanceType<typeof GitHub>;
|
||||
readonly options: IIssuesProcessorOptions;
|
||||
readonly staleIssues: Issue[] = [];
|
||||
readonly closedIssues: Issue[] = [];
|
||||
readonly deletedBranchIssues: Issue[] = [];
|
||||
readonly removedLabelIssues: Issue[] = [];
|
||||
|
||||
constructor(options: IIssuesProcessorOptions) {
|
||||
this.options = options;
|
||||
this.client = getOctokit(this.options.repoToken);
|
||||
this._operations = new StaleOperations(this.options);
|
||||
|
||||
this._logger.info(chalk.yellow('Starting the stale action process...'));
|
||||
|
||||
if (this.options.debugOnly) {
|
||||
this._logger.warning(chalk.yellowBright('Executing in debug mode!'));
|
||||
this._logger.warning(
|
||||
chalk.yellowBright(
|
||||
'The debug output will be written but no issues/PRs will be processed.'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (this.options.enableStatistics) {
|
||||
this._statistics = new Statistics();
|
||||
}
|
||||
}
|
||||
|
||||
async processIssues(page: Readonly<number> = 1): Promise<number> {
|
||||
// get the next batch of issues
|
||||
const issues: Issue[] = await this.getIssues(page);
|
||||
const actor: string = await this.getActor();
|
||||
|
||||
if (issues.length <= 0) {
|
||||
this._logger.info(
|
||||
chalk.green('No more issues found to process. Exiting...')
|
||||
);
|
||||
this._statistics
|
||||
?.setRemainingOperations(this._operations.getRemainingOperationsCount())
|
||||
.logStats();
|
||||
|
||||
return this._operations.getRemainingOperationsCount();
|
||||
} else {
|
||||
this._logger.info(
|
||||
chalk.yellow(
|
||||
`Processing the batch of issues ${chalk.cyan(
|
||||
`#${page}`
|
||||
)} containing ${chalk.cyan(issues.length)} issue${
|
||||
issues.length > 1 ? 's' : ''
|
||||
}...`
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
for (const issue of issues.values()) {
|
||||
const issueLogger: IssueLogger = new IssueLogger(issue);
|
||||
this._statistics?.incrementProcessedItemsCount(issue);
|
||||
|
||||
issueLogger.info(
|
||||
`Found this $$type last updated at: ${chalk.cyan(issue.updated_at)}`
|
||||
);
|
||||
|
||||
// calculate string based messages for this issue
|
||||
const staleMessage: string = issue.isPullRequest
|
||||
? this.options.stalePrMessage
|
||||
: this.options.staleIssueMessage;
|
||||
const closeMessage: string = issue.isPullRequest
|
||||
? this.options.closePrMessage
|
||||
: this.options.closeIssueMessage;
|
||||
const staleLabel: string = issue.isPullRequest
|
||||
? this.options.stalePrLabel
|
||||
: this.options.staleIssueLabel;
|
||||
const closeLabel: string = issue.isPullRequest
|
||||
? this.options.closePrLabel
|
||||
: this.options.closeIssueLabel;
|
||||
const skipMessage = issue.isPullRequest
|
||||
? this.options.skipStalePrMessage
|
||||
: this.options.skipStaleIssueMessage;
|
||||
const daysBeforeStale: number = issue.isPullRequest
|
||||
? this._getDaysBeforePrStale()
|
||||
: this._getDaysBeforeIssueStale();
|
||||
const onlyLabels: string[] = wordsToList(this._getOnlyLabels(issue));
|
||||
|
||||
if (onlyLabels.length > 0) {
|
||||
issueLogger.info(
|
||||
`The option ${issueLogger.createOptionLink(
|
||||
Option.OnlyLabels
|
||||
)} was specified to only process issues and pull requests with all those labels (${chalk.cyan(
|
||||
onlyLabels.length
|
||||
)})`
|
||||
);
|
||||
|
||||
const hasAllWhitelistedLabels: boolean = onlyLabels.every(
|
||||
(label: Readonly<string>): boolean => {
|
||||
return isLabeled(issue, label);
|
||||
}
|
||||
);
|
||||
|
||||
if (!hasAllWhitelistedLabels) {
|
||||
issueLogger.info(
|
||||
chalk.white('└──'),
|
||||
`Skipping this $$type because it doesn't have all the required labels`
|
||||
);
|
||||
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue; // Don't process issues without all of the required labels
|
||||
} else {
|
||||
issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
`All the required labels are present on this $$type`
|
||||
);
|
||||
issueLogger.info(
|
||||
chalk.white('└──'),
|
||||
`Continuing the process for this $$type`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
issueLogger.info(
|
||||
`The option ${issueLogger.createOptionLink(
|
||||
Option.OnlyLabels
|
||||
)} was not specified`
|
||||
);
|
||||
issueLogger.info(
|
||||
chalk.white('└──'),
|
||||
`Continuing the process for this $$type`
|
||||
);
|
||||
}
|
||||
|
||||
issueLogger.info(
|
||||
`Days before $$type stale: ${chalk.cyan(daysBeforeStale)}`
|
||||
);
|
||||
|
||||
const shouldMarkAsStale: boolean = shouldMarkWhenStale(daysBeforeStale);
|
||||
|
||||
if (!staleMessage && shouldMarkAsStale) {
|
||||
issueLogger.info(
|
||||
`Skipping this $$type because it should be marked as stale based on the option ${issueLogger.createOptionLink(
|
||||
this._getDaysBeforeStaleUsedOptionName(issue)
|
||||
)} (${chalk.cyan(
|
||||
daysBeforeStale
|
||||
)}) but the option ${issueLogger.createOptionLink(
|
||||
IssuesProcessor._getStaleMessageUsedOptionName(issue)
|
||||
)} is not set`
|
||||
);
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (issue.state === 'closed') {
|
||||
issueLogger.info(`Skipping this $$type because it is closed`);
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue; // Don't process closed issues
|
||||
}
|
||||
|
||||
if (issue.locked) {
|
||||
issueLogger.info(`Skipping this $$type because it is locked`);
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue; // Don't process locked issues
|
||||
}
|
||||
|
||||
// Try to remove the close label when not close/locked issue or PR
|
||||
await this._removeCloseLabel(issue, closeLabel);
|
||||
|
||||
if (this.options.startDate) {
|
||||
const startDate: Date = new Date(this.options.startDate);
|
||||
const createdAt: Date = new Date(issue.created_at);
|
||||
|
||||
issueLogger.info(
|
||||
`A start date was specified for the ${getHumanizedDate(
|
||||
startDate
|
||||
)} (${chalk.cyan(this.options.startDate)})`
|
||||
);
|
||||
|
||||
// Expecting that GitHub will always set a creation date on the issues and PRs
|
||||
// But you never know!
|
||||
if (!isValidDate(createdAt)) {
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
core.setFailed(
|
||||
new Error(
|
||||
`Invalid issue field: "created_at". Expected a valid date`
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
issueLogger.info(
|
||||
`$$type created the ${getHumanizedDate(createdAt)} (${chalk.cyan(
|
||||
issue.created_at
|
||||
)})`
|
||||
);
|
||||
|
||||
if (!isDateMoreRecentThan(createdAt, startDate)) {
|
||||
issueLogger.info(
|
||||
`Skipping this $$type because it was created before the specified start date`
|
||||
);
|
||||
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue; // Don't process issues which were created before the start date
|
||||
}
|
||||
}
|
||||
|
||||
if (issue.isStale) {
|
||||
issueLogger.info(`This $$type has a stale label`);
|
||||
} else {
|
||||
issueLogger.info(`This $$type hasn't a stale label`);
|
||||
}
|
||||
|
||||
const exemptLabels: string[] = wordsToList(
|
||||
issue.isPullRequest
|
||||
? this.options.exemptPrLabels
|
||||
: this.options.exemptIssueLabels
|
||||
);
|
||||
|
||||
if (
|
||||
exemptLabels.some((exemptLabel: Readonly<string>): boolean =>
|
||||
isLabeled(issue, exemptLabel)
|
||||
)
|
||||
) {
|
||||
if (issue.isStale) {
|
||||
issueLogger.info(`An exempt label was added after the stale label.`);
|
||||
await this._removeStaleLabel(issue, staleLabel);
|
||||
}
|
||||
|
||||
issueLogger.info(`Skipping this $$type because it has an exempt label`);
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue; // Don't process exempt issues
|
||||
}
|
||||
|
||||
const anyOfLabels: string[] = wordsToList(this._getAnyOfLabels(issue));
|
||||
|
||||
if (anyOfLabels.length > 0) {
|
||||
issueLogger.info(
|
||||
`The option ${issueLogger.createOptionLink(
|
||||
Option.AnyOfLabels
|
||||
)} was specified to only process the issues and pull requests with one of those labels (${chalk.cyan(
|
||||
anyOfLabels.length
|
||||
)})`
|
||||
);
|
||||
|
||||
const hasOneOfWhitelistedLabels: boolean = anyOfLabels.some(
|
||||
(label: Readonly<string>): boolean => {
|
||||
return isLabeled(issue, label);
|
||||
}
|
||||
);
|
||||
|
||||
if (!hasOneOfWhitelistedLabels) {
|
||||
issueLogger.info(
|
||||
chalk.white('└──'),
|
||||
`Skipping this $$type because it doesn't have one of the required labels`
|
||||
);
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue; // Don't process issues without any of the required labels
|
||||
} else {
|
||||
issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
`One of the required labels is present on this $$type`
|
||||
);
|
||||
issueLogger.info(
|
||||
chalk.white('└──'),
|
||||
`Continuing the process for this $$type`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
issueLogger.info(
|
||||
`The option ${issueLogger.createOptionLink(
|
||||
Option.AnyOfLabels
|
||||
)} was not specified`
|
||||
);
|
||||
issueLogger.info(
|
||||
chalk.white('└──'),
|
||||
`Continuing the process for this $$type`
|
||||
);
|
||||
}
|
||||
|
||||
const milestones: Milestones = new Milestones(this.options, issue);
|
||||
|
||||
if (milestones.shouldExemptMilestones()) {
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue; // Don't process exempt milestones
|
||||
}
|
||||
|
||||
const assignees: Assignees = new Assignees(this.options, issue);
|
||||
|
||||
if (assignees.shouldExemptAssignees()) {
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
continue; // Don't process exempt assignees
|
||||
}
|
||||
|
||||
// Should this issue be marked stale?
|
||||
const shouldBeStale = !IssuesProcessor._updatedSince(
|
||||
issue.updated_at,
|
||||
daysBeforeStale
|
||||
);
|
||||
|
||||
// Determine if this issue needs to be marked stale first
|
||||
if (!issue.isStale) {
|
||||
issueLogger.info(`This $$type is not stale`);
|
||||
const updatedAtDate: Date = new Date(issue.updated_at);
|
||||
|
||||
if (shouldBeStale) {
|
||||
issueLogger.info(
|
||||
`This $$type should be stale based on the last update date the ${getHumanizedDate(
|
||||
updatedAtDate
|
||||
)} (${chalk.cyan(issue.updated_at)})`
|
||||
);
|
||||
|
||||
if (shouldMarkAsStale) {
|
||||
issueLogger.info(
|
||||
`This $$type should be marked as stale based on the option ${issueLogger.createOptionLink(
|
||||
this._getDaysBeforeStaleUsedOptionName(issue)
|
||||
)} (${chalk.cyan(daysBeforeStale)})`
|
||||
);
|
||||
await this._markStale(issue, staleMessage, staleLabel, skipMessage);
|
||||
issue.isStale = true; // This issue is now considered stale
|
||||
issueLogger.info(`This $$type is now stale`);
|
||||
} else {
|
||||
issueLogger.info(
|
||||
`This $$type should not be marked as stale based on the option ${issueLogger.createOptionLink(
|
||||
this._getDaysBeforeStaleUsedOptionName(issue)
|
||||
)} (${chalk.cyan(daysBeforeStale)})`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
issueLogger.info(
|
||||
`This $$type should not be stale based on the last update date the ${getHumanizedDate(
|
||||
updatedAtDate
|
||||
)} (${chalk.cyan(issue.updated_at)})`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Process the issue if it was marked stale
|
||||
if (issue.isStale) {
|
||||
issueLogger.info(`This $$type is already stale`);
|
||||
await this._processStaleIssue(
|
||||
issue,
|
||||
staleLabel,
|
||||
actor,
|
||||
closeMessage,
|
||||
closeLabel
|
||||
);
|
||||
}
|
||||
|
||||
IssuesProcessor._endIssueProcessing(issue);
|
||||
}
|
||||
|
||||
if (!this._operations.hasRemainingOperations()) {
|
||||
this._logger.warning(
|
||||
chalk.yellowBright('No more operations left! Exiting...')
|
||||
);
|
||||
this._logger.warning(
|
||||
chalk.yellowBright(
|
||||
`If you think that not enough issues were processed you could try to increase the quantity related to the ${this._logger.createOptionLink(
|
||||
Option.OperationsPerRun
|
||||
)} option which is currently set to ${chalk.cyan(
|
||||
this.options.operationsPerRun
|
||||
)}`
|
||||
)
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
this._logger.info(
|
||||
chalk.green(`Batch ${chalk.cyan(`#${page}`)} processed.`)
|
||||
);
|
||||
|
||||
// Do the next batch
|
||||
return this.processIssues(page + 1);
|
||||
}
|
||||
|
||||
// Grab comments for an issue since a given date
|
||||
async listIssueComments(
|
||||
issueNumber: Readonly<number>,
|
||||
sinceDate: Readonly<string>
|
||||
): Promise<IComment[]> {
|
||||
// Find any comments since date on the given issue
|
||||
try {
|
||||
this._operations.consumeOperation();
|
||||
this._statistics?.incrementFetchedItemsCommentsCount();
|
||||
const comments = await this.client.issues.listComments({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: issueNumber,
|
||||
since: sinceDate
|
||||
});
|
||||
return comments.data;
|
||||
} catch (error) {
|
||||
this._logger.error(`List issue comments error: ${error.message}`);
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
}
|
||||
|
||||
// get the actor from the GitHub token or context
|
||||
async getActor(): Promise<string> {
|
||||
let actor;
|
||||
|
||||
try {
|
||||
this._operations.consumeOperation();
|
||||
actor = await this.client.users.getAuthenticated();
|
||||
} catch (error) {
|
||||
return context.actor;
|
||||
}
|
||||
|
||||
return actor.data.login;
|
||||
}
|
||||
|
||||
// grab issues from github in batches of 100
|
||||
async getIssues(page: number): Promise<Issue[]> {
|
||||
// generate type for response
|
||||
const endpoint = this.client.issues.listForRepo;
|
||||
type OctoKitIssueList = GetResponseTypeFromEndpointMethod<typeof endpoint>;
|
||||
|
||||
try {
|
||||
this._operations.consumeOperation();
|
||||
const issueResult: OctoKitIssueList = await this.client.issues.listForRepo(
|
||||
{
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
state: 'open',
|
||||
per_page: 100,
|
||||
direction: this.options.ascending ? 'asc' : 'desc',
|
||||
page
|
||||
}
|
||||
);
|
||||
this._statistics?.incrementFetchedItemsCount(issueResult.data.length);
|
||||
|
||||
return issueResult.data.map(
|
||||
(issue: Readonly<IIssue>): Issue => new Issue(this.options, issue)
|
||||
);
|
||||
} catch (error) {
|
||||
this._logger.error(`Get issues for repo error: ${error.message}`);
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
}
|
||||
|
||||
// returns the creation date of a given label on an issue (or nothing if no label existed)
|
||||
///see https://developer.github.com/v3/activity/events/
|
||||
async getLabelCreationDate(
|
||||
issue: Issue,
|
||||
label: string
|
||||
): Promise<string | undefined> {
|
||||
const issueLogger: IssueLogger = new IssueLogger(issue);
|
||||
|
||||
issueLogger.info(`Checking for label on this $$type`);
|
||||
|
||||
this._consumeIssueOperation(issue);
|
||||
this._statistics?.incrementFetchedItemsEventsCount();
|
||||
const options = this.client.issues.listEvents.endpoint.merge({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
per_page: 100,
|
||||
issue_number: issue.number
|
||||
});
|
||||
|
||||
const events: IIssueEvent[] = await this.client.paginate(options);
|
||||
const reversedEvents = events.reverse();
|
||||
|
||||
const staleLabeledEvent = reversedEvents.find(
|
||||
event => event.event === 'labeled' && event.label.name === label
|
||||
);
|
||||
|
||||
if (!staleLabeledEvent) {
|
||||
// Must be old rather than labeled
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return staleLabeledEvent.created_at;
|
||||
}
|
||||
|
||||
// handle all of the stale issue logic when we find a stale issue
|
||||
private async _processStaleIssue(
|
||||
issue: Issue,
|
||||
staleLabel: string,
|
||||
actor: string,
|
||||
closeMessage?: string,
|
||||
closeLabel?: string
|
||||
) {
|
||||
const issueLogger: IssueLogger = new IssueLogger(issue);
|
||||
const markedStaleOn: string =
|
||||
(await this.getLabelCreationDate(issue, staleLabel)) || issue.updated_at;
|
||||
issueLogger.info(`$$type marked stale on: ${chalk.cyan(markedStaleOn)}`);
|
||||
|
||||
const issueHasComments: boolean = await this._hasCommentsSince(
|
||||
issue,
|
||||
markedStaleOn,
|
||||
actor
|
||||
);
|
||||
issueLogger.info(
|
||||
`$$type has been commented on: ${chalk.cyan(issueHasComments)}`
|
||||
);
|
||||
|
||||
const daysBeforeClose: number = issue.isPullRequest
|
||||
? this._getDaysBeforePrClose()
|
||||
: this._getDaysBeforeIssueClose();
|
||||
|
||||
issueLogger.info(
|
||||
`Days before $$type close: ${chalk.cyan(daysBeforeClose)}`
|
||||
);
|
||||
|
||||
const issueHasUpdate: boolean = IssuesProcessor._updatedSince(
|
||||
issue.updated_at,
|
||||
daysBeforeClose
|
||||
);
|
||||
issueLogger.info(`$$type has been updated: ${chalk.cyan(issueHasUpdate)}`);
|
||||
|
||||
// should we un-stale this issue?
|
||||
if (this._shouldRemoveStaleWhenUpdated(issue) && issueHasComments) {
|
||||
await this._removeStaleLabel(issue, staleLabel);
|
||||
|
||||
issueLogger.info(`Skipping the process since the $$type is now un-stale`);
|
||||
|
||||
return; // nothing to do because it is no longer stale
|
||||
}
|
||||
|
||||
// now start closing logic
|
||||
if (daysBeforeClose < 0) {
|
||||
return; // nothing to do because we aren't closing stale issues
|
||||
}
|
||||
|
||||
if (!issueHasComments && !issueHasUpdate) {
|
||||
issueLogger.info(
|
||||
`Closing $$type because it was last updated on! ${chalk.cyan(
|
||||
issue.updated_at
|
||||
)}`
|
||||
);
|
||||
await this._closeIssue(issue, closeMessage, closeLabel);
|
||||
|
||||
if (this.options.deleteBranch && issue.pull_request) {
|
||||
issueLogger.info(
|
||||
`Deleting the branch the option ${issueLogger.createOptionLink(
|
||||
Option.DeleteBranch
|
||||
)} was specified`
|
||||
);
|
||||
await this._deleteBranch(issue);
|
||||
this.deletedBranchIssues.push(issue);
|
||||
}
|
||||
} else {
|
||||
issueLogger.info(
|
||||
`Stale $$type is not old enough to close yet (hasComments? ${issueHasComments}, hasUpdate? ${issueHasUpdate})`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// checks to see if a given issue is still stale (has had activity on it)
|
||||
private async _hasCommentsSince(
|
||||
issue: Issue,
|
||||
sinceDate: string,
|
||||
actor: string
|
||||
): Promise<boolean> {
|
||||
const issueLogger: IssueLogger = new IssueLogger(issue);
|
||||
|
||||
issueLogger.info(
|
||||
`Checking for comments on $$type since: ${chalk.cyan(sinceDate)}`
|
||||
);
|
||||
|
||||
if (!sinceDate) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// find any comments since the date
|
||||
const comments = await this.listIssueComments(issue.number, sinceDate);
|
||||
|
||||
const filteredComments = comments.filter(
|
||||
comment => comment.user.type === 'User' && comment.user.login !== actor
|
||||
);
|
||||
|
||||
issueLogger.info(
|
||||
`Comments not made by actor or another bot: ${chalk.cyan(
|
||||
filteredComments.length
|
||||
)}`
|
||||
);
|
||||
|
||||
// if there are any user comments returned
|
||||
return filteredComments.length > 0;
|
||||
}
|
||||
|
||||
// Mark an issue as stale with a comment and a label
|
||||
private async _markStale(
|
||||
issue: Issue,
|
||||
staleMessage: string,
|
||||
staleLabel: string,
|
||||
skipMessage: boolean
|
||||
): Promise<void> {
|
||||
const issueLogger: IssueLogger = new IssueLogger(issue);
|
||||
|
||||
issueLogger.info(`Marking this $$type as stale`);
|
||||
this.staleIssues.push(issue);
|
||||
|
||||
// if the issue is being marked stale, the updated date should be changed to right now
|
||||
// so that close calculations work correctly
|
||||
const newUpdatedAtDate: Date = new Date();
|
||||
issue.updated_at = newUpdatedAtDate.toString();
|
||||
|
||||
if (this.options.debugOnly) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!skipMessage) {
|
||||
try {
|
||||
this._consumeIssueOperation(issue);
|
||||
this._statistics?.incrementAddedItemsComment(issue);
|
||||
await this.client.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
body: staleMessage
|
||||
});
|
||||
} catch (error) {
|
||||
issueLogger.error(`Error when creating a comment: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
this._consumeIssueOperation(issue);
|
||||
this._statistics?.incrementAddedItemsLabel(issue);
|
||||
this._statistics?.incrementStaleItemsCount(issue);
|
||||
await this.client.issues.addLabels({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
labels: [staleLabel]
|
||||
});
|
||||
} catch (error) {
|
||||
issueLogger.error(`Error when adding a label: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Close an issue based on staleness
|
||||
private async _closeIssue(
|
||||
issue: Issue,
|
||||
closeMessage?: string,
|
||||
closeLabel?: string
|
||||
): Promise<void> {
|
||||
const issueLogger: IssueLogger = new IssueLogger(issue);
|
||||
|
||||
issueLogger.info(`Closing $$type for being stale`);
|
||||
this.closedIssues.push(issue);
|
||||
|
||||
if (this.options.debugOnly) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (closeMessage) {
|
||||
try {
|
||||
this._consumeIssueOperation(issue);
|
||||
this._statistics?.incrementAddedItemsComment(issue);
|
||||
await this.client.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
body: closeMessage
|
||||
});
|
||||
} catch (error) {
|
||||
issueLogger.error(`Error when creating a comment: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (closeLabel) {
|
||||
try {
|
||||
this._consumeIssueOperation(issue);
|
||||
this._statistics?.incrementAddedItemsLabel(issue);
|
||||
await this.client.issues.addLabels({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
labels: [closeLabel]
|
||||
});
|
||||
} catch (error) {
|
||||
issueLogger.error(`Error when adding a label: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
this._consumeIssueOperation(issue);
|
||||
this._statistics?.incrementClosedItemsCount(issue);
|
||||
await this.client.issues.update({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
state: 'closed'
|
||||
});
|
||||
} catch (error) {
|
||||
issueLogger.error(`Error when updating this $$type: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
private async _getPullRequest(
|
||||
issue: Issue
|
||||
): Promise<IPullRequest | undefined | void> {
|
||||
const issueLogger: IssueLogger = new IssueLogger(issue);
|
||||
|
||||
if (this.options.debugOnly) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
this._consumeIssueOperation(issue);
|
||||
this._statistics?.incrementFetchedPullRequestsCount();
|
||||
const pullRequest = await this.client.pulls.get({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
pull_number: issue.number
|
||||
});
|
||||
|
||||
return pullRequest.data;
|
||||
} catch (error) {
|
||||
issueLogger.error(`Error when getting this $$type: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Delete the branch on closed pull request
|
||||
private async _deleteBranch(issue: Issue): Promise<void> {
|
||||
const issueLogger: IssueLogger = new IssueLogger(issue);
|
||||
|
||||
issueLogger.info(`Delete branch from closed $$type - ${issue.title}`);
|
||||
|
||||
const pullRequest = await this._getPullRequest(issue);
|
||||
|
||||
if (!pullRequest) {
|
||||
issueLogger.info(
|
||||
`Not deleting this branch as no pull request was found for this $$type`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.options.debugOnly) {
|
||||
return;
|
||||
}
|
||||
|
||||
const branch = pullRequest.head.ref;
|
||||
issueLogger.info(
|
||||
`Deleting the branch "${chalk.cyan(branch)}" from closed $$type`
|
||||
);
|
||||
|
||||
try {
|
||||
this._consumeIssueOperation(issue);
|
||||
this._statistics?.incrementDeletedBranchesCount();
|
||||
await this.client.git.deleteRef({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
ref: `heads/${branch}`
|
||||
});
|
||||
} catch (error) {
|
||||
issueLogger.error(
|
||||
`Error when deleting the branch "${chalk.cyan(branch)}" from $$type: ${
|
||||
error.message
|
||||
}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove a label from an issue or a pull request
|
||||
private async _removeLabel(issue: Issue, label: string): Promise<void> {
|
||||
const issueLogger: IssueLogger = new IssueLogger(issue);
|
||||
|
||||
issueLogger.info(
|
||||
`Removing the label "${chalk.cyan(label)}" from this $$type...`
|
||||
);
|
||||
this.removedLabelIssues.push(issue);
|
||||
|
||||
if (this.options.debugOnly) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
this._consumeIssueOperation(issue);
|
||||
this._statistics?.incrementDeletedItemsLabelsCount(issue);
|
||||
await this.client.issues.removeLabel({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
name: label
|
||||
});
|
||||
issueLogger.info(`The label "${chalk.cyan(label)}" was removed`);
|
||||
} catch (error) {
|
||||
issueLogger.error(
|
||||
`Error when removing the label: "${chalk.cyan(error.message)}"`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private _getDaysBeforeIssueStale(): number {
|
||||
return isNaN(this.options.daysBeforeIssueStale)
|
||||
? this.options.daysBeforeStale
|
||||
: this.options.daysBeforeIssueStale;
|
||||
}
|
||||
|
||||
private _getDaysBeforePrStale(): number {
|
||||
return isNaN(this.options.daysBeforePrStale)
|
||||
? this.options.daysBeforeStale
|
||||
: this.options.daysBeforePrStale;
|
||||
}
|
||||
|
||||
private _getDaysBeforeIssueClose(): number {
|
||||
return isNaN(this.options.daysBeforeIssueClose)
|
||||
? this.options.daysBeforeClose
|
||||
: this.options.daysBeforeIssueClose;
|
||||
}
|
||||
|
||||
private _getDaysBeforePrClose(): number {
|
||||
return isNaN(this.options.daysBeforePrClose)
|
||||
? this.options.daysBeforeClose
|
||||
: this.options.daysBeforePrClose;
|
||||
}
|
||||
|
||||
private _getOnlyLabels(issue: Issue): string {
|
||||
if (issue.isPullRequest) {
|
||||
if (this.options.onlyPrLabels !== '') {
|
||||
return this.options.onlyPrLabels;
|
||||
}
|
||||
} else {
|
||||
if (this.options.onlyIssueLabels !== '') {
|
||||
return this.options.onlyIssueLabels;
|
||||
}
|
||||
}
|
||||
|
||||
return this.options.onlyLabels;
|
||||
}
|
||||
|
||||
private _getAnyOfLabels(issue: Issue): string {
|
||||
if (issue.isPullRequest) {
|
||||
if (this.options.anyOfPrLabels !== '') {
|
||||
return this.options.anyOfPrLabels;
|
||||
}
|
||||
} else {
|
||||
if (this.options.anyOfIssueLabels !== '') {
|
||||
return this.options.anyOfIssueLabels;
|
||||
}
|
||||
}
|
||||
|
||||
return this.options.anyOfLabels;
|
||||
}
|
||||
|
||||
private _shouldRemoveStaleWhenUpdated(issue: Issue): boolean {
|
||||
if (issue.isPullRequest) {
|
||||
if (isBoolean(this.options.removePrStaleWhenUpdated)) {
|
||||
return this.options.removePrStaleWhenUpdated;
|
||||
}
|
||||
|
||||
return this.options.removeStaleWhenUpdated;
|
||||
}
|
||||
|
||||
if (isBoolean(this.options.removeIssueStaleWhenUpdated)) {
|
||||
return this.options.removeIssueStaleWhenUpdated;
|
||||
}
|
||||
|
||||
return this.options.removeStaleWhenUpdated;
|
||||
}
|
||||
|
||||
private async _removeStaleLabel(
|
||||
issue: Issue,
|
||||
staleLabel: Readonly<string>
|
||||
): Promise<void> {
|
||||
const issueLogger: IssueLogger = new IssueLogger(issue);
|
||||
|
||||
issueLogger.info(
|
||||
`The $$type is no longer stale. Removing the stale label...`
|
||||
);
|
||||
|
||||
await this._removeLabel(issue, staleLabel);
|
||||
this._statistics?.incrementUndoStaleItemsCount(issue);
|
||||
}
|
||||
|
||||
private async _removeCloseLabel(
|
||||
issue: Issue,
|
||||
closeLabel: Readonly<string | undefined>
|
||||
): Promise<void> {
|
||||
const issueLogger: IssueLogger = new IssueLogger(issue);
|
||||
|
||||
issueLogger.info(
|
||||
`The $$type is not closed nor locked. Trying to remove the close label...`
|
||||
);
|
||||
|
||||
if (!closeLabel) {
|
||||
issueLogger.info(`There is no close label on this $$type. Skip`);
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
if (isLabeled(issue, closeLabel)) {
|
||||
issueLogger.info(
|
||||
`The $$type has a close label "${chalk.cyan(
|
||||
closeLabel
|
||||
)}". Removing the close label...`
|
||||
);
|
||||
|
||||
await this._removeLabel(issue, closeLabel);
|
||||
this._statistics?.incrementDeletedCloseItemsLabelsCount(issue);
|
||||
}
|
||||
}
|
||||
|
||||
private _consumeIssueOperation(issue: Readonly<Issue>): void {
|
||||
this._operations.consumeOperation();
|
||||
issue.operations.consumeOperation();
|
||||
}
|
||||
|
||||
private _getDaysBeforeStaleUsedOptionName(
|
||||
issue: Readonly<Issue>
|
||||
):
|
||||
| Option.DaysBeforeStale
|
||||
| Option.DaysBeforeIssueStale
|
||||
| Option.DaysBeforePrStale {
|
||||
return issue.isPullRequest
|
||||
? this._getDaysBeforePrStaleUsedOptionName()
|
||||
: this._getDaysBeforeIssueStaleUsedOptionName();
|
||||
}
|
||||
|
||||
private _getDaysBeforeIssueStaleUsedOptionName():
|
||||
| Option.DaysBeforeStale
|
||||
| Option.DaysBeforeIssueStale {
|
||||
return isNaN(this.options.daysBeforeIssueStale)
|
||||
? Option.DaysBeforeStale
|
||||
: Option.DaysBeforeIssueStale;
|
||||
}
|
||||
|
||||
private _getDaysBeforePrStaleUsedOptionName():
|
||||
| Option.DaysBeforeStale
|
||||
| Option.DaysBeforePrStale {
|
||||
return isNaN(this.options.daysBeforePrStale)
|
||||
? Option.DaysBeforeStale
|
||||
: Option.DaysBeforePrStale;
|
||||
}
|
||||
}
|
||||
167
src/classes/loggers/issue-logger.spec.ts
Normal file
167
src/classes/loggers/issue-logger.spec.ts
Normal file
@@ -0,0 +1,167 @@
|
||||
import {DefaultProcessorOptions} from '../../../__tests__/constants/default-processor-options';
|
||||
import {generateIIssue} from '../../../__tests__/functions/generate-iissue';
|
||||
import {Issue} from '../issue';
|
||||
import {IssueLogger} from './issue-logger';
|
||||
import * as core from '@actions/core';
|
||||
|
||||
describe('IssueLogger', (): void => {
|
||||
let issue: Issue;
|
||||
let issueLogger: IssueLogger;
|
||||
let message: string;
|
||||
|
||||
let coreWarningSpy: jest.SpyInstance;
|
||||
|
||||
describe('warning()', (): void => {
|
||||
beforeEach((): void => {
|
||||
message = 'dummy-message';
|
||||
issue = new Issue(
|
||||
DefaultProcessorOptions,
|
||||
generateIIssue({
|
||||
number: 8
|
||||
})
|
||||
);
|
||||
issueLogger = new IssueLogger(issue);
|
||||
|
||||
coreWarningSpy = jest.spyOn(core, 'warning').mockImplementation();
|
||||
});
|
||||
|
||||
it('should log a warning with the given message and with the issue number as prefix', (): void => {
|
||||
expect.assertions(2);
|
||||
|
||||
issueLogger.warning(message);
|
||||
|
||||
expect(coreWarningSpy).toHaveBeenCalledTimes(1);
|
||||
expect(coreWarningSpy).toHaveBeenCalledWith('[#8] dummy-message');
|
||||
});
|
||||
});
|
||||
|
||||
describe('info()', (): void => {
|
||||
let coreInfoSpy: jest.SpyInstance;
|
||||
|
||||
beforeEach((): void => {
|
||||
message = 'dummy-message';
|
||||
issue = new Issue(
|
||||
DefaultProcessorOptions,
|
||||
generateIIssue({
|
||||
number: 8
|
||||
})
|
||||
);
|
||||
issueLogger = new IssueLogger(issue);
|
||||
|
||||
coreInfoSpy = jest.spyOn(core, 'info').mockImplementation();
|
||||
});
|
||||
|
||||
it('should log an information with the given message and with the issue number as prefix', (): void => {
|
||||
expect.assertions(2);
|
||||
|
||||
issueLogger.info(message);
|
||||
|
||||
expect(coreInfoSpy).toHaveBeenCalledTimes(1);
|
||||
expect(coreInfoSpy).toHaveBeenCalledWith('[#8] dummy-message');
|
||||
});
|
||||
});
|
||||
|
||||
describe('error()', (): void => {
|
||||
let coreErrorSpy: jest.SpyInstance;
|
||||
|
||||
beforeEach((): void => {
|
||||
message = 'dummy-message';
|
||||
issue = new Issue(
|
||||
DefaultProcessorOptions,
|
||||
generateIIssue({
|
||||
number: 8
|
||||
})
|
||||
);
|
||||
issueLogger = new IssueLogger(issue);
|
||||
|
||||
coreErrorSpy = jest.spyOn(core, 'error').mockImplementation();
|
||||
});
|
||||
|
||||
it('should log an error with the given message and with the issue number as prefix', (): void => {
|
||||
expect.assertions(2);
|
||||
|
||||
issueLogger.error(message);
|
||||
|
||||
expect(coreErrorSpy).toHaveBeenCalledTimes(1);
|
||||
expect(coreErrorSpy).toHaveBeenCalledWith('[#8] dummy-message');
|
||||
});
|
||||
});
|
||||
|
||||
it('should prefix the message with the issue number', (): void => {
|
||||
expect.assertions(2);
|
||||
message = 'dummy-message';
|
||||
issue = new Issue(
|
||||
DefaultProcessorOptions,
|
||||
generateIIssue({
|
||||
number: 123
|
||||
})
|
||||
);
|
||||
issueLogger = new IssueLogger(issue);
|
||||
coreWarningSpy = jest.spyOn(core, 'warning').mockImplementation();
|
||||
|
||||
issueLogger.warning(message);
|
||||
|
||||
expect(coreWarningSpy).toHaveBeenCalledTimes(1);
|
||||
expect(coreWarningSpy).toHaveBeenCalledWith('[#123] dummy-message');
|
||||
});
|
||||
|
||||
it.each`
|
||||
pull_request | replacement
|
||||
${{key: 'value'}} | ${'pull request'}
|
||||
${{}} | ${'pull request'}
|
||||
${null} | ${'issue'}
|
||||
${undefined} | ${'issue'}
|
||||
`(
|
||||
'should replace the special tokens "$$type" with the corresponding type',
|
||||
({pull_request, replacement}): void => {
|
||||
expect.assertions(2);
|
||||
message = 'The $$type will stale! $$type will soon be closed!';
|
||||
issue = new Issue(
|
||||
DefaultProcessorOptions,
|
||||
generateIIssue({
|
||||
number: 8,
|
||||
pull_request
|
||||
})
|
||||
);
|
||||
issueLogger = new IssueLogger(issue);
|
||||
coreWarningSpy = jest.spyOn(core, 'warning').mockImplementation();
|
||||
|
||||
issueLogger.warning(message);
|
||||
|
||||
expect(coreWarningSpy).toHaveBeenCalledTimes(1);
|
||||
expect(coreWarningSpy).toHaveBeenCalledWith(
|
||||
`[#8] The ${replacement} will stale! ${replacement} will soon be closed!`
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
it.each`
|
||||
pull_request | replacement
|
||||
${{key: 'value'}} | ${'Pull request'}
|
||||
${{}} | ${'Pull request'}
|
||||
${null} | ${'Issue'}
|
||||
${undefined} | ${'Issue'}
|
||||
`(
|
||||
'should replace the special token "$$type" with the corresponding type with first letter as uppercase',
|
||||
({pull_request, replacement}): void => {
|
||||
expect.assertions(2);
|
||||
message = '$$type will stale';
|
||||
issue = new Issue(
|
||||
DefaultProcessorOptions,
|
||||
generateIIssue({
|
||||
number: 8,
|
||||
pull_request
|
||||
})
|
||||
);
|
||||
issueLogger = new IssueLogger(issue);
|
||||
coreWarningSpy = jest.spyOn(core, 'warning').mockImplementation();
|
||||
|
||||
issueLogger.warning(message);
|
||||
|
||||
expect(coreWarningSpy).toHaveBeenCalledTimes(1);
|
||||
expect(coreWarningSpy).toHaveBeenCalledWith(
|
||||
`[#8] ${replacement} will stale`
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
||||
79
src/classes/loggers/issue-logger.ts
Normal file
79
src/classes/loggers/issue-logger.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
import chalk from 'chalk';
|
||||
import {Issue} from '../issue';
|
||||
import {Logger} from './logger';
|
||||
|
||||
/**
|
||||
* @description
|
||||
* Each log will prefix the message with the issue number
|
||||
*
|
||||
* @example
|
||||
* warning('No stale') => "[#123] No stale"
|
||||
*
|
||||
* Each log method can have special tokens:
|
||||
* - $$type => will replace this by either "pull request" or "issue" depending of the type of issue
|
||||
*
|
||||
* @example
|
||||
* warning('The $$type will stale') => "The pull request will stale"
|
||||
*/
|
||||
export class IssueLogger extends Logger {
|
||||
private readonly _issue: Issue;
|
||||
|
||||
constructor(issue: Issue) {
|
||||
super();
|
||||
this._issue = issue;
|
||||
}
|
||||
|
||||
warning(...message: string[]): void {
|
||||
super.warning(this._format(...message));
|
||||
}
|
||||
|
||||
info(...message: string[]): void {
|
||||
super.info(this._format(...message));
|
||||
}
|
||||
|
||||
error(...message: string[]): void {
|
||||
super.error(this._format(...message));
|
||||
}
|
||||
|
||||
private _replaceTokens(message: Readonly<string>): string {
|
||||
return this._replaceTypeToken(message);
|
||||
}
|
||||
|
||||
private _replaceTypeToken(message: Readonly<string>): string {
|
||||
return message
|
||||
.replace(
|
||||
/^\$\$type/,
|
||||
this._issue.isPullRequest ? 'Pull request' : 'Issue'
|
||||
)
|
||||
.replace(
|
||||
/\$\$type/g,
|
||||
this._issue.isPullRequest ? 'pull request' : 'issue'
|
||||
);
|
||||
}
|
||||
|
||||
private _prefixWithIssueNumber(message: Readonly<string>): string {
|
||||
return `${this._getPrefix()} ${message}`;
|
||||
}
|
||||
|
||||
private _getIssueNumber(): number {
|
||||
return this._issue.number;
|
||||
}
|
||||
|
||||
private _format(...message: string[]): string {
|
||||
return this._prefixWithIssueNumber(this._replaceTokens(message.join(' ')));
|
||||
}
|
||||
|
||||
private _getPrefix(): string {
|
||||
return this._issue.isPullRequest
|
||||
? this._getPullRequestPrefix()
|
||||
: this._getIssuePrefix();
|
||||
}
|
||||
|
||||
private _getIssuePrefix(): string {
|
||||
return chalk.red(`[#${this._getIssueNumber()}]`);
|
||||
}
|
||||
|
||||
private _getPullRequestPrefix(): string {
|
||||
return chalk.blue(`[#${this._getIssueNumber()}]`);
|
||||
}
|
||||
}
|
||||
73
src/classes/loggers/logger.spec.ts
Normal file
73
src/classes/loggers/logger.spec.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
import {Logger} from './logger';
|
||||
import * as core from '@actions/core';
|
||||
|
||||
describe('Logger', (): void => {
|
||||
let logger: Logger;
|
||||
|
||||
beforeEach((): void => {
|
||||
logger = new Logger();
|
||||
});
|
||||
|
||||
describe('warning()', (): void => {
|
||||
let message: string;
|
||||
|
||||
let coreWarningSpy: jest.SpyInstance;
|
||||
|
||||
beforeEach((): void => {
|
||||
message = 'dummy-message';
|
||||
|
||||
coreWarningSpy = jest.spyOn(core, 'warning').mockImplementation();
|
||||
});
|
||||
|
||||
it('should log a warning with the given message', (): void => {
|
||||
expect.assertions(2);
|
||||
|
||||
logger.warning(message);
|
||||
|
||||
expect(coreWarningSpy).toHaveBeenCalledTimes(1);
|
||||
expect(coreWarningSpy).toHaveBeenCalledWith('dummy-message');
|
||||
});
|
||||
});
|
||||
|
||||
describe('info()', (): void => {
|
||||
let message: string;
|
||||
|
||||
let coreInfoSpy: jest.SpyInstance;
|
||||
|
||||
beforeEach((): void => {
|
||||
message = 'dummy-message';
|
||||
|
||||
coreInfoSpy = jest.spyOn(core, 'info').mockImplementation();
|
||||
});
|
||||
|
||||
it('should log an information with the given message', (): void => {
|
||||
expect.assertions(2);
|
||||
|
||||
logger.info(message);
|
||||
|
||||
expect(coreInfoSpy).toHaveBeenCalledTimes(1);
|
||||
expect(coreInfoSpy).toHaveBeenCalledWith('dummy-message');
|
||||
});
|
||||
});
|
||||
|
||||
describe('error()', (): void => {
|
||||
let message: string;
|
||||
|
||||
let coreErrorSpy: jest.SpyInstance;
|
||||
|
||||
beforeEach((): void => {
|
||||
message = 'dummy-message';
|
||||
|
||||
coreErrorSpy = jest.spyOn(core, 'error').mockImplementation();
|
||||
});
|
||||
|
||||
it('should log an error with the given message', (): void => {
|
||||
expect.assertions(2);
|
||||
|
||||
logger.error(message);
|
||||
|
||||
expect(coreErrorSpy).toHaveBeenCalledTimes(1);
|
||||
expect(coreErrorSpy).toHaveBeenCalledWith('dummy-message');
|
||||
});
|
||||
});
|
||||
});
|
||||
28
src/classes/loggers/logger.ts
Normal file
28
src/classes/loggers/logger.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import * as core from '@actions/core';
|
||||
import chalk from 'chalk';
|
||||
import terminalLink from 'terminal-link';
|
||||
import {Option} from '../../enums/option';
|
||||
|
||||
export class Logger {
|
||||
warning(...message: string[]): void {
|
||||
core.warning(chalk.whiteBright(...message));
|
||||
}
|
||||
|
||||
info(...message: string[]): void {
|
||||
core.info(chalk.whiteBright(...message));
|
||||
}
|
||||
|
||||
error(...message: string[]): void {
|
||||
core.error(chalk.whiteBright(...message));
|
||||
}
|
||||
|
||||
createLink(name: Readonly<string>, link: Readonly<string>): string {
|
||||
return terminalLink(name, link);
|
||||
}
|
||||
|
||||
createOptionLink(option: Readonly<Option>): string {
|
||||
return chalk.magenta(
|
||||
this.createLink(option, `https://github.com/actions/stale#${option}`)
|
||||
);
|
||||
}
|
||||
}
|
||||
798
src/classes/milestones.spec.ts
Normal file
798
src/classes/milestones.spec.ts
Normal file
@@ -0,0 +1,798 @@
|
||||
import {DefaultProcessorOptions} from '../../__tests__/constants/default-processor-options';
|
||||
import {generateIIssue} from '../../__tests__/functions/generate-iissue';
|
||||
import {IIssue} from '../interfaces/issue';
|
||||
import {IIssuesProcessorOptions} from '../interfaces/issues-processor-options';
|
||||
import {Issue} from './issue';
|
||||
import {Milestones} from './milestones';
|
||||
|
||||
describe('Milestones', (): void => {
|
||||
let milestones: Milestones;
|
||||
let optionsInterface: IIssuesProcessorOptions;
|
||||
let issue: Issue;
|
||||
let issueInterface: IIssue;
|
||||
|
||||
beforeEach((): void => {
|
||||
optionsInterface = {...DefaultProcessorOptions, exemptAllMilestones: false};
|
||||
issueInterface = generateIIssue();
|
||||
});
|
||||
|
||||
describe('shouldExemptMilestones()', (): void => {
|
||||
describe('when the given issue is not a pull request', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.pull_request = undefined;
|
||||
});
|
||||
|
||||
describe('when the given options are not configured to exempt a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptMilestones = '';
|
||||
});
|
||||
|
||||
describe('when the given options are not configured to exempt an issue milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptIssueMilestones = '';
|
||||
});
|
||||
|
||||
describe('when the given issue does not have a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = undefined;
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue does have a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = {
|
||||
title: 'dummy-title'
|
||||
};
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are configured to exempt an issue milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptIssueMilestones =
|
||||
'dummy-exempt-issue-milestone';
|
||||
});
|
||||
|
||||
describe('when the given issue does not have a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = undefined;
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue does have a milestone different than the exempt issue milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = {
|
||||
title: 'dummy-title'
|
||||
};
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue does have a milestone equaling the exempt issue milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = {
|
||||
title: 'dummy-exempt-issue-milestone'
|
||||
};
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are configured to exempt a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptMilestones = 'dummy-exempt-milestone';
|
||||
});
|
||||
|
||||
describe('when the given options are not configured to exempt an issue milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptIssueMilestones = '';
|
||||
});
|
||||
|
||||
describe('when the given issue does not have a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = undefined;
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue does have a milestone different than the exempt milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = {
|
||||
title: 'dummy-title'
|
||||
};
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue does have a milestone equaling the exempt milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = {
|
||||
title: 'dummy-exempt-milestone'
|
||||
};
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are configured to exempt an issue milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptIssueMilestones =
|
||||
'dummy-exempt-issue-milestone';
|
||||
});
|
||||
|
||||
describe('when the given issue does not have a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = undefined;
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue does have a milestone different than the exempt issue milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = {
|
||||
title: 'dummy-title'
|
||||
};
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue does have a milestone equaling the exempt issue milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = {
|
||||
title: 'dummy-exempt-issue-milestone'
|
||||
};
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue does have a milestone different than the exempt milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = {
|
||||
title: 'dummy-title'
|
||||
};
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue does have a milestone equaling the exempt milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = {
|
||||
title: 'dummy-exempt-milestone'
|
||||
};
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are configured to exempt all milestones', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptAllMilestones = true;
|
||||
});
|
||||
|
||||
describe('when the given issue does not have a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = undefined;
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue does have a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = {
|
||||
title: 'dummy-exempt-issue-milestone'
|
||||
};
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are not configured to exempt all issue milestones', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptAllIssueMilestones = false;
|
||||
});
|
||||
|
||||
describe('when the given issue does not have a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = undefined;
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue does have a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = {
|
||||
title: 'dummy-exempt-milestone'
|
||||
};
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are configured to exempt all issue milestones', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptAllIssueMilestones = true;
|
||||
});
|
||||
|
||||
describe('when the given issue does not have a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = undefined;
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue does have a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = {
|
||||
title: 'dummy-exempt-issue-milestone'
|
||||
};
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue is a pull request', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.pull_request = {};
|
||||
});
|
||||
|
||||
describe('when the given options are not configured to exempt a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptMilestones = '';
|
||||
});
|
||||
|
||||
describe('when the given options are not configured to exempt a pull request milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptPrMilestones = '';
|
||||
});
|
||||
|
||||
describe('when the given pull request does not have a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = undefined;
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given pull request does have a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = {
|
||||
title: 'dummy-title'
|
||||
};
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are configured to exempt a pull request milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptPrMilestones = 'dummy-exempt-pr-milestone';
|
||||
});
|
||||
|
||||
describe('when the given pull request does not have a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = undefined;
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given pull request does have a milestone different than the exempt pull request milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = {
|
||||
title: 'dummy-title'
|
||||
};
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given pull request does have a milestone equaling the exempt pull request milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = {
|
||||
title: 'dummy-exempt-pr-milestone'
|
||||
};
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are configured to exempt a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptMilestones = 'dummy-exempt-milestone';
|
||||
});
|
||||
|
||||
describe('when the given options are not configured to exempt a pull request milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptPrMilestones = '';
|
||||
});
|
||||
|
||||
describe('when the given pull request does not have a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = undefined;
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given pull request does have a milestone different than the exempt milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = {
|
||||
title: 'dummy-title'
|
||||
};
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given pull request does have a milestone equaling the exempt milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = {
|
||||
title: 'dummy-exempt-milestone'
|
||||
};
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are configured to exempt a pull request milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptPrMilestones = 'dummy-exempt-pr-milestone';
|
||||
});
|
||||
|
||||
describe('when the given pull request does not have a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = undefined;
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given pull request does have a milestone different than the exempt pull request milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = {
|
||||
title: 'dummy-title'
|
||||
};
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given pull request does have a milestone equaling the exempt pull request milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = {
|
||||
title: 'dummy-exempt-pr-milestone'
|
||||
};
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given pull request does have a milestone different than the exempt milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = {
|
||||
title: 'dummy-title'
|
||||
};
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given pull request does have a milestone equaling the exempt milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = {
|
||||
title: 'dummy-exempt-milestone'
|
||||
};
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are configured to exempt all milestones', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptAllMilestones = true;
|
||||
});
|
||||
|
||||
describe('when the given pull request does not have a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = undefined;
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given pull request does have a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = {
|
||||
title: 'dummy-exempt-pr-milestone'
|
||||
};
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are not configured to exempt all pull request milestones', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptAllPrMilestones = false;
|
||||
});
|
||||
|
||||
describe('when the given pull request does not have a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = undefined;
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given pull request does have a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = {
|
||||
title: 'dummy-exempt-milestone'
|
||||
};
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given options are configured to exempt all pull request milestones', (): void => {
|
||||
beforeEach((): void => {
|
||||
optionsInterface.exemptAllPrMilestones = true;
|
||||
});
|
||||
|
||||
describe('when the given pull request does not have a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = undefined;
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given pull request does have a milestone', (): void => {
|
||||
beforeEach((): void => {
|
||||
issueInterface.milestone = {
|
||||
title: 'dummy-exempt-pr-milestone'
|
||||
};
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
issue = new Issue(optionsInterface, issueInterface);
|
||||
milestones = new Milestones(optionsInterface, issue);
|
||||
|
||||
const result = milestones.shouldExemptMilestones();
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
293
src/classes/milestones.ts
Normal file
293
src/classes/milestones.ts
Normal file
@@ -0,0 +1,293 @@
|
||||
import chalk from 'chalk';
|
||||
import deburr from 'lodash.deburr';
|
||||
import {Option} from '../enums/option';
|
||||
import {wordsToList} from '../functions/words-to-list';
|
||||
import {IIssuesProcessorOptions} from '../interfaces/issues-processor-options';
|
||||
import {Issue} from './issue';
|
||||
import {IssueLogger} from './loggers/issue-logger';
|
||||
|
||||
type CleanMilestone = string;
|
||||
|
||||
export class Milestones {
|
||||
private static _cleanMilestone(milestone: Readonly<string>): CleanMilestone {
|
||||
return deburr(milestone.toLowerCase());
|
||||
}
|
||||
|
||||
private readonly _options: IIssuesProcessorOptions;
|
||||
private readonly _issue: Issue;
|
||||
private readonly _issueLogger: IssueLogger;
|
||||
|
||||
constructor(options: Readonly<IIssuesProcessorOptions>, issue: Issue) {
|
||||
this._options = options;
|
||||
this._issue = issue;
|
||||
this._issueLogger = new IssueLogger(issue);
|
||||
}
|
||||
|
||||
shouldExemptMilestones(): boolean {
|
||||
if (!this._issue.milestone) {
|
||||
this._issueLogger.info('This $$type has no milestone');
|
||||
this._logSkip();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this._shouldExemptAllMilestones()) {
|
||||
this._issueLogger.info(
|
||||
chalk.white('└──'),
|
||||
'Skipping this $$type because it has a milestone'
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const exemptMilestones: string[] = this._getExemptMilestones();
|
||||
|
||||
if (exemptMilestones.length === 0) {
|
||||
this._issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
`No milestone option was specified to skip the stale process for this $$type`
|
||||
);
|
||||
this._logSkip();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
this._issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
`Found ${chalk.cyan(exemptMilestones.length)} milestone${
|
||||
exemptMilestones.length > 1 ? 's' : ''
|
||||
} that can exempt stale on this $$type`
|
||||
);
|
||||
|
||||
const hasExemptMilestone: boolean = exemptMilestones.some(
|
||||
(exemptMilestone: Readonly<string>): boolean =>
|
||||
this._hasMilestone(exemptMilestone)
|
||||
);
|
||||
|
||||
if (!hasExemptMilestone) {
|
||||
this._issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
'No milestone on this $$type can exempt the stale process'
|
||||
);
|
||||
this._logSkip();
|
||||
} else {
|
||||
this._issueLogger.info(
|
||||
chalk.white('└──'),
|
||||
'Skipping this $$type because it has an exempt milestone'
|
||||
);
|
||||
}
|
||||
|
||||
return hasExemptMilestone;
|
||||
}
|
||||
|
||||
private _getExemptMilestones(): string[] {
|
||||
return this._issue.isPullRequest
|
||||
? this._getExemptPullRequestMilestones()
|
||||
: this._getExemptIssueMilestones();
|
||||
}
|
||||
|
||||
private _getExemptIssueMilestones(): string[] {
|
||||
if (this._options.exemptIssueMilestones === '') {
|
||||
this._issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptIssueMilestones
|
||||
)} is disabled. No specific milestone can skip the stale process for this $$type`
|
||||
);
|
||||
|
||||
if (this._options.exemptMilestones === '') {
|
||||
this._issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptMilestones
|
||||
)} is disabled. No specific milestone can skip the stale process for this $$type`
|
||||
);
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
const exemptMilestones: string[] = wordsToList(
|
||||
this._options.exemptMilestones
|
||||
);
|
||||
|
||||
this._issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptMilestones
|
||||
)} is set. ${chalk.cyan(exemptMilestones.length)} milestone${
|
||||
exemptMilestones.length === 1 ? '' : 's'
|
||||
} can skip the stale process for this $$type`
|
||||
);
|
||||
|
||||
return exemptMilestones;
|
||||
}
|
||||
|
||||
const exemptMilestones: string[] = wordsToList(
|
||||
this._options.exemptIssueMilestones
|
||||
);
|
||||
|
||||
this._issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptIssueMilestones
|
||||
)} is set. ${chalk.cyan(exemptMilestones.length)} milestone${
|
||||
exemptMilestones.length === 1 ? '' : 's'
|
||||
} can skip the stale process for this $$type`
|
||||
);
|
||||
|
||||
return exemptMilestones;
|
||||
}
|
||||
|
||||
private _getExemptPullRequestMilestones(): string[] {
|
||||
if (this._options.exemptPrMilestones === '') {
|
||||
this._issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptPrMilestones
|
||||
)} is disabled. No specific milestone can skip the stale process for this $$type`
|
||||
);
|
||||
|
||||
if (this._options.exemptMilestones === '') {
|
||||
this._issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptMilestones
|
||||
)} is disabled. No specific milestone can skip the stale process for this $$type`
|
||||
);
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
const exemptMilestones: string[] = wordsToList(
|
||||
this._options.exemptMilestones
|
||||
);
|
||||
|
||||
this._issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptMilestones
|
||||
)} is set. ${chalk.cyan(exemptMilestones.length)} milestone${
|
||||
exemptMilestones.length === 1 ? '' : 's'
|
||||
} can skip the stale process for this $$type`
|
||||
);
|
||||
|
||||
return exemptMilestones;
|
||||
}
|
||||
|
||||
const exemptMilestones: string[] = wordsToList(
|
||||
this._options.exemptPrMilestones
|
||||
);
|
||||
|
||||
this._issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptPrMilestones
|
||||
)} is set. ${chalk.cyan(exemptMilestones.length)} milestone${
|
||||
exemptMilestones.length === 1 ? '' : 's'
|
||||
} can skip the stale process for this $$type`
|
||||
);
|
||||
|
||||
return exemptMilestones;
|
||||
}
|
||||
|
||||
private _hasMilestone(milestone: Readonly<string>): boolean {
|
||||
if (!this._issue.milestone) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const cleanMilestone: CleanMilestone = Milestones._cleanMilestone(
|
||||
milestone
|
||||
);
|
||||
|
||||
const isSameMilestone: boolean =
|
||||
cleanMilestone ===
|
||||
Milestones._cleanMilestone(this._issue.milestone.title);
|
||||
|
||||
if (isSameMilestone) {
|
||||
this._issueLogger.info(
|
||||
chalk.white('├──'),
|
||||
`The milestone "${milestone}" is set on this $$type and is an exempt milestone`
|
||||
);
|
||||
}
|
||||
|
||||
return isSameMilestone;
|
||||
}
|
||||
|
||||
private _shouldExemptAllMilestones(): boolean {
|
||||
if (this._issue.milestone) {
|
||||
return this._issue.isPullRequest
|
||||
? this._shouldExemptAllPullRequestMilestones()
|
||||
: this._shouldExemptAllIssueMilestones();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private _shouldExemptAllIssueMilestones(): boolean {
|
||||
if (this._options.exemptAllIssueMilestones === true) {
|
||||
this._issueLogger.info(
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptAllIssueMilestones
|
||||
)} is enabled. Any milestone on this $$type will skip the stale process`
|
||||
);
|
||||
|
||||
return true;
|
||||
} else if (this._options.exemptAllIssueMilestones === false) {
|
||||
this._issueLogger.info(
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptAllIssueMilestones
|
||||
)} is disabled. Only some specific milestones on this $$type will skip the stale process`
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
this._logExemptAllMilestonesOption();
|
||||
|
||||
return this._options.exemptAllMilestones;
|
||||
}
|
||||
|
||||
private _shouldExemptAllPullRequestMilestones(): boolean {
|
||||
if (this._options.exemptAllPrMilestones === true) {
|
||||
this._issueLogger.info(
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptAllPrMilestones
|
||||
)} is enabled. Any milestone on this $$type will skip the stale process`
|
||||
);
|
||||
|
||||
return true;
|
||||
} else if (this._options.exemptAllPrMilestones === false) {
|
||||
this._issueLogger.info(
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptAllPrMilestones
|
||||
)} is disabled. Only some specific milestones on this $$type will skip the stale process`
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
this._logExemptAllMilestonesOption();
|
||||
|
||||
return this._options.exemptAllMilestones;
|
||||
}
|
||||
|
||||
private _logExemptAllMilestonesOption(): void {
|
||||
if (this._options.exemptAllMilestones) {
|
||||
this._issueLogger.info(
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptAllMilestones
|
||||
)} is enabled. Any milestone on this $$type will skip the stale process`
|
||||
);
|
||||
} else {
|
||||
this._issueLogger.info(
|
||||
`The option ${this._issueLogger.createOptionLink(
|
||||
Option.ExemptAllMilestones
|
||||
)} is disabled. Only some specific milestones on this $$type will skip the stale process`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private _logSkip(): void {
|
||||
this._issueLogger.info(chalk.white('└──'), 'Skip the milestones checks');
|
||||
}
|
||||
}
|
||||
49
src/classes/operations.spec.ts
Normal file
49
src/classes/operations.spec.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import {Operations} from './operations';
|
||||
|
||||
describe('Operations', (): void => {
|
||||
let operations: Operations;
|
||||
|
||||
describe('consumeOperation()', (): void => {
|
||||
beforeEach((): void => {
|
||||
operations = new Operations();
|
||||
});
|
||||
|
||||
it('should increase the count of operation consume by 1', (): void => {
|
||||
expect.assertions(1);
|
||||
operations.consumeOperation();
|
||||
|
||||
const result = operations.getConsumedOperationsCount();
|
||||
|
||||
expect(result).toStrictEqual(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('consumeOperations()', (): void => {
|
||||
beforeEach((): void => {
|
||||
operations = new Operations();
|
||||
});
|
||||
|
||||
it('should increase the count of operation consume by the provided quantity', (): void => {
|
||||
expect.assertions(1);
|
||||
operations.consumeOperations(8);
|
||||
|
||||
const result = operations.getConsumedOperationsCount();
|
||||
|
||||
expect(result).toStrictEqual(8);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getConsumedOperationsCount()', (): void => {
|
||||
beforeEach((): void => {
|
||||
operations = new Operations();
|
||||
});
|
||||
|
||||
it('should return 0 by default', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = operations.getConsumedOperationsCount();
|
||||
|
||||
expect(result).toStrictEqual(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
17
src/classes/operations.ts
Normal file
17
src/classes/operations.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
export class Operations {
|
||||
protected _operationsConsumed = 0;
|
||||
|
||||
consumeOperation(): Operations {
|
||||
return this.consumeOperations(1);
|
||||
}
|
||||
|
||||
consumeOperations(quantity: Readonly<number>): Operations {
|
||||
this._operationsConsumed += quantity;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
getConsumedOperationsCount(): number {
|
||||
return this._operationsConsumed;
|
||||
}
|
||||
}
|
||||
134
src/classes/stale-operations.spec.ts
Normal file
134
src/classes/stale-operations.spec.ts
Normal file
@@ -0,0 +1,134 @@
|
||||
import {DefaultProcessorOptions} from '../../__tests__/constants/default-processor-options';
|
||||
import {IIssuesProcessorOptions} from '../interfaces/issues-processor-options';
|
||||
import {StaleOperations} from './stale-operations';
|
||||
|
||||
interface IHasRemainingOperationsMatrix {
|
||||
operationsPerRun: number;
|
||||
consumeOperations: number;
|
||||
hasRemainingOperations: number;
|
||||
}
|
||||
|
||||
interface IGetRemainingOperationsCountMatrix {
|
||||
operationsPerRun: number;
|
||||
consumeOperations: number;
|
||||
getRemainingOperationsCount: number;
|
||||
}
|
||||
|
||||
describe('StaleOperations', (): void => {
|
||||
let operations: StaleOperations;
|
||||
let options: IIssuesProcessorOptions;
|
||||
|
||||
beforeEach((): void => {
|
||||
options = {...DefaultProcessorOptions};
|
||||
});
|
||||
|
||||
describe('consumeOperation()', (): void => {
|
||||
beforeEach((): void => {
|
||||
operations = new StaleOperations(options);
|
||||
});
|
||||
|
||||
it('should increase the count of operation consume by 1', (): void => {
|
||||
expect.assertions(1);
|
||||
operations.consumeOperation();
|
||||
|
||||
const result = operations.getConsumedOperationsCount();
|
||||
|
||||
expect(result).toStrictEqual(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('consumeOperations()', (): void => {
|
||||
beforeEach((): void => {
|
||||
operations = new StaleOperations(options);
|
||||
});
|
||||
|
||||
it('should increase the count of operation consume by the provided quantity', (): void => {
|
||||
expect.assertions(1);
|
||||
operations.consumeOperations(8);
|
||||
|
||||
const result = operations.getConsumedOperationsCount();
|
||||
|
||||
expect(result).toStrictEqual(8);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getConsumedOperationsCount()', (): void => {
|
||||
beforeEach((): void => {
|
||||
operations = new StaleOperations(options);
|
||||
});
|
||||
|
||||
it('should return 0 by default', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = operations.getConsumedOperationsCount();
|
||||
|
||||
expect(result).toStrictEqual(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('hasRemainingOperations()', (): void => {
|
||||
beforeEach((): void => {
|
||||
operations = new StaleOperations(options);
|
||||
});
|
||||
|
||||
describe.each`
|
||||
operationsPerRun | consumeOperations | hasRemainingOperations
|
||||
${1} | ${1} | ${false}
|
||||
${2} | ${1} | ${true}
|
||||
`(
|
||||
'when the operations per run is $operationsPerRun and $consumeOperations operations were consumed',
|
||||
({
|
||||
operationsPerRun,
|
||||
consumeOperations,
|
||||
hasRemainingOperations
|
||||
}: IHasRemainingOperationsMatrix): void => {
|
||||
beforeEach((): void => {
|
||||
options.operationsPerRun = operationsPerRun;
|
||||
operations = new StaleOperations(options);
|
||||
});
|
||||
|
||||
it(`should return ${hasRemainingOperations}`, (): void => {
|
||||
expect.assertions(1);
|
||||
operations.consumeOperations(consumeOperations);
|
||||
|
||||
const result = operations.hasRemainingOperations();
|
||||
|
||||
expect(result).toStrictEqual(hasRemainingOperations);
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
describe('getRemainingOperationsCount()', (): void => {
|
||||
beforeEach((): void => {
|
||||
operations = new StaleOperations(options);
|
||||
});
|
||||
|
||||
describe.each`
|
||||
operationsPerRun | consumeOperations | getRemainingOperationsCount
|
||||
${1} | ${1} | ${0}
|
||||
${2} | ${1} | ${1}
|
||||
`(
|
||||
'when the operations per run is $operationsPerRun and $consumeOperations operations were consumed',
|
||||
({
|
||||
operationsPerRun,
|
||||
consumeOperations,
|
||||
getRemainingOperationsCount
|
||||
}: IGetRemainingOperationsCountMatrix): void => {
|
||||
beforeEach((): void => {
|
||||
options.operationsPerRun = operationsPerRun;
|
||||
operations = new StaleOperations(options);
|
||||
});
|
||||
|
||||
it(`should return ${getRemainingOperationsCount}`, (): void => {
|
||||
expect.assertions(1);
|
||||
operations.consumeOperations(consumeOperations);
|
||||
|
||||
const result = operations.getRemainingOperationsCount();
|
||||
|
||||
expect(result).toStrictEqual(getRemainingOperationsCount);
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
19
src/classes/stale-operations.ts
Normal file
19
src/classes/stale-operations.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import {IIssuesProcessorOptions} from '../interfaces/issues-processor-options';
|
||||
import {Operations} from './operations';
|
||||
|
||||
export class StaleOperations extends Operations {
|
||||
private readonly _options: IIssuesProcessorOptions;
|
||||
|
||||
constructor(options: Readonly<IIssuesProcessorOptions>) {
|
||||
super();
|
||||
this._options = options;
|
||||
}
|
||||
|
||||
hasRemainingOperations(): boolean {
|
||||
return this._operationsConsumed < this._options.operationsPerRun;
|
||||
}
|
||||
|
||||
getRemainingOperationsCount(): number {
|
||||
return this._options.operationsPerRun - this._operationsConsumed;
|
||||
}
|
||||
}
|
||||
520
src/classes/statistics.ts
Normal file
520
src/classes/statistics.ts
Normal file
@@ -0,0 +1,520 @@
|
||||
import chalk from 'chalk';
|
||||
import {Issue} from './issue';
|
||||
import {Logger} from './loggers/logger';
|
||||
|
||||
interface IGroupValue {
|
||||
name: string;
|
||||
count: number;
|
||||
}
|
||||
|
||||
export class Statistics {
|
||||
private readonly _logger: Logger = new Logger();
|
||||
private _processedIssuesCount = 0;
|
||||
private _processedPullRequestsCount = 0;
|
||||
private _staleIssuesCount = 0;
|
||||
private _stalePullRequestsCount = 0;
|
||||
private _undoStaleIssuesCount = 0;
|
||||
private _undoStalePullRequestsCount = 0;
|
||||
private _operationsCount = 0;
|
||||
private _closedIssuesCount = 0;
|
||||
private _closedPullRequestsCount = 0;
|
||||
private _deletedIssuesLabelsCount = 0;
|
||||
private _deletedPullRequestsLabelsCount = 0;
|
||||
private _deletedCloseIssuesLabelsCount = 0;
|
||||
private _deletedClosePullRequestsLabelsCount = 0;
|
||||
private _deletedBranchesCount = 0;
|
||||
private _addedIssuesLabelsCount = 0;
|
||||
private _addedPullRequestsLabelsCount = 0;
|
||||
private _addedIssuesCommentsCount = 0;
|
||||
private _addedPullRequestsCommentsCount = 0;
|
||||
private _fetchedItemsCount = 0;
|
||||
private _fetchedItemsEventsCount = 0;
|
||||
private _fetchedItemsCommentsCount = 0;
|
||||
private _fetchedPullRequestsCount = 0;
|
||||
|
||||
incrementProcessedItemsCount(
|
||||
issue: Readonly<Issue>,
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
if (issue.isPullRequest) {
|
||||
return this._incrementProcessedPullRequestsCount(increment);
|
||||
}
|
||||
|
||||
return this._incrementProcessedIssuesCount(increment);
|
||||
}
|
||||
|
||||
incrementStaleItemsCount(
|
||||
issue: Readonly<Issue>,
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
if (issue.isPullRequest) {
|
||||
return this._incrementStalePullRequestsCount(increment);
|
||||
}
|
||||
|
||||
return this._incrementStaleIssuesCount(increment);
|
||||
}
|
||||
|
||||
incrementUndoStaleItemsCount(
|
||||
issue: Readonly<Issue>,
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
if (issue.isPullRequest) {
|
||||
return this._incrementUndoStalePullRequestsCount(increment);
|
||||
}
|
||||
|
||||
return this._incrementUndoStaleIssuesCount(increment);
|
||||
}
|
||||
|
||||
setRemainingOperations(remainingOperations: Readonly<number>): Statistics {
|
||||
this._operationsCount = remainingOperations;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
incrementClosedItemsCount(
|
||||
issue: Readonly<Issue>,
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
if (issue.isPullRequest) {
|
||||
return this._incrementClosedPullRequestsCount(increment);
|
||||
}
|
||||
|
||||
return this._incrementClosedIssuesCount(increment);
|
||||
}
|
||||
|
||||
incrementDeletedItemsLabelsCount(
|
||||
issue: Readonly<Issue>,
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
if (issue.isPullRequest) {
|
||||
return this._incrementDeletedPullRequestsLabelsCount(increment);
|
||||
}
|
||||
|
||||
return this._incrementDeletedIssuesLabelsCount(increment);
|
||||
}
|
||||
|
||||
incrementDeletedCloseItemsLabelsCount(
|
||||
issue: Readonly<Issue>,
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
if (issue.isPullRequest) {
|
||||
return this._incrementDeletedClosePullRequestsLabelsCount(increment);
|
||||
}
|
||||
|
||||
return this._incrementDeletedCloseIssuesLabelsCount(increment);
|
||||
}
|
||||
|
||||
incrementDeletedBranchesCount(increment: Readonly<number> = 1): Statistics {
|
||||
this._deletedBranchesCount += increment;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
incrementAddedItemsLabel(
|
||||
issue: Readonly<Issue>,
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
if (issue.isPullRequest) {
|
||||
return this._incrementAddedPullRequestsLabel(increment);
|
||||
}
|
||||
|
||||
return this._incrementAddedIssuesLabel(increment);
|
||||
}
|
||||
|
||||
incrementAddedItemsComment(
|
||||
issue: Readonly<Issue>,
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
if (issue.isPullRequest) {
|
||||
return this._incrementAddedPullRequestsComment(increment);
|
||||
}
|
||||
|
||||
return this._incrementAddedIssuesComment(increment);
|
||||
}
|
||||
|
||||
incrementFetchedItemsCount(increment: Readonly<number> = 1): Statistics {
|
||||
this._fetchedItemsCount += increment;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
incrementFetchedItemsEventsCount(
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
this._fetchedItemsEventsCount += increment;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
incrementFetchedItemsCommentsCount(
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
this._fetchedItemsCommentsCount += increment;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
incrementFetchedPullRequestsCount(
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
this._fetchedPullRequestsCount += increment;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
logStats(): Statistics {
|
||||
this._logger.info(chalk.yellow.bold('Statistics:'));
|
||||
this._logProcessedIssuesAndPullRequestsCount();
|
||||
this._logStaleIssuesAndPullRequestsCount();
|
||||
this._logUndoStaleIssuesAndPullRequestsCount();
|
||||
this._logClosedIssuesAndPullRequestsCount();
|
||||
this._logDeletedIssuesAndPullRequestsLabelsCount();
|
||||
this._logDeletedCloseIssuesAndPullRequestsLabelsCount();
|
||||
this._logDeletedBranchesCount();
|
||||
this._logAddedIssuesAndPullRequestsLabelsCount();
|
||||
this._logAddedIssuesAndPullRequestsCommentsCount();
|
||||
this._logFetchedItemsCount();
|
||||
this._logFetchedItemsEventsCount();
|
||||
this._logFetchedItemsCommentsCount();
|
||||
this._logFetchedPullRequestsCount();
|
||||
this._logOperationsCount();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private _incrementProcessedIssuesCount(
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
this._processedIssuesCount += increment;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private _incrementProcessedPullRequestsCount(
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
this._processedPullRequestsCount += increment;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private _incrementStaleIssuesCount(
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
this._staleIssuesCount += increment;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private _incrementStalePullRequestsCount(
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
this._stalePullRequestsCount += increment;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private _incrementUndoStaleIssuesCount(
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
this._undoStaleIssuesCount += increment;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private _incrementUndoStalePullRequestsCount(
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
this._undoStalePullRequestsCount += increment;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private _incrementClosedIssuesCount(
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
this._closedIssuesCount += increment;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private _incrementClosedPullRequestsCount(
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
this._closedPullRequestsCount += increment;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private _incrementDeletedIssuesLabelsCount(
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
this._deletedIssuesLabelsCount += increment;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private _incrementDeletedPullRequestsLabelsCount(
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
this._deletedPullRequestsLabelsCount += increment;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private _incrementDeletedCloseIssuesLabelsCount(
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
this._deletedCloseIssuesLabelsCount += increment;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private _incrementDeletedClosePullRequestsLabelsCount(
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
this._deletedClosePullRequestsLabelsCount += increment;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private _incrementAddedIssuesLabel(
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
this._addedIssuesLabelsCount += increment;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private _incrementAddedPullRequestsLabel(
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
this._addedPullRequestsLabelsCount += increment;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private _incrementAddedIssuesComment(
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
this._addedIssuesCommentsCount += increment;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private _incrementAddedPullRequestsComment(
|
||||
increment: Readonly<number> = 1
|
||||
): Statistics {
|
||||
this._addedPullRequestsCommentsCount += increment;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private _logProcessedIssuesAndPullRequestsCount(): void {
|
||||
this._logGroup('Processed items', [
|
||||
{
|
||||
name: 'Processed issues',
|
||||
count: this._processedIssuesCount
|
||||
},
|
||||
{
|
||||
name: 'Processed PRs',
|
||||
count: this._processedPullRequestsCount
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
private _logStaleIssuesAndPullRequestsCount(): void {
|
||||
this._logGroup('New stale items', [
|
||||
{
|
||||
name: 'New stale issues',
|
||||
count: this._staleIssuesCount
|
||||
},
|
||||
{
|
||||
name: 'New stale PRs',
|
||||
count: this._stalePullRequestsCount
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
private _logUndoStaleIssuesAndPullRequestsCount(): void {
|
||||
this._logGroup('No longer stale items', [
|
||||
{
|
||||
name: 'No longer stale issues',
|
||||
count: this._undoStaleIssuesCount
|
||||
},
|
||||
{
|
||||
name: 'No longer stale PRs',
|
||||
count: this._undoStalePullRequestsCount
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
private _logClosedIssuesAndPullRequestsCount(): void {
|
||||
this._logGroup('Closed items', [
|
||||
{
|
||||
name: 'Closed issues',
|
||||
count: this._closedIssuesCount
|
||||
},
|
||||
{
|
||||
name: 'Closed PRs',
|
||||
count: this._closedPullRequestsCount
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
private _logDeletedIssuesAndPullRequestsLabelsCount(): void {
|
||||
this._logGroup('Deleted items labels', [
|
||||
{
|
||||
name: 'Deleted issues labels',
|
||||
count: this._deletedIssuesLabelsCount
|
||||
},
|
||||
{
|
||||
name: 'Deleted PRs labels',
|
||||
count: this._deletedPullRequestsLabelsCount
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
private _logDeletedCloseIssuesAndPullRequestsLabelsCount(): void {
|
||||
this._logGroup('Deleted close items labels', [
|
||||
{
|
||||
name: 'Deleted close issues labels',
|
||||
count: this._deletedCloseIssuesLabelsCount
|
||||
},
|
||||
{
|
||||
name: 'Deleted close PRs labels',
|
||||
count: this._deletedClosePullRequestsLabelsCount
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
private _logDeletedBranchesCount(): void {
|
||||
this._logCount('Deleted branches', this._deletedBranchesCount);
|
||||
}
|
||||
|
||||
private _logAddedIssuesAndPullRequestsLabelsCount(): void {
|
||||
this._logGroup('Added items labels', [
|
||||
{
|
||||
name: 'Added issues labels',
|
||||
count: this._addedIssuesLabelsCount
|
||||
},
|
||||
{
|
||||
name: 'Added PRs labels',
|
||||
count: this._addedPullRequestsLabelsCount
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
private _logAddedIssuesAndPullRequestsCommentsCount(): void {
|
||||
this._logGroup('Added items comments', [
|
||||
{
|
||||
name: 'Added issues comments',
|
||||
count: this._addedIssuesCommentsCount
|
||||
},
|
||||
{
|
||||
name: 'Added PRs comments',
|
||||
count: this._addedPullRequestsCommentsCount
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
private _logFetchedItemsCount(): void {
|
||||
this._logCount('Fetched items', this._fetchedItemsCount);
|
||||
}
|
||||
|
||||
private _logFetchedItemsEventsCount(): void {
|
||||
this._logCount('Fetched items events', this._fetchedItemsEventsCount);
|
||||
}
|
||||
|
||||
private _logFetchedItemsCommentsCount(): void {
|
||||
this._logCount('Fetched items comments', this._fetchedItemsCommentsCount);
|
||||
}
|
||||
|
||||
private _logFetchedPullRequestsCount(): void {
|
||||
this._logCount('Fetched pull requests', this._fetchedPullRequestsCount);
|
||||
}
|
||||
|
||||
private _logOperationsCount(): void {
|
||||
this._logCount('Operations performed', this._operationsCount);
|
||||
}
|
||||
|
||||
private _logCount(name: Readonly<string>, count: Readonly<number>): void {
|
||||
if (count > 0) {
|
||||
this._logger.info(`${name}:`, chalk.cyan(count));
|
||||
}
|
||||
}
|
||||
|
||||
private _logGroup(groupName: Readonly<string>, values: IGroupValue[]): void {
|
||||
if (this._isGroupValuesPartiallySet(values)) {
|
||||
this._logCount(groupName, this._getGroupValuesTotalCount(values));
|
||||
|
||||
this._logGroupValues(values);
|
||||
} else {
|
||||
// Only one value will be display
|
||||
for (const value of values) {
|
||||
this._logCount(value.name, value.count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @description
|
||||
* If there is a least two elements with a valid count then it's partially set
|
||||
* Useful to defined if we should display the values as a group or not
|
||||
*
|
||||
* @param {IGroupValue[]} values The list of group values to check
|
||||
*/
|
||||
private _isGroupValuesPartiallySet(values: IGroupValue[]): boolean {
|
||||
return (
|
||||
values
|
||||
.map((value: Readonly<IGroupValue>): boolean => {
|
||||
return value.count > 0;
|
||||
})
|
||||
.filter((isSet: Readonly<boolean>): boolean => isSet).length >= 2
|
||||
);
|
||||
}
|
||||
|
||||
private _getGroupValuesTotalCount(values: IGroupValue[]): number {
|
||||
return values.reduce(
|
||||
(count: Readonly<number>, value: Readonly<IGroupValue>): number => {
|
||||
return count + value.count;
|
||||
},
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
private _getAllGroupValuesSet(values: IGroupValue[]): IGroupValue[] {
|
||||
return values.filter((value: Readonly<IGroupValue>): boolean => {
|
||||
return value.count > 0;
|
||||
});
|
||||
}
|
||||
|
||||
private _logGroupValues(values: IGroupValue[]): void {
|
||||
const onlyValuesSet: IGroupValue[] = this._getAllGroupValuesSet(values);
|
||||
const longestValue: number = this._getLongestGroupValue(onlyValuesSet);
|
||||
|
||||
for (const [index, value] of onlyValuesSet.entries()) {
|
||||
const prefix = index === onlyValuesSet.length - 1 ? '└──' : '├──';
|
||||
|
||||
this._logCount(
|
||||
`${chalk.white(prefix)} ${value.name.padEnd(longestValue, ' ')}`,
|
||||
value.count
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private _getLongestGroupValue(values: IGroupValue[]): number {
|
||||
return values.reduce(
|
||||
(
|
||||
longestValue: Readonly<number>,
|
||||
value: Readonly<IGroupValue>
|
||||
): number => {
|
||||
return value.name.length > longestValue
|
||||
? value.name.length
|
||||
: longestValue;
|
||||
},
|
||||
0
|
||||
);
|
||||
}
|
||||
}
|
||||
4
src/enums/issue-type.ts
Normal file
4
src/enums/issue-type.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export enum IssueType {
|
||||
Issue = 'issue',
|
||||
PullRequest = 'pr'
|
||||
}
|
||||
44
src/enums/option.ts
Normal file
44
src/enums/option.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
export enum Option {
|
||||
RepoToken = 'repo-token',
|
||||
StaleIssueMessage = 'stale-issue-message',
|
||||
StalePrMessage = 'stale-pr-message',
|
||||
CloseIssueMessage = 'close-issue-message',
|
||||
ClosePrMessage = 'close-pr-message',
|
||||
DaysBeforeStale = 'days-before-stale',
|
||||
DaysBeforeIssueStale = 'days-before-issue-stale',
|
||||
DaysBeforePrStale = 'days-before-pr-stale',
|
||||
DaysBeforeClose = 'days-before-close',
|
||||
DaysBeforeIssueClose = 'days-before-issue-close',
|
||||
DaysBeforePrClose = 'days-before-pr-close',
|
||||
StaleIssueLabel = 'stale-issue-label',
|
||||
CloseIssueLabel = 'close-issue-label',
|
||||
ExemptIssueLabels = 'exempt-issue-labels',
|
||||
StalePrLabel = 'stale-pr-label',
|
||||
ClosePrLabel = 'close-pr-label',
|
||||
ExemptPrLabels = 'exempt-pr-labels',
|
||||
OnlyLabels = 'only-labels',
|
||||
OnlyIssueLabels = 'only-issue-labels',
|
||||
OnlyPrLabels = 'only-pr-labels',
|
||||
AnyOfLabels = 'any-of-labels',
|
||||
OperationsPerRun = 'operations-per-run',
|
||||
RemoveStaleWhenUpdated = 'remove-stale-when-updated',
|
||||
DebugOnly = 'debug-only',
|
||||
Ascending = 'ascending',
|
||||
SkipStaleIssueMessage = 'skip-stale-issue-message',
|
||||
SkipStalePrMessage = 'skip-stale-pr-message',
|
||||
DeleteBranch = 'delete-branch',
|
||||
StartDate = 'start-date',
|
||||
ExemptMilestones = 'exempt-milestones',
|
||||
ExemptIssueMilestones = 'exempt-issue-milestones',
|
||||
ExemptPrMilestones = 'exempt-pr-milestones',
|
||||
ExemptAllMilestones = 'exempt-all-milestones',
|
||||
ExemptAllIssueMilestones = 'exempt-all-issue-milestones',
|
||||
ExemptAllPrMilestones = 'exempt-all-pr-milestones',
|
||||
ExemptAssignees = 'exempt-assignees',
|
||||
ExemptIssueAssignees = 'exempt-issue-assignees',
|
||||
ExemptPrAssignees = 'exempt-pr-assignees',
|
||||
ExemptAllAssignees = 'exempt-all-assignees',
|
||||
ExemptAllIssueAssignees = 'exempt-all-issue-assignees',
|
||||
ExemptAllPrAssignees = 'exempt-all-pr-assignees',
|
||||
EnableStatistics = 'enable-statistics'
|
||||
}
|
||||
33
src/functions/dates/get-humanized-date.spec.ts
Normal file
33
src/functions/dates/get-humanized-date.spec.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import {getHumanizedDate} from './get-humanized-date';
|
||||
|
||||
describe('getHumanizedDate()', (): void => {
|
||||
let date: Date;
|
||||
|
||||
describe('when the given date is the 1st of april 2020', (): void => {
|
||||
beforeEach((): void => {
|
||||
date = new Date(2020, 3, 1);
|
||||
});
|
||||
|
||||
it('should return the date formatted as DD-MM-YYYY', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = getHumanizedDate(date);
|
||||
|
||||
expect(result).toStrictEqual('01-04-2020');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given date is the 18st of december 2020', (): void => {
|
||||
beforeEach((): void => {
|
||||
date = new Date(2020, 11, 18);
|
||||
});
|
||||
|
||||
it('should return the date formatted as DD-MM-YYYY', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = getHumanizedDate(date);
|
||||
|
||||
expect(result).toStrictEqual('18-12-2020');
|
||||
});
|
||||
});
|
||||
});
|
||||
17
src/functions/dates/get-humanized-date.ts
Normal file
17
src/functions/dates/get-humanized-date.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import {HumanizedDate} from '../../types/humanized-date';
|
||||
|
||||
export function getHumanizedDate(date: Readonly<Date>): HumanizedDate {
|
||||
const year: number = date.getFullYear();
|
||||
let month = `${date.getMonth() + 1}`;
|
||||
let day = `${date.getDate()}`;
|
||||
|
||||
if (month.length < 2) {
|
||||
month = `0${month}`;
|
||||
}
|
||||
|
||||
if (day.length < 2) {
|
||||
day = `0${day}`;
|
||||
}
|
||||
|
||||
return [day, month, year].join('-');
|
||||
}
|
||||
51
src/functions/dates/is-date-more-recent-than.spec.ts
Normal file
51
src/functions/dates/is-date-more-recent-than.spec.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import {isDateMoreRecentThan} from './is-date-more-recent-than';
|
||||
|
||||
describe('isDateMoreRecentThan()', (): void => {
|
||||
let date: Date;
|
||||
let comparedDate: Date;
|
||||
|
||||
describe('when the given date is older than the compared date', (): void => {
|
||||
beforeEach((): void => {
|
||||
date = new Date(2020, 0, 20);
|
||||
comparedDate = new Date(2021, 0, 20);
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = isDateMoreRecentThan(date, comparedDate);
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given date is equal to the compared date', (): void => {
|
||||
beforeEach((): void => {
|
||||
date = new Date(2020, 0, 20);
|
||||
comparedDate = new Date(2020, 0, 20);
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = isDateMoreRecentThan(date, comparedDate);
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given date is more recent than the compared date', (): void => {
|
||||
beforeEach((): void => {
|
||||
date = new Date(2021, 0, 20);
|
||||
comparedDate = new Date(2020, 0, 20);
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = isDateMoreRecentThan(date, comparedDate);
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
6
src/functions/dates/is-date-more-recent-than.ts
Normal file
6
src/functions/dates/is-date-more-recent-than.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export function isDateMoreRecentThan(
|
||||
date: Readonly<Date>,
|
||||
comparedDate: Readonly<Date>
|
||||
): boolean {
|
||||
return date > comparedDate;
|
||||
}
|
||||
61
src/functions/dates/is-valid-date.spec.ts
Normal file
61
src/functions/dates/is-valid-date.spec.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import {isValidDate} from './is-valid-date';
|
||||
|
||||
describe('isValidDate()', (): void => {
|
||||
let date: Date;
|
||||
|
||||
describe('when the given date is an invalid date', (): void => {
|
||||
beforeEach((): void => {
|
||||
date = new Date('16-04-1994');
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = isValidDate(date);
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given date is a new date', (): void => {
|
||||
beforeEach((): void => {
|
||||
date = new Date();
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = isValidDate(date);
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given date is an ISO and valid date', (): void => {
|
||||
beforeEach((): void => {
|
||||
date = new Date('2011-04-22T13:33:48Z');
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = isValidDate(date);
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given date is an ISO with ms and valid date', (): void => {
|
||||
beforeEach((): void => {
|
||||
date = new Date('2011-10-05T14:48:00.000Z');
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = isValidDate(date);
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
18
src/functions/dates/is-valid-date.ts
Normal file
18
src/functions/dates/is-valid-date.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @description
|
||||
* Check if a date is valid
|
||||
*
|
||||
* @see
|
||||
* https://stackoverflow.com/a/1353711/4440414
|
||||
*
|
||||
* @param {Readonly<Date>} date The date to check
|
||||
*
|
||||
* @returns {boolean} true when the given date is valid
|
||||
*/
|
||||
export function isValidDate(date: Readonly<Date>): boolean {
|
||||
if (Object.prototype.toString.call(date) === '[object Date]') {
|
||||
return !isNaN(date.getTime());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
29
src/functions/is-boolean.spec.ts
Normal file
29
src/functions/is-boolean.spec.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import {isBoolean} from './is-boolean';
|
||||
|
||||
describe('isBoolean()', (): void => {
|
||||
describe.each([0, 1, undefined, null, ''])(
|
||||
'when the given value is not a boolean',
|
||||
(value): void => {
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = isBoolean(value);
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
describe.each([false, true])(
|
||||
'when the given value is a boolean',
|
||||
(value): void => {
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = isBoolean(value);
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
3
src/functions/is-boolean.ts
Normal file
3
src/functions/is-boolean.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export function isBoolean(value: unknown): value is boolean {
|
||||
return value === true || value === false;
|
||||
}
|
||||
187
src/functions/is-labeled.spec.ts
Normal file
187
src/functions/is-labeled.spec.ts
Normal file
@@ -0,0 +1,187 @@
|
||||
import {Issue} from '../classes/issue';
|
||||
import {isLabeled} from './is-labeled';
|
||||
|
||||
describe('isLabeled()', (): void => {
|
||||
let issue: Issue;
|
||||
let label: string;
|
||||
|
||||
describe('when the given issue contains no label', (): void => {
|
||||
beforeEach((): void => {
|
||||
issue = ({
|
||||
labels: []
|
||||
} as unknown) as Issue;
|
||||
});
|
||||
|
||||
describe('when the given label is a simple label', (): void => {
|
||||
beforeEach((): void => {
|
||||
label = 'label';
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = isLabeled(issue, label);
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue contains a simple label', (): void => {
|
||||
beforeEach((): void => {
|
||||
issue = {
|
||||
labels: [
|
||||
{
|
||||
name: 'label'
|
||||
}
|
||||
]
|
||||
} as Issue;
|
||||
});
|
||||
|
||||
describe('when the given label is a simple label', (): void => {
|
||||
beforeEach((): void => {
|
||||
label = 'label';
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = isLabeled(issue, label);
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue contains a kebab case label', (): void => {
|
||||
beforeEach((): void => {
|
||||
issue = {
|
||||
labels: [
|
||||
{
|
||||
name: 'kebab-case-label'
|
||||
}
|
||||
]
|
||||
} as Issue;
|
||||
});
|
||||
|
||||
describe('when the given label is a kebab case label', (): void => {
|
||||
beforeEach((): void => {
|
||||
label = 'kebab-case-label';
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = isLabeled(issue, label);
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue contains a multiple word label', (): void => {
|
||||
beforeEach((): void => {
|
||||
issue = {
|
||||
labels: [
|
||||
{
|
||||
name: 'label like a sentence'
|
||||
}
|
||||
]
|
||||
} as Issue;
|
||||
});
|
||||
|
||||
describe('when the given label is a multiple word label', (): void => {
|
||||
beforeEach((): void => {
|
||||
label = 'label like a sentence';
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = isLabeled(issue, label);
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue contains a multiple word label with %20 spaces', (): void => {
|
||||
beforeEach((): void => {
|
||||
issue = {
|
||||
labels: [
|
||||
{
|
||||
name: 'label%20like%20a%20sentence'
|
||||
}
|
||||
]
|
||||
} as Issue;
|
||||
});
|
||||
|
||||
describe('when the given label is a multiple word label with %20 spaces', (): void => {
|
||||
beforeEach((): void => {
|
||||
label = 'label%20like%20a%20sentence';
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = isLabeled(issue, label);
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue contains a label wih diacritical marks', (): void => {
|
||||
beforeEach((): void => {
|
||||
issue = {
|
||||
labels: [
|
||||
{
|
||||
name: 'déjà vu'
|
||||
}
|
||||
]
|
||||
} as Issue;
|
||||
});
|
||||
|
||||
describe('when the given issue contains a label', (): void => {
|
||||
beforeEach((): void => {
|
||||
label = 'deja vu';
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = isLabeled(issue, label);
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue contains an uppercase label', (): void => {
|
||||
beforeEach((): void => {
|
||||
label = 'DEJA VU';
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = isLabeled(issue, label);
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue contains a label wih diacritical marks', (): void => {
|
||||
beforeEach((): void => {
|
||||
label = 'déjà vu';
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = isLabeled(issue, label);
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
26
src/functions/is-labeled.ts
Normal file
26
src/functions/is-labeled.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import deburr from 'lodash.deburr';
|
||||
import {Issue} from '../classes/issue';
|
||||
import {ILabel} from '../interfaces/label';
|
||||
import {CleanLabel} from '../types/clean-label';
|
||||
|
||||
/**
|
||||
* @description
|
||||
* Check if the given label is listed as a label of the given issue
|
||||
*
|
||||
* @param {Readonly<Issue>} issue A GitHub issue containing some labels
|
||||
* @param {Readonly<string>} label The label to check the presence with
|
||||
*
|
||||
* @return {boolean} Return true when the given label is also in the given issue labels
|
||||
*/
|
||||
export function isLabeled(
|
||||
issue: Readonly<Issue>,
|
||||
label: Readonly<string>
|
||||
): boolean {
|
||||
return !!issue.labels.find((issueLabel: Readonly<ILabel>): boolean => {
|
||||
return cleanLabel(label) === cleanLabel(issueLabel.name);
|
||||
});
|
||||
}
|
||||
|
||||
function cleanLabel(label: Readonly<string>): CleanLabel {
|
||||
return deburr(label.toLowerCase());
|
||||
}
|
||||
57
src/functions/is-pull-request.spec.ts
Normal file
57
src/functions/is-pull-request.spec.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import {Issue} from '../classes/issue';
|
||||
import {isPullRequest} from './is-pull-request';
|
||||
|
||||
describe('isPullRequest()', (): void => {
|
||||
let issue: Issue;
|
||||
|
||||
describe('when the given issue has an undefined pull request', (): void => {
|
||||
beforeEach((): void => {
|
||||
issue = {
|
||||
pull_request: undefined
|
||||
} as Issue;
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = isPullRequest(issue);
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given issue has a null pull request', (): void => {
|
||||
beforeEach((): void => {
|
||||
issue = {
|
||||
pull_request: null
|
||||
} as Issue;
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = isPullRequest(issue);
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe.each([{}, true])(
|
||||
'when the given issue has pull request',
|
||||
(value): void => {
|
||||
beforeEach((): void => {
|
||||
issue = {
|
||||
pull_request: value
|
||||
} as Issue;
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = isPullRequest(issue);
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
5
src/functions/is-pull-request.ts
Normal file
5
src/functions/is-pull-request.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import {Issue} from '../classes/issue';
|
||||
|
||||
export function isPullRequest(issue: Readonly<Issue>): boolean {
|
||||
return !!issue.pull_request;
|
||||
}
|
||||
47
src/functions/should-mark-when-stale.spec.ts
Normal file
47
src/functions/should-mark-when-stale.spec.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import {shouldMarkWhenStale} from './should-mark-when-stale';
|
||||
|
||||
describe('shouldMarkWhenStale()', (): void => {
|
||||
let daysBeforeStale: number;
|
||||
|
||||
describe('when the given number of days indicate that it should be stalled', (): void => {
|
||||
beforeEach((): void => {
|
||||
daysBeforeStale = -1;
|
||||
});
|
||||
|
||||
it('should return false', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = shouldMarkWhenStale(daysBeforeStale);
|
||||
|
||||
expect(result).toStrictEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given number of days indicate that it should be stalled today', (): void => {
|
||||
beforeEach((): void => {
|
||||
daysBeforeStale = 0;
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = shouldMarkWhenStale(daysBeforeStale);
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given number of days indicate that it should be stalled tomorrow', (): void => {
|
||||
beforeEach((): void => {
|
||||
daysBeforeStale = 1;
|
||||
});
|
||||
|
||||
it('should return true', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = shouldMarkWhenStale(daysBeforeStale);
|
||||
|
||||
expect(result).toStrictEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
5
src/functions/should-mark-when-stale.ts
Normal file
5
src/functions/should-mark-when-stale.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export function shouldMarkWhenStale(
|
||||
daysBeforeStale: Readonly<number>
|
||||
): boolean {
|
||||
return daysBeforeStale >= 0;
|
||||
}
|
||||
137
src/functions/words-to-list.spec.ts
Normal file
137
src/functions/words-to-list.spec.ts
Normal file
@@ -0,0 +1,137 @@
|
||||
import {wordsToList} from './words-to-list';
|
||||
|
||||
describe('wordsToList()', (): void => {
|
||||
let words: string;
|
||||
|
||||
describe('when the given words is empty', (): void => {
|
||||
beforeEach((): void => {
|
||||
words = '';
|
||||
});
|
||||
|
||||
it('should return an empty list of words', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = wordsToList(words);
|
||||
|
||||
expect(result).toStrictEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given words is a simple word', (): void => {
|
||||
beforeEach((): void => {
|
||||
words = 'word';
|
||||
});
|
||||
|
||||
it('should return a list of one word', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = wordsToList(words);
|
||||
|
||||
expect(result).toStrictEqual(['word']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given words is a word with extra spaces before and after', (): void => {
|
||||
beforeEach((): void => {
|
||||
words = ' word ';
|
||||
});
|
||||
|
||||
it('should return a list of one word and remove all spaces before and after', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = wordsToList(words);
|
||||
|
||||
expect(result).toStrictEqual(['word']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given words is a kebab case word', (): void => {
|
||||
beforeEach((): void => {
|
||||
words = 'kebab-case-word';
|
||||
});
|
||||
|
||||
it('should return a list of one word', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = wordsToList(words);
|
||||
|
||||
expect(result).toStrictEqual(['kebab-case-word']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given words is two kebab case words separated with a comma', (): void => {
|
||||
beforeEach((): void => {
|
||||
words = 'kebab-case-word-1,kebab-case-word-2';
|
||||
});
|
||||
|
||||
it('should return a list of two words', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = wordsToList(words);
|
||||
|
||||
expect(result).toStrictEqual(['kebab-case-word-1', 'kebab-case-word-2']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given words is a multiple word word', (): void => {
|
||||
beforeEach((): void => {
|
||||
words = 'word like a sentence';
|
||||
});
|
||||
|
||||
it('should return a list of one word', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = wordsToList(words);
|
||||
|
||||
expect(result).toStrictEqual(['word like a sentence']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given words is two multiple word words separated with a comma', (): void => {
|
||||
beforeEach((): void => {
|
||||
words = 'word like a sentence, another word like a sentence';
|
||||
});
|
||||
|
||||
it('should return a list of two words', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = wordsToList(words);
|
||||
|
||||
expect(result).toStrictEqual([
|
||||
'word like a sentence',
|
||||
'another word like a sentence'
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given words is a multiple word word with %20 spaces', (): void => {
|
||||
beforeEach((): void => {
|
||||
words = 'word%20like%20a%20sentence';
|
||||
});
|
||||
|
||||
it('should return a list of one word', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = wordsToList(words);
|
||||
|
||||
expect(result).toStrictEqual(['word%20like%20a%20sentence']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the given words is two multiple word words with %20 spaces separated with a comma', (): void => {
|
||||
beforeEach((): void => {
|
||||
words = 'word%20like%20a%20sentence,another%20word%20like%20a%20sentence';
|
||||
});
|
||||
|
||||
it('should return a list of two words', (): void => {
|
||||
expect.assertions(1);
|
||||
|
||||
const result = wordsToList(words);
|
||||
|
||||
expect(result).toStrictEqual([
|
||||
'word%20like%20a%20sentence',
|
||||
'another%20word%20like%20a%20sentence'
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
23
src/functions/words-to-list.ts
Normal file
23
src/functions/words-to-list.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @description
|
||||
* Transform a string of comma separated words
|
||||
* to an array of words
|
||||
*
|
||||
* @example
|
||||
* wordsToList('label') => ['label']
|
||||
* wordsToList('label,label') => ['label', 'label']
|
||||
* wordsToList('kebab-label') => ['kebab-label']
|
||||
* wordsToList('kebab%20label') => ['kebab%20label']
|
||||
* wordsToList('label with words') => ['label with words']
|
||||
*
|
||||
* @param {Readonly<string>} words A string of comma separated words
|
||||
*
|
||||
* @return {string[]} A list of words
|
||||
*/
|
||||
export function wordsToList(words: Readonly<string>): string[] {
|
||||
if (!words.length) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return words.split(',').map((word: Readonly<string>): string => word.trim());
|
||||
}
|
||||
3
src/interfaces/assignee.ts
Normal file
3
src/interfaces/assignee.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export interface IAssignee {
|
||||
login: string;
|
||||
}
|
||||
5
src/interfaces/comment.ts
Normal file
5
src/interfaces/comment.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import {IUser} from './user';
|
||||
|
||||
export interface IComment {
|
||||
user: IUser;
|
||||
}
|
||||
7
src/interfaces/issue-event.ts
Normal file
7
src/interfaces/issue-event.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import {ILabel} from './label';
|
||||
|
||||
export interface IIssueEvent {
|
||||
created_at: string;
|
||||
event: string;
|
||||
label: ILabel;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user