mirror of
https://github.com/actions/labeler.git
synced 2025-12-12 12:37:48 +00:00
Compare commits
123 Commits
v4.2.0
...
v5.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4eefdc659 | ||
|
|
4f052778de | ||
|
|
26342ba349 | ||
|
|
e1fcf6fe5b | ||
|
|
3352df1f2b | ||
|
|
57d34076e0 | ||
|
|
a256a58edf | ||
|
|
a5bed11d4d | ||
|
|
4ac17648a4 | ||
|
|
34a5bf6e83 | ||
|
|
09645fd40d | ||
|
|
51cc5e079c | ||
|
|
9cfddd0144 | ||
|
|
3aa0d436e5 | ||
|
|
9488def29a | ||
|
|
11812c37f6 | ||
|
|
68a2598016 | ||
|
|
13e75b4361 | ||
|
|
2a3422a64e | ||
|
|
c1b0ca76ee | ||
|
|
2637d23bca | ||
|
|
d4d4a104a2 | ||
|
|
7f169bc0f2 | ||
|
|
2f1dfd1ef0 | ||
|
|
b1a2f85ed8 | ||
|
|
67604ee822 | ||
|
|
4be192c7d6 | ||
|
|
3ddce51a65 | ||
|
|
938f9c9893 | ||
|
|
210043eed1 | ||
|
|
fa7f98c785 | ||
|
|
29382eb4ff | ||
|
|
0b2cfb01d7 | ||
|
|
62f22bdebe | ||
|
|
ef6ab1b64a | ||
|
|
5ac9519cbf | ||
|
|
4554c0d1af | ||
|
|
49676461cb | ||
|
|
432b275f71 | ||
|
|
3bec9227d1 | ||
|
|
a9e07ce8ff | ||
|
|
e51b118725 | ||
|
|
5d0a66ed59 | ||
|
|
9bfc9998ab | ||
|
|
8e6367ddee | ||
|
|
1c9c27e128 | ||
|
|
b25e3a8c27 | ||
|
|
d31255f7be | ||
|
|
92990c0c57 | ||
|
|
d0d3628020 | ||
|
|
cc1e02580b | ||
|
|
64ce5e9235 | ||
|
|
7741e57c6a | ||
|
|
65b7640e45 | ||
|
|
e9a1777eb0 | ||
|
|
17694aa238 | ||
|
|
c31ee1fd86 | ||
|
|
3af9a47a26 | ||
|
|
a988f4eb9d | ||
|
|
ef108a9d83 | ||
|
|
1ce9b356f6 | ||
|
|
9f259ee115 | ||
|
|
c08f5faa12 | ||
|
|
51b763cbf2 | ||
|
|
e939550344 | ||
|
|
e4486e9ed9 | ||
|
|
fc5eb711b0 | ||
|
|
3eec5d8ccc | ||
|
|
90ef37079a | ||
|
|
f40b38734d | ||
|
|
84e83a9b19 | ||
|
|
5e6bdf6d89 | ||
|
|
394a01bde3 | ||
|
|
2a5bc55cbf | ||
|
|
2e10ffb6ec | ||
|
|
e5b1bddf5e | ||
|
|
8943ca20c9 | ||
|
|
56347d54a1 | ||
|
|
da83a1845f | ||
|
|
ed31b27f2e | ||
|
|
09f085373a | ||
|
|
0eb9d49330 | ||
|
|
b071d82cb8 | ||
|
|
7d175313b7 | ||
|
|
969899da68 | ||
|
|
7a5c525049 | ||
|
|
922ffdf5ad | ||
|
|
231de6bc24 | ||
|
|
2daf35ae4b | ||
|
|
0b6e68d75a | ||
|
|
cd3a8df80d | ||
|
|
2343710777 | ||
|
|
f2b2513f41 | ||
|
|
8c59eccb9d | ||
|
|
7b1327b4c4 | ||
|
|
c54c5a2057 | ||
|
|
7f8d8e472d | ||
|
|
4c74e84461 | ||
|
|
0861fa5acc | ||
|
|
0ad789cf22 | ||
|
|
6e276063fe | ||
|
|
818399d10f | ||
|
|
71fc664414 | ||
|
|
7aadc17f94 | ||
|
|
89f6b77325 | ||
|
|
2246b667c6 | ||
|
|
ab49f7a2bd | ||
|
|
2d63815c83 | ||
|
|
76242143df | ||
|
|
27a1d89941 | ||
|
|
79c0cc7c0b | ||
|
|
d9ed3e87f6 | ||
|
|
2ced1f3255 | ||
|
|
cb5f4480b2 | ||
|
|
8aa7614bc1 | ||
|
|
827e1186a2 | ||
|
|
765934f274 | ||
|
|
bce88a9ea3 | ||
|
|
a01b9aebb2 | ||
|
|
ee0e0eb513 | ||
|
|
6c50d09410 | ||
|
|
ad73546cad | ||
|
|
2bf42e445d |
@@ -7,7 +7,7 @@ module.exports = {
|
|||||||
'eslint-config-prettier'
|
'eslint-config-prettier'
|
||||||
],
|
],
|
||||||
parser: '@typescript-eslint/parser',
|
parser: '@typescript-eslint/parser',
|
||||||
plugins: ['@typescript-eslint', 'eslint-plugin-node', 'eslint-plugin-jest'],
|
plugins: ['@typescript-eslint', 'eslint-plugin-jest'],
|
||||||
rules: {
|
rules: {
|
||||||
'@typescript-eslint/no-require-imports': 'error',
|
'@typescript-eslint/no-require-imports': 'error',
|
||||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||||
@@ -28,8 +28,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
'no-control-regex': 'off',
|
'no-control-regex': 'off',
|
||||||
'no-constant-condition': ['error', {checkLoops: false}],
|
'no-constant-condition': ['error', {checkLoops: false}]
|
||||||
'node/no-extraneous-import': 'error'
|
|
||||||
},
|
},
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
|
|||||||
20
.licenses/npm/@octokit/openapi-types-18.0.0.dep.yml
generated
20
.licenses/npm/@octokit/openapi-types-18.0.0.dep.yml
generated
@@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
name: "@octokit/openapi-types"
|
|
||||||
version: 18.0.0
|
|
||||||
type: npm
|
|
||||||
summary: Generated TypeScript definitions based on GitHub's OpenAPI spec for api.github.com
|
|
||||||
homepage:
|
|
||||||
license: mit
|
|
||||||
licenses:
|
|
||||||
- sources: LICENSE
|
|
||||||
text: |-
|
|
||||||
Copyright 2020 Gregor Martynus
|
|
||||||
|
|
||||||
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/plugin-retry.dep.yml
generated
34
.licenses/npm/@octokit/plugin-retry.dep.yml
generated
@@ -1,34 +0,0 @@
|
|||||||
---
|
|
||||||
name: "@octokit/plugin-retry"
|
|
||||||
version: 5.0.4
|
|
||||||
type: npm
|
|
||||||
summary: Automatic retry plugin for octokit
|
|
||||||
homepage:
|
|
||||||
license: mit
|
|
||||||
licenses:
|
|
||||||
- sources: LICENSE
|
|
||||||
text: |
|
|
||||||
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/request-error-4.0.2.dep.yml
generated
34
.licenses/npm/@octokit/request-error-4.0.2.dep.yml
generated
@@ -1,34 +0,0 @@
|
|||||||
---
|
|
||||||
name: "@octokit/request-error"
|
|
||||||
version: 4.0.2
|
|
||||||
type: npm
|
|
||||||
summary: Error class for Octokit request errors
|
|
||||||
homepage:
|
|
||||||
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: []
|
|
||||||
20
.licenses/npm/@octokit/types-10.0.0.dep.yml
generated
20
.licenses/npm/@octokit/types-10.0.0.dep.yml
generated
@@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
name: "@octokit/types"
|
|
||||||
version: 10.0.0
|
|
||||||
type: npm
|
|
||||||
summary: Shared TypeScript definitions for Octokit projects
|
|
||||||
homepage:
|
|
||||||
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: []
|
|
||||||
31
.licenses/npm/bottleneck.dep.yml
generated
31
.licenses/npm/bottleneck.dep.yml
generated
@@ -1,31 +0,0 @@
|
|||||||
---
|
|
||||||
name: bottleneck
|
|
||||||
version: 2.19.5
|
|
||||||
type: npm
|
|
||||||
summary: Distributed task scheduler and rate limiter
|
|
||||||
homepage:
|
|
||||||
license: mit
|
|
||||||
licenses:
|
|
||||||
- sources: LICENSE
|
|
||||||
text: |
|
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2014 Simon Grondin
|
|
||||||
|
|
||||||
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: []
|
|
||||||
169
README.md
169
README.md
@@ -2,63 +2,83 @@
|
|||||||
|
|
||||||
[](https://github.com/actions/labeler/actions/workflows/basic-validation.yml)
|
[](https://github.com/actions/labeler/actions/workflows/basic-validation.yml)
|
||||||
|
|
||||||
Automatically label new pull requests based on the paths of files being changed.
|
Automatically label new pull requests based on the paths of files being changed or the branch name.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### Create `.github/labeler.yml`
|
### Create `.github/labeler.yml`
|
||||||
|
|
||||||
Create a `.github/labeler.yml` file with a list of labels and [minimatch](https://github.com/isaacs/minimatch) globs to match to apply the label.
|
Create a `.github/labeler.yml` file with a list of labels and config options to match and apply the label.
|
||||||
|
|
||||||
The key is the name of the label in your repository that you want to add (e.g. `merge conflict`, `needs-updating`) and the value is the path (glob) of the changed files (e.g. `src/**`, `tests/*.spec.js`) or a match object.
|
The key is the name of the label in your repository that you want to add (eg: "merge conflict", "needs-updating") and the value is a match object.
|
||||||
|
|
||||||
#### Match Object
|
#### Match Object
|
||||||
|
|
||||||
For more control over matching, you can provide a match object instead of a simple path glob. The match object is defined as:
|
The match object allows control over the matching options, you can specify the label to be applied based on the files that have changed or the name of either the base branch or the head branch. For the changed files options you provide a [path glob](https://github.com/isaacs/minimatch#minimatch), and for the branches you provide a regexp to match against the branch name.
|
||||||
|
|
||||||
|
The base match object is defined as:
|
||||||
```yml
|
```yml
|
||||||
- any: ['list', 'of', 'globs']
|
- changed-files: ['list', 'of', 'globs']
|
||||||
all: ['list', 'of', 'globs']
|
- base-branch: ['list', 'of', 'regexps']
|
||||||
|
- head-branch: ['list', 'of', 'regexps']
|
||||||
```
|
```
|
||||||
|
|
||||||
One or both fields can be provided for fine-grained matching. Unlike the top-level list, the list of path globs provided to `any` and `all` must ALL match against a path for the label to be applied.
|
There are two top level keys of `any` and `all`, which both accept the same config options:
|
||||||
|
```yml
|
||||||
|
- any:
|
||||||
|
- changed-files: ['list', 'of', 'globs']
|
||||||
|
- base-branch: ['list', 'of', 'regexps']
|
||||||
|
- head-branch: ['list', 'of', 'regexps']
|
||||||
|
- all:
|
||||||
|
- changed-files: ['list', 'of', 'globs']
|
||||||
|
- base-branch: ['list', 'of', 'regexps']
|
||||||
|
- head-branch: ['list', 'of', 'regexps']
|
||||||
|
```
|
||||||
|
|
||||||
|
One or all fields can be provided for fine-grained matching.
|
||||||
The fields are defined as follows:
|
The fields are defined as follows:
|
||||||
* `any`: match ALL globs against ANY changed path
|
* `all`: all of the provided options must match in order for the label to be applied
|
||||||
* `all`: match ALL globs against ALL changed paths
|
* `any`: if any of the provided options match then a label will be applied
|
||||||
|
* `base-branch`: match regexps against the base branch name
|
||||||
|
* `changed-files`: match glob patterns against the changed paths
|
||||||
|
* `head-branch`: match regexps against the head branch name
|
||||||
|
|
||||||
A simple path glob is the equivalent to `any: ['glob']`. More specifically, the following two configurations are equivalent:
|
If a base option is provided without a top-level key then it will default to `any`. More specifically, the following two configurations are equivalent:
|
||||||
```yml
|
```yml
|
||||||
label1:
|
label1:
|
||||||
- example1/*
|
- changed-files: example1/*
|
||||||
```
|
```
|
||||||
and
|
and
|
||||||
```yml
|
```yml
|
||||||
label1:
|
label1:
|
||||||
- any: ['example1/*']
|
- any:
|
||||||
|
- changed-files: ['example1/*']
|
||||||
```
|
```
|
||||||
|
|
||||||
From a boolean logic perspective, top-level match objects are `OR`-ed together and individual match rules within an object are `AND`-ed. Combined with `!` negation, you can write complex matching rules.
|
From a boolean logic perspective, top-level match objects, and options within `all` are `AND`-ed together and individual match rules within the `any` object are `OR`-ed. If path globs are combined with `!` negation, you can write complex matching rules.
|
||||||
|
|
||||||
> ⚠️ This action uses [minimatch](https://www.npmjs.com/package/minimatch) to apply glob patterns.
|
|
||||||
> For historical reasons, paths starting with dot (e.g. `.github`) are not matched by default.
|
|
||||||
> You need to set `dot: true` to change this behavior.
|
|
||||||
> See [Inputs](#inputs) table below for details.
|
|
||||||
|
|
||||||
#### Basic Examples
|
#### Basic Examples
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
# Add 'label1' to any changes within 'example' folder or any subfolders
|
# Add 'label1' to any changes within 'example' folder or any subfolders
|
||||||
label1:
|
label1:
|
||||||
- example/**
|
- changed-files: example/**/*
|
||||||
|
|
||||||
# Add 'label2' to any file changes within 'example2' folder
|
# Add 'label2' to any file changes within 'example2' folder
|
||||||
label2: example2/*
|
label2:
|
||||||
|
- changed-files: example2/*
|
||||||
|
|
||||||
# Add label3 to any change to .txt files within the entire repository. Quotation marks are required for the leading asterisk
|
# Add label3 to any change to .txt files within the entire repository. Quotation marks are required for the leading asterisk
|
||||||
label3:
|
label3:
|
||||||
- '**/*.txt'
|
- changed-files: '**/*.txt'
|
||||||
|
|
||||||
|
# Add 'label4' to any PR where the head branch name starts with 'example4'
|
||||||
|
label4:
|
||||||
|
- head-branch: '^example4'
|
||||||
|
|
||||||
|
# Add 'label5' to any PR where the base branch name starts with 'example5'
|
||||||
|
label5:
|
||||||
|
- base-branch: '^example5'
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Common Examples
|
#### Common Examples
|
||||||
@@ -66,29 +86,42 @@ label3:
|
|||||||
```yml
|
```yml
|
||||||
# Add 'repo' label to any root file changes
|
# Add 'repo' label to any root file changes
|
||||||
repo:
|
repo:
|
||||||
- '*'
|
- changed-files: '*'
|
||||||
|
|
||||||
# Add '@domain/core' label to any change within the 'core' package
|
# Add '@domain/core' label to any change within the 'core' package
|
||||||
'@domain/core':
|
'@domain/core':
|
||||||
- package/core/**
|
- changed-files:
|
||||||
|
- package/core/*
|
||||||
|
- package/core/**/*
|
||||||
|
|
||||||
# Add 'test' label to any change to *.spec.js files within the source dir
|
# Add 'test' label to any change to *.spec.js files within the source dir
|
||||||
test:
|
test:
|
||||||
- src/**/*.spec.js
|
- changed-files: src/**/*.spec.js
|
||||||
|
|
||||||
# Add 'source' label to any change to src files within the source dir EXCEPT for the docs sub-folder
|
# Add 'source' label to any change to src files within the source dir EXCEPT for the docs sub-folder
|
||||||
source:
|
source:
|
||||||
- any: ['src/**', '!src/docs/*']
|
- changed-files:
|
||||||
|
- any: ['src/**/*', '!src/docs/*']
|
||||||
|
|
||||||
# Add 'frontend` label to any change to *.js files as long as the `main.js` hasn't changed
|
# Add 'frontend` label to any change to *.js files as long as the `main.js` hasn't changed
|
||||||
frontend:
|
frontend:
|
||||||
- any: ['src/**/*.js']
|
- any:
|
||||||
all: ['!src/main.js']
|
- changed-files: ['src/**/*.js']
|
||||||
|
- all:
|
||||||
|
- changed-files: ['!src/main.js']
|
||||||
|
|
||||||
|
# Add 'feature' label to any PR where the head branch name starts with `feature` or has a `feature` section in the name
|
||||||
|
feature:
|
||||||
|
- head-branch: ['^feature', 'feature']
|
||||||
|
|
||||||
|
# Add 'release' label to any PR that is opened against the `main` branch
|
||||||
|
release:
|
||||||
|
- base-branch: 'main'
|
||||||
```
|
```
|
||||||
|
|
||||||
### Create Workflow
|
### Create Workflow
|
||||||
|
|
||||||
Create a workflow (e.g. `.github/workflows/labeler.yml` see [Creating a Workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file)) to utilize the labeler action with content:
|
Create a workflow (eg: `.github/workflows/labeler.yml` see [Creating a Workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file)) to utilize the labeler action with content:
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
name: "Pull Request Labeler"
|
name: "Pull Request Labeler"
|
||||||
@@ -102,7 +135,7 @@ jobs:
|
|||||||
pull-requests: write
|
pull-requests: write
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/labeler@v4
|
- uses: actions/labeler@v5
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Inputs
|
#### Inputs
|
||||||
@@ -110,83 +143,11 @@ jobs:
|
|||||||
Various inputs are defined in [`action.yml`](action.yml) to let you configure the labeler:
|
Various inputs are defined in [`action.yml`](action.yml) to let you configure the labeler:
|
||||||
|
|
||||||
| Name | Description | Default |
|
| Name | Description | Default |
|
||||||
|----------------------|-------------------------------------------------------------------------------------------------|-----------------------|
|
| - | - | - |
|
||||||
| `repo-token` | Token to use to authorize label changes. Typically the GITHUB_TOKEN secret | N/A |
|
| `repo-token` | Token to use to authorize label changes. Typically the GITHUB_TOKEN secret, with `contents:read` and `pull-requests:write` access | `github.token` |
|
||||||
| `configuration-path` | The path to the label configuration file | `.github/labeler.yml` |
|
| `configuration-path` | The path to the label configuration file | `.github/labeler.yml` |
|
||||||
| `sync-labels` | Whether or not to remove labels when matching files are reverted or no longer changed by the PR | `false`|
|
| `sync-labels` | Whether or not to remove labels when matching files are reverted or no longer changed by the PR | `false`|
|
||||||
| `dot` | Whether or not to auto-include paths starting with dot (e.g. `.github`) | `false` |
|
|
||||||
|
|
||||||
When `dot` is disabled and you want to include _all_ files in a folder:
|
# Contributions
|
||||||
|
|
||||||
```yml
|
|
||||||
label1:
|
|
||||||
- path/to/folder/**/*
|
|
||||||
- path/to/folder/**/.*
|
|
||||||
```
|
|
||||||
|
|
||||||
If `dot` is enabled:
|
|
||||||
|
|
||||||
```yml
|
|
||||||
label1:
|
|
||||||
- path/to/folder/**
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Outputs
|
|
||||||
|
|
||||||
Labeler provides the following outputs:
|
|
||||||
|
|
||||||
| Name | Description |
|
|
||||||
|--------------|-----------------------------------------------------------|
|
|
||||||
| `new-labels` | A comma-separated list of all new labels |
|
|
||||||
| `all-labels` | A comma-separated list of all labels that the PR contains |
|
|
||||||
|
|
||||||
The following example performs steps based on the output of labeler:
|
|
||||||
```yml
|
|
||||||
name: "My workflow"
|
|
||||||
on:
|
|
||||||
- pull_request_target
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
triage:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
pull-requests: write
|
|
||||||
steps:
|
|
||||||
- id: label-the-PR
|
|
||||||
uses: actions/labeler@v3
|
|
||||||
|
|
||||||
- id: run-frontend-tests
|
|
||||||
if: contains(fromJson(steps.label-the-PR.outputs.all-labels), 'frontend')
|
|
||||||
run: |
|
|
||||||
echo "Running frontend tests..."
|
|
||||||
# Put your commands for running frontend tests here
|
|
||||||
|
|
||||||
- id: run-backend-tests
|
|
||||||
if: contains(fromJson(steps.label-the-PR.outputs.all-labels), 'backend')
|
|
||||||
run: |
|
|
||||||
echo "Running backend tests..."
|
|
||||||
# Put your commands for running backend tests here
|
|
||||||
```
|
|
||||||
|
|
||||||
## Permissions
|
|
||||||
|
|
||||||
In order to add labels to pull requests, the GitHub labeler action requires
|
|
||||||
write permissions on the pull-request. However, when the action runs on a pull
|
|
||||||
request from a forked repository, GitHub only grants read access tokens for
|
|
||||||
`pull_request` events, at most. If you encounter an `Error: HttpError: Resource
|
|
||||||
not accessible by integration`, it's likely due to these permission constraints.
|
|
||||||
To resolve this issue, you can modify the `on:` section of your workflow to use
|
|
||||||
[`pull_request_target`](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target)
|
|
||||||
instead of `pull_request` (see example [above](#create-workflow)). This change
|
|
||||||
allows the action to have write access, because `pull_request_target` alters the
|
|
||||||
[context of the
|
|
||||||
action](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target)
|
|
||||||
and safely grants additional permissions. Refer to the [GitHub token
|
|
||||||
permissions
|
|
||||||
documentation](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token)
|
|
||||||
for more details about access levels and event contexts.
|
|
||||||
|
|
||||||
## Contributions
|
|
||||||
|
|
||||||
Contributions are welcome! See the [Contributor's Guide](CONTRIBUTING.md).
|
Contributions are welcome! See the [Contributor's Guide](CONTRIBUTING.md).
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
export const context = {
|
export const context = {
|
||||||
payload: {
|
payload: {
|
||||||
pull_request: {
|
pull_request: {
|
||||||
number: 123
|
number: 123,
|
||||||
|
head: {
|
||||||
|
ref: 'head-branch-name'
|
||||||
|
},
|
||||||
|
base: {
|
||||||
|
ref: 'base-branch-name'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
repo: {
|
repo: {
|
||||||
@@ -13,7 +19,8 @@ export const context = {
|
|||||||
const mockApi = {
|
const mockApi = {
|
||||||
rest: {
|
rest: {
|
||||||
issues: {
|
issues: {
|
||||||
setLabels: jest.fn()
|
addLabels: jest.fn(),
|
||||||
|
removeLabel: jest.fn()
|
||||||
},
|
},
|
||||||
pulls: {
|
pulls: {
|
||||||
get: jest.fn().mockResolvedValue({}),
|
get: jest.fn().mockResolvedValue({}),
|
||||||
|
|||||||
210
__tests__/branch.test.ts
Normal file
210
__tests__/branch.test.ts
Normal file
@@ -0,0 +1,210 @@
|
|||||||
|
import {
|
||||||
|
getBranchName,
|
||||||
|
checkAnyBranch,
|
||||||
|
checkAllBranch,
|
||||||
|
toBranchMatchConfig,
|
||||||
|
BranchMatchConfig
|
||||||
|
} from '../src/branch';
|
||||||
|
import * as github from '@actions/github';
|
||||||
|
|
||||||
|
jest.mock('@actions/core');
|
||||||
|
jest.mock('@actions/github');
|
||||||
|
|
||||||
|
describe('getBranchName', () => {
|
||||||
|
describe('when the pull requests base branch is requested', () => {
|
||||||
|
it('returns the base branch name', () => {
|
||||||
|
const result = getBranchName('base');
|
||||||
|
expect(result).toEqual('base-branch-name');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when the pull requests head branch is requested', () => {
|
||||||
|
it('returns the head branch name', () => {
|
||||||
|
const result = getBranchName('head');
|
||||||
|
expect(result).toEqual('head-branch-name');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('checkAllBranch', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
github.context.payload.pull_request!.head = {
|
||||||
|
ref: 'test/feature/123'
|
||||||
|
};
|
||||||
|
github.context.payload.pull_request!.base = {
|
||||||
|
ref: 'main'
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when a single pattern is provided', () => {
|
||||||
|
describe('and the pattern matches the head branch', () => {
|
||||||
|
it('returns true', () => {
|
||||||
|
const result = checkAllBranch(['^test'], 'head');
|
||||||
|
expect(result).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('and the pattern does not match the head branch', () => {
|
||||||
|
it('returns false', () => {
|
||||||
|
const result = checkAllBranch(['^feature/'], 'head');
|
||||||
|
expect(result).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when multiple patterns are provided', () => {
|
||||||
|
describe('and not all patterns matched', () => {
|
||||||
|
it('returns false', () => {
|
||||||
|
const result = checkAllBranch(['^test/', '^feature/'], 'head');
|
||||||
|
expect(result).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('and all patterns match', () => {
|
||||||
|
it('returns true', () => {
|
||||||
|
const result = checkAllBranch(['^test/', '/feature/'], 'head');
|
||||||
|
expect(result).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('and no patterns match', () => {
|
||||||
|
it('returns false', () => {
|
||||||
|
const result = checkAllBranch(['^feature/', '/test$'], 'head');
|
||||||
|
expect(result).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when the branch to check is specified as the base branch', () => {
|
||||||
|
describe('and the pattern matches the base branch', () => {
|
||||||
|
it('returns true', () => {
|
||||||
|
const result = checkAllBranch(['^main$'], 'base');
|
||||||
|
expect(result).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('checkAnyBranch', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
github.context.payload.pull_request!.head = {
|
||||||
|
ref: 'test/feature/123'
|
||||||
|
};
|
||||||
|
github.context.payload.pull_request!.base = {
|
||||||
|
ref: 'main'
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when a single pattern is provided', () => {
|
||||||
|
describe('and the pattern matches the head branch', () => {
|
||||||
|
it('returns true', () => {
|
||||||
|
const result = checkAnyBranch(['^test'], 'head');
|
||||||
|
expect(result).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('and the pattern does not match the head branch', () => {
|
||||||
|
it('returns false', () => {
|
||||||
|
const result = checkAnyBranch(['^feature/'], 'head');
|
||||||
|
expect(result).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when multiple patterns are provided', () => {
|
||||||
|
describe('and at least one pattern matches', () => {
|
||||||
|
it('returns true', () => {
|
||||||
|
const result = checkAnyBranch(['^test/', '^feature/'], 'head');
|
||||||
|
expect(result).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('and all patterns match', () => {
|
||||||
|
it('returns true', () => {
|
||||||
|
const result = checkAnyBranch(['^test/', '/feature/'], 'head');
|
||||||
|
expect(result).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('and no patterns match', () => {
|
||||||
|
it('returns false', () => {
|
||||||
|
const result = checkAnyBranch(['^feature/', '/test$'], 'head');
|
||||||
|
expect(result).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when the branch to check is specified as the base branch', () => {
|
||||||
|
describe('and the pattern matches the base branch', () => {
|
||||||
|
it('returns true', () => {
|
||||||
|
const result = checkAnyBranch(['^main$'], 'base');
|
||||||
|
expect(result).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('toBranchMatchConfig', () => {
|
||||||
|
describe('when there are no branch keys in the config', () => {
|
||||||
|
const config = {'changed-files': [{any: ['testing']}]};
|
||||||
|
|
||||||
|
it('returns an empty object', () => {
|
||||||
|
const result = toBranchMatchConfig(config);
|
||||||
|
expect(result).toEqual({});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when the config contains a head-branch option', () => {
|
||||||
|
const config = {'head-branch': ['testing']};
|
||||||
|
|
||||||
|
it('sets headBranch in the matchConfig', () => {
|
||||||
|
const result = toBranchMatchConfig(config);
|
||||||
|
expect(result).toEqual<BranchMatchConfig>({
|
||||||
|
headBranch: ['testing']
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('and the matching option is a string', () => {
|
||||||
|
const stringConfig = {'head-branch': 'testing'};
|
||||||
|
|
||||||
|
it('sets headBranch in the matchConfig', () => {
|
||||||
|
const result = toBranchMatchConfig(stringConfig);
|
||||||
|
expect(result).toEqual<BranchMatchConfig>({
|
||||||
|
headBranch: ['testing']
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when the config contains a base-branch option', () => {
|
||||||
|
const config = {'base-branch': ['testing']};
|
||||||
|
it('sets baseBranch in the matchConfig', () => {
|
||||||
|
const result = toBranchMatchConfig(config);
|
||||||
|
expect(result).toEqual<BranchMatchConfig>({
|
||||||
|
baseBranch: ['testing']
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('and the matching option is a string', () => {
|
||||||
|
const stringConfig = {'base-branch': 'testing'};
|
||||||
|
|
||||||
|
it('sets baseBranch in the matchConfig', () => {
|
||||||
|
const result = toBranchMatchConfig(stringConfig);
|
||||||
|
expect(result).toEqual<BranchMatchConfig>({
|
||||||
|
baseBranch: ['testing']
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when the config contains both a base-branch and head-branch option', () => {
|
||||||
|
const config = {'base-branch': ['testing'], 'head-branch': ['testing']};
|
||||||
|
it('sets headBranch and baseBranch in the matchConfig', () => {
|
||||||
|
const result = toBranchMatchConfig(config);
|
||||||
|
expect(result).toEqual<BranchMatchConfig>({
|
||||||
|
baseBranch: ['testing'],
|
||||||
|
headBranch: ['testing']
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
220
__tests__/changedFiles.test.ts
Normal file
220
__tests__/changedFiles.test.ts
Normal file
@@ -0,0 +1,220 @@
|
|||||||
|
import {
|
||||||
|
ChangedFilesMatchConfig,
|
||||||
|
checkAllChangedFiles,
|
||||||
|
checkAnyChangedFiles,
|
||||||
|
toChangedFilesMatchConfig,
|
||||||
|
checkIfAnyGlobMatchesAnyFile,
|
||||||
|
checkIfAllGlobsMatchAnyFile,
|
||||||
|
checkIfAnyGlobMatchesAllFiles,
|
||||||
|
checkIfAllGlobsMatchAllFiles
|
||||||
|
} from '../src/changedFiles';
|
||||||
|
|
||||||
|
jest.mock('@actions/core');
|
||||||
|
jest.mock('@actions/github');
|
||||||
|
|
||||||
|
describe('checkAllChangedFiles', () => {
|
||||||
|
const changedFiles = ['foo.txt', 'bar.txt'];
|
||||||
|
|
||||||
|
describe('when all given glob pattern configs matched', () => {
|
||||||
|
const globPatternsConfigs = [
|
||||||
|
{AnyGlobToAnyFile: ['foo.txt']},
|
||||||
|
{AnyGlobToAllFiles: ['*.txt']},
|
||||||
|
{AllGlobsToAllFiles: ['**']}
|
||||||
|
];
|
||||||
|
|
||||||
|
it('returns true', () => {
|
||||||
|
const result = checkAllChangedFiles(changedFiles, globPatternsConfigs);
|
||||||
|
expect(result).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe(`when some given glob pattern config did not match`, () => {
|
||||||
|
const globPatternsConfigs = [
|
||||||
|
{AnyGlobToAnyFile: ['*.md']},
|
||||||
|
{AnyGlobToAllFiles: ['*.txt']},
|
||||||
|
{AllGlobsToAllFiles: ['**']}
|
||||||
|
];
|
||||||
|
|
||||||
|
it('returns false', () => {
|
||||||
|
const result = checkAllChangedFiles(changedFiles, globPatternsConfigs);
|
||||||
|
expect(result).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('checkAnyChangedFiles', () => {
|
||||||
|
const changedFiles = ['foo.txt', 'bar.txt'];
|
||||||
|
|
||||||
|
describe('when any given glob pattern config matched', () => {
|
||||||
|
const globPatternsConfigs = [
|
||||||
|
{AnyGlobToAnyFile: ['*.md']},
|
||||||
|
{AnyGlobToAllFiles: ['*.txt']}
|
||||||
|
];
|
||||||
|
|
||||||
|
it('returns true', () => {
|
||||||
|
const result = checkAnyChangedFiles(changedFiles, globPatternsConfigs);
|
||||||
|
expect(result).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when none of the given glob pattern configs matched', () => {
|
||||||
|
const globPatternsConfigs = [
|
||||||
|
{AnyGlobToAnyFile: ['*.md']},
|
||||||
|
{AnyGlobToAllFiles: ['!*.txt']}
|
||||||
|
];
|
||||||
|
|
||||||
|
it('returns false', () => {
|
||||||
|
const result = checkAnyChangedFiles(changedFiles, globPatternsConfigs);
|
||||||
|
expect(result).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('toChangedFilesMatchConfig', () => {
|
||||||
|
describe(`when there is no 'changed-files' key in the config`, () => {
|
||||||
|
const config = {'head-branch': 'test'};
|
||||||
|
|
||||||
|
it('returns an empty object', () => {
|
||||||
|
const result = toChangedFilesMatchConfig(config);
|
||||||
|
expect(result).toEqual<ChangedFilesMatchConfig>({});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe(`when there is a 'changed-files' key in the config`, () => {
|
||||||
|
describe('but the glob pattern config key is not provided', () => {
|
||||||
|
const config = {'changed-files': ['bar']};
|
||||||
|
|
||||||
|
it('throws the error', () => {
|
||||||
|
expect(() => {
|
||||||
|
toChangedFilesMatchConfig(config);
|
||||||
|
}).toThrow(
|
||||||
|
`The "changed-files" section must have a valid config structure. Please read the action documentation for more information`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('but the glob pattern config key is not valid', () => {
|
||||||
|
const config = {'changed-files': [{NotValidConfigKey: ['bar']}]};
|
||||||
|
|
||||||
|
it('throws the error', () => {
|
||||||
|
expect(() => {
|
||||||
|
toChangedFilesMatchConfig(config);
|
||||||
|
}).toThrow(
|
||||||
|
`Unknown config options were under "changed-files": NotValidConfigKey`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('and the glob pattern config key is provided', () => {
|
||||||
|
describe('and the value is an array of strings', () => {
|
||||||
|
const config = {'changed-files': [{AnyGlobToAnyFile: ['testing']}]};
|
||||||
|
|
||||||
|
it('sets the value in the config object', () => {
|
||||||
|
const result = toChangedFilesMatchConfig(config);
|
||||||
|
expect(result).toEqual<ChangedFilesMatchConfig>({
|
||||||
|
changedFiles: [{AnyGlobToAnyFile: ['testing']}]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('and the value is a string', () => {
|
||||||
|
const config = {'changed-files': [{AnyGlobToAnyFile: 'testing'}]};
|
||||||
|
|
||||||
|
it(`sets the string as an array in the config object`, () => {
|
||||||
|
const result = toChangedFilesMatchConfig(config);
|
||||||
|
expect(result).toEqual<ChangedFilesMatchConfig>({
|
||||||
|
changedFiles: [{AnyGlobToAnyFile: ['testing']}]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('checkIfAnyGlobMatchesAnyFile', () => {
|
||||||
|
const changedFiles = ['foo.txt', 'bar.txt'];
|
||||||
|
|
||||||
|
describe('when any given glob pattern matched any file', () => {
|
||||||
|
const globPatterns = ['*.md', 'foo.txt'];
|
||||||
|
|
||||||
|
it('returns true', () => {
|
||||||
|
const result = checkIfAnyGlobMatchesAnyFile(changedFiles, globPatterns);
|
||||||
|
expect(result).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when none of the given glob pattern matched any file', () => {
|
||||||
|
const globPatterns = ['*.md', '!*.txt'];
|
||||||
|
|
||||||
|
it('returns false', () => {
|
||||||
|
const result = checkIfAnyGlobMatchesAnyFile(changedFiles, globPatterns);
|
||||||
|
expect(result).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('checkIfAllGlobsMatchAnyFile', () => {
|
||||||
|
const changedFiles = ['foo.txt', 'bar.txt'];
|
||||||
|
|
||||||
|
describe('when all given glob patterns matched any file', () => {
|
||||||
|
const globPatterns = ['**/bar.txt', 'bar.txt'];
|
||||||
|
|
||||||
|
it('returns true', () => {
|
||||||
|
const result = checkIfAllGlobsMatchAnyFile(changedFiles, globPatterns);
|
||||||
|
expect(result).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when some of the given glob patterns did not match any file', () => {
|
||||||
|
const globPatterns = ['*.txt', '*.md'];
|
||||||
|
|
||||||
|
it('returns false', () => {
|
||||||
|
const result = checkIfAllGlobsMatchAnyFile(changedFiles, globPatterns);
|
||||||
|
expect(result).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('checkIfAnyGlobMatchesAllFiles', () => {
|
||||||
|
const changedFiles = ['foo.txt', 'bar.txt'];
|
||||||
|
|
||||||
|
describe('when any given glob pattern matched all files', () => {
|
||||||
|
const globPatterns = ['*.md', '*.txt'];
|
||||||
|
|
||||||
|
it('returns true', () => {
|
||||||
|
const result = checkIfAnyGlobMatchesAllFiles(changedFiles, globPatterns);
|
||||||
|
expect(result).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when none of the given glob patterns matched all files', () => {
|
||||||
|
const globPatterns = ['*.md', 'bar.txt', 'foo.txt'];
|
||||||
|
|
||||||
|
it('returns false', () => {
|
||||||
|
const result = checkIfAnyGlobMatchesAllFiles(changedFiles, globPatterns);
|
||||||
|
expect(result).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('checkIfAllGlobsMatchAllFiles', () => {
|
||||||
|
const changedFiles = ['foo.txt', 'bar.txt'];
|
||||||
|
|
||||||
|
describe('when all given glob patterns matched all files', () => {
|
||||||
|
const globPatterns = ['*.txt', '**'];
|
||||||
|
|
||||||
|
it('returns true', () => {
|
||||||
|
const result = checkIfAllGlobsMatchAllFiles(changedFiles, globPatterns);
|
||||||
|
expect(result).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when some of the given glob patterns did not match all files', () => {
|
||||||
|
const globPatterns = ['**', 'foo.txt'];
|
||||||
|
|
||||||
|
it('returns false', () => {
|
||||||
|
const result = checkIfAllGlobsMatchAllFiles(changedFiles, globPatterns);
|
||||||
|
expect(result).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
17
__tests__/fixtures/all_options.yml
Normal file
17
__tests__/fixtures/all_options.yml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
label1:
|
||||||
|
- any:
|
||||||
|
- changed-files:
|
||||||
|
- AnyGlobToAnyFile: ['glob']
|
||||||
|
- head-branch: ['regexp']
|
||||||
|
- base-branch: ['regexp']
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- AllGlobsToAllFiles: ['glob']
|
||||||
|
- head-branch: ['regexp']
|
||||||
|
- base-branch: ['regexp']
|
||||||
|
|
||||||
|
label2:
|
||||||
|
- changed-files:
|
||||||
|
- AnyGlobToAnyFile: ['glob']
|
||||||
|
- head-branch: ['regexp']
|
||||||
|
- base-branch: ['regexp']
|
||||||
8
__tests__/fixtures/any_and_all.yml
Normal file
8
__tests__/fixtures/any_and_all.yml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
tests:
|
||||||
|
- any:
|
||||||
|
- head-branch: ['^tests/', '^test/']
|
||||||
|
- changed-files:
|
||||||
|
- AnyGlobToAnyFile: ['tests/**/*']
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- AllGlobsToAllFiles: ['!tests/requirements.txt']
|
||||||
11
__tests__/fixtures/branches.yml
Normal file
11
__tests__/fixtures/branches.yml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
test-branch:
|
||||||
|
- head-branch: '^test/'
|
||||||
|
|
||||||
|
feature-branch:
|
||||||
|
- head-branch: '/feature/'
|
||||||
|
|
||||||
|
bug-branch:
|
||||||
|
- head-branch: '^bug/|fix/'
|
||||||
|
|
||||||
|
array-branch:
|
||||||
|
- head-branch: ['^array/']
|
||||||
3
__tests__/fixtures/not_supported.yml
Normal file
3
__tests__/fixtures/not_supported.yml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
label:
|
||||||
|
- all:
|
||||||
|
- unknown: 'this-is-not-supported'
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
touched-a-pdf-file:
|
touched-a-pdf-file:
|
||||||
- any: ['*.pdf']
|
- changed-files:
|
||||||
|
- AnyGlobToAnyFile: ['*.pdf']
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
import {checkGlobs} from '../src/labeler';
|
import {
|
||||||
|
checkMatchConfigs,
|
||||||
|
MatchConfig,
|
||||||
|
toMatchConfig,
|
||||||
|
getLabelConfigMapFromObject,
|
||||||
|
BaseMatchConfig
|
||||||
|
} from '../src/labeler';
|
||||||
|
import * as yaml from 'js-yaml';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
|
import * as fs from 'fs';
|
||||||
|
|
||||||
jest.mock('@actions/core');
|
jest.mock('@actions/core');
|
||||||
|
|
||||||
@@ -10,34 +17,131 @@ beforeAll(() => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const matchConfig = [{any: ['*.txt']}];
|
const loadYaml = (filepath: string) => {
|
||||||
|
const loadedFile = fs.readFileSync(filepath);
|
||||||
|
const content = Buffer.from(loadedFile).toString();
|
||||||
|
return yaml.load(content);
|
||||||
|
};
|
||||||
|
|
||||||
|
describe('getLabelConfigMapFromObject', () => {
|
||||||
|
const yamlObject = loadYaml('__tests__/fixtures/all_options.yml');
|
||||||
|
const expected = new Map<string, MatchConfig[]>();
|
||||||
|
expected.set('label1', [
|
||||||
|
{
|
||||||
|
any: [
|
||||||
|
{changedFiles: [{AnyGlobToAnyFile: ['glob']}]},
|
||||||
|
{baseBranch: undefined, headBranch: ['regexp']},
|
||||||
|
{baseBranch: ['regexp'], headBranch: undefined}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
all: [
|
||||||
|
{changedFiles: [{AllGlobsToAllFiles: ['glob']}]},
|
||||||
|
{baseBranch: undefined, headBranch: ['regexp']},
|
||||||
|
{baseBranch: ['regexp'], headBranch: undefined}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
expected.set('label2', [
|
||||||
|
{
|
||||||
|
any: [
|
||||||
|
{changedFiles: [{AnyGlobToAnyFile: ['glob']}]},
|
||||||
|
{baseBranch: undefined, headBranch: ['regexp']},
|
||||||
|
{baseBranch: ['regexp'], headBranch: undefined}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
it('returns a MatchConfig', () => {
|
||||||
|
const result = getLabelConfigMapFromObject(yamlObject);
|
||||||
|
expect(result).toEqual(expected);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('toMatchConfig', () => {
|
||||||
|
describe('when all expected config options are present', () => {
|
||||||
|
const config = {
|
||||||
|
'changed-files': [{AnyGlobToAnyFile: ['testing-files']}],
|
||||||
|
'head-branch': ['testing-head'],
|
||||||
|
'base-branch': ['testing-base']
|
||||||
|
};
|
||||||
|
const expected: BaseMatchConfig = {
|
||||||
|
changedFiles: [{AnyGlobToAnyFile: ['testing-files']}],
|
||||||
|
headBranch: ['testing-head'],
|
||||||
|
baseBranch: ['testing-base']
|
||||||
|
};
|
||||||
|
|
||||||
|
it('returns a MatchConfig object with all options', () => {
|
||||||
|
const result = toMatchConfig(config);
|
||||||
|
expect(result).toEqual(expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('and there are also unexpected options present', () => {
|
||||||
|
config['test-test'] = 'testing';
|
||||||
|
|
||||||
|
it('does not include the unexpected items in the returned MatchConfig object', () => {
|
||||||
|
const result = toMatchConfig(config);
|
||||||
|
expect(result).toEqual(expected);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('checkMatchConfigs', () => {
|
||||||
|
describe('when a single match config is provided', () => {
|
||||||
|
const matchConfig: MatchConfig[] = [
|
||||||
|
{any: [{changedFiles: [{AnyGlobToAnyFile: ['*.txt']}]}]}
|
||||||
|
];
|
||||||
|
|
||||||
describe('checkGlobs', () => {
|
|
||||||
it('returns true when our pattern does match changed files', () => {
|
it('returns true when our pattern does match changed files', () => {
|
||||||
const changedFiles = ['foo.txt', 'bar.txt'];
|
const changedFiles = ['foo.txt', 'bar.txt'];
|
||||||
const result = checkGlobs(changedFiles, matchConfig, false);
|
const result = checkMatchConfigs(changedFiles, matchConfig);
|
||||||
|
|
||||||
expect(result).toBeTruthy();
|
expect(result).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns false when our pattern does not match changed files', () => {
|
it('returns false when our pattern does not match changed files', () => {
|
||||||
const changedFiles = ['foo.docx'];
|
const changedFiles = ['foo.docx'];
|
||||||
const result = checkGlobs(changedFiles, matchConfig, false);
|
const result = checkMatchConfigs(changedFiles, matchConfig);
|
||||||
|
|
||||||
expect(result).toBeFalsy();
|
expect(result).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns false for a file starting with dot if `dot` option is false', () => {
|
it('returns true when either the branch or changed files patter matches', () => {
|
||||||
const changedFiles = ['.foo.txt'];
|
const matchConfig: MatchConfig[] = [
|
||||||
const result = checkGlobs(changedFiles, matchConfig, false);
|
{
|
||||||
|
any: [
|
||||||
|
{changedFiles: [{AnyGlobToAnyFile: ['*.txt']}]},
|
||||||
|
{headBranch: ['some-branch']}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
const changedFiles = ['foo.txt', 'bar.txt'];
|
||||||
|
|
||||||
expect(result).toBeFalsy();
|
const result = checkMatchConfigs(changedFiles, matchConfig);
|
||||||
});
|
expect(result).toBe(true);
|
||||||
|
});
|
||||||
it('returns true for a file starting with dot if `dot` option is true', () => {
|
});
|
||||||
const changedFiles = ['.foo.txt'];
|
|
||||||
const result = checkGlobs(changedFiles, matchConfig, true);
|
describe('when multiple MatchConfigs are supplied', () => {
|
||||||
|
const matchConfig: MatchConfig[] = [
|
||||||
expect(result).toBeTruthy();
|
{any: [{changedFiles: [{AnyGlobToAnyFile: ['*.txt']}]}]},
|
||||||
|
{any: [{headBranch: ['some-branch']}]}
|
||||||
|
];
|
||||||
|
const changedFiles = ['foo.txt', 'bar.md'];
|
||||||
|
|
||||||
|
it('returns false when only one config matches', () => {
|
||||||
|
const result = checkMatchConfigs(changedFiles, matchConfig);
|
||||||
|
expect(result).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns true when only both config matches', () => {
|
||||||
|
const matchConfig: MatchConfig[] = [
|
||||||
|
{any: [{changedFiles: [{AnyGlobToAnyFile: ['*.txt']}]}]},
|
||||||
|
{any: [{headBranch: ['head-branch']}]}
|
||||||
|
];
|
||||||
|
const result = checkMatchConfigs(changedFiles, matchConfig);
|
||||||
|
expect(result).toBe(true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,206 +8,201 @@ jest.mock('@actions/core');
|
|||||||
jest.mock('@actions/github');
|
jest.mock('@actions/github');
|
||||||
|
|
||||||
const gh = github.getOctokit('_');
|
const gh = github.getOctokit('_');
|
||||||
const setLabelsMock = jest.spyOn(gh.rest.issues, 'setLabels');
|
const addLabelsMock = jest.spyOn(gh.rest.issues, 'addLabels');
|
||||||
|
const removeLabelMock = jest.spyOn(gh.rest.issues, 'removeLabel');
|
||||||
const reposMock = jest.spyOn(gh.rest.repos, 'getContent');
|
const reposMock = jest.spyOn(gh.rest.repos, 'getContent');
|
||||||
const paginateMock = jest.spyOn(gh, 'paginate');
|
const paginateMock = jest.spyOn(gh, 'paginate');
|
||||||
const getPullMock = jest.spyOn(gh.rest.pulls, 'get');
|
const getPullMock = jest.spyOn(gh.rest.pulls, 'get');
|
||||||
const coreWarningMock = jest.spyOn(core, 'warning');
|
|
||||||
const setOutputSpy = jest.spyOn(core, 'setOutput');
|
|
||||||
|
|
||||||
const yamlFixtures = {
|
const yamlFixtures = {
|
||||||
'only_pdfs.yml': fs.readFileSync('__tests__/fixtures/only_pdfs.yml')
|
'branches.yml': fs.readFileSync('__tests__/fixtures/branches.yml'),
|
||||||
};
|
'only_pdfs.yml': fs.readFileSync('__tests__/fixtures/only_pdfs.yml'),
|
||||||
|
'not_supported.yml': fs.readFileSync('__tests__/fixtures/not_supported.yml'),
|
||||||
const configureInput = (
|
'any_and_all.yml': fs.readFileSync('__tests__/fixtures/any_and_all.yml')
|
||||||
mockInput: Partial<{
|
|
||||||
'repo-token': string;
|
|
||||||
'configuration-path': string;
|
|
||||||
'sync-labels': boolean;
|
|
||||||
dot: boolean;
|
|
||||||
}>
|
|
||||||
) => {
|
|
||||||
jest
|
|
||||||
.spyOn(core, 'getInput')
|
|
||||||
.mockImplementation((name: string, ...opts) => mockInput[name]);
|
|
||||||
jest
|
|
||||||
.spyOn(core, 'getBooleanInput')
|
|
||||||
.mockImplementation((name: string, ...opts) => mockInput[name]);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
afterAll(() => jest.restoreAllMocks());
|
afterAll(() => jest.restoreAllMocks());
|
||||||
|
|
||||||
describe('run', () => {
|
describe('run', () => {
|
||||||
it('(with dot: false) adds labels to PRs that match our glob patterns', async () => {
|
it('adds labels to PRs that match our glob patterns', async () => {
|
||||||
configureInput({});
|
|
||||||
usingLabelerConfigYaml('only_pdfs.yml');
|
usingLabelerConfigYaml('only_pdfs.yml');
|
||||||
mockGitHubResponseChangedFiles('foo.pdf');
|
mockGitHubResponseChangedFiles('foo.pdf');
|
||||||
getPullMock.mockResolvedValue(<any>{
|
|
||||||
data: {
|
|
||||||
labels: []
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
await run();
|
await run();
|
||||||
|
|
||||||
expect(setLabelsMock).toHaveBeenCalledTimes(1);
|
expect(removeLabelMock).toHaveBeenCalledTimes(0);
|
||||||
|
expect(addLabelsMock).toHaveBeenCalledTimes(1);
|
||||||
expect(setLabelsMock).toHaveBeenCalledWith({
|
expect(addLabelsMock).toHaveBeenCalledWith({
|
||||||
owner: 'monalisa',
|
owner: 'monalisa',
|
||||||
repo: 'helloworld',
|
repo: 'helloworld',
|
||||||
issue_number: 123,
|
issue_number: 123,
|
||||||
labels: ['touched-a-pdf-file']
|
labels: ['touched-a-pdf-file']
|
||||||
});
|
});
|
||||||
expect(setOutputSpy).toHaveBeenCalledWith(
|
|
||||||
'new-labels',
|
|
||||||
'touched-a-pdf-file'
|
|
||||||
);
|
|
||||||
expect(setOutputSpy).toHaveBeenCalledWith(
|
|
||||||
'all-labels',
|
|
||||||
'touched-a-pdf-file'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('(with dot: true) adds labels to PRs that match our glob patterns', async () => {
|
it('does not add labels to PRs that do not match our glob patterns', async () => {
|
||||||
configureInput({dot: true});
|
|
||||||
usingLabelerConfigYaml('only_pdfs.yml');
|
|
||||||
mockGitHubResponseChangedFiles('.foo.pdf');
|
|
||||||
getPullMock.mockResolvedValue(<any>{
|
|
||||||
data: {
|
|
||||||
labels: []
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
await run();
|
|
||||||
|
|
||||||
expect(setLabelsMock).toHaveBeenCalledTimes(1);
|
|
||||||
expect(setLabelsMock).toHaveBeenCalledWith({
|
|
||||||
owner: 'monalisa',
|
|
||||||
repo: 'helloworld',
|
|
||||||
issue_number: 123,
|
|
||||||
labels: ['touched-a-pdf-file']
|
|
||||||
});
|
|
||||||
expect(setOutputSpy).toHaveBeenCalledWith(
|
|
||||||
'new-labels',
|
|
||||||
'touched-a-pdf-file'
|
|
||||||
);
|
|
||||||
expect(setOutputSpy).toHaveBeenCalledWith(
|
|
||||||
'all-labels',
|
|
||||||
'touched-a-pdf-file'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('(with dot: false) does not add labels to PRs that do not match our glob patterns', async () => {
|
|
||||||
configureInput({});
|
|
||||||
usingLabelerConfigYaml('only_pdfs.yml');
|
|
||||||
mockGitHubResponseChangedFiles('.foo.pdf');
|
|
||||||
getPullMock.mockResolvedValue(<any>{
|
|
||||||
data: {
|
|
||||||
labels: []
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
await run();
|
|
||||||
|
|
||||||
expect(setLabelsMock).toHaveBeenCalledTimes(0);
|
|
||||||
expect(setOutputSpy).toHaveBeenCalledWith('new-labels', '');
|
|
||||||
expect(setOutputSpy).toHaveBeenCalledWith('all-labels', '');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('(with dot: true) does not add labels to PRs that do not match our glob patterns', async () => {
|
|
||||||
configureInput({dot: true});
|
|
||||||
usingLabelerConfigYaml('only_pdfs.yml');
|
usingLabelerConfigYaml('only_pdfs.yml');
|
||||||
mockGitHubResponseChangedFiles('foo.txt');
|
mockGitHubResponseChangedFiles('foo.txt');
|
||||||
|
|
||||||
await run();
|
await run();
|
||||||
|
|
||||||
expect(setLabelsMock).toHaveBeenCalledTimes(0);
|
expect(removeLabelMock).toHaveBeenCalledTimes(0);
|
||||||
|
expect(addLabelsMock).toHaveBeenCalledTimes(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('does not add a label when the match config options are not supported', async () => {
|
||||||
|
usingLabelerConfigYaml('not_supported.yml');
|
||||||
|
await run();
|
||||||
|
|
||||||
|
expect(addLabelsMock).toHaveBeenCalledTimes(0);
|
||||||
|
expect(removeLabelMock).toHaveBeenCalledTimes(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('(with sync-labels: true) it deletes preexisting PR labels that no longer match the glob pattern', async () => {
|
it('(with sync-labels: true) it deletes preexisting PR labels that no longer match the glob pattern', async () => {
|
||||||
configureInput({
|
const mockInput = {
|
||||||
'repo-token': 'foo',
|
'repo-token': 'foo',
|
||||||
'configuration-path': 'bar',
|
'configuration-path': 'bar',
|
||||||
'sync-labels': true
|
'sync-labels': 'true'
|
||||||
});
|
};
|
||||||
|
|
||||||
|
jest
|
||||||
|
.spyOn(core, 'getInput')
|
||||||
|
.mockImplementation((name: string, ...opts) => mockInput[name]);
|
||||||
|
jest
|
||||||
|
.spyOn(core, 'getBooleanInput')
|
||||||
|
.mockImplementation(
|
||||||
|
(name: string, ...opts) => mockInput[name] === 'true'
|
||||||
|
);
|
||||||
|
|
||||||
usingLabelerConfigYaml('only_pdfs.yml');
|
usingLabelerConfigYaml('only_pdfs.yml');
|
||||||
mockGitHubResponseChangedFiles('foo.txt');
|
mockGitHubResponseChangedFiles('foo.txt');
|
||||||
getPullMock.mockResolvedValue(<any>{
|
getPullMock.mockResolvedValue(<any>{
|
||||||
data: {
|
data: {
|
||||||
labels: [{name: 'touched-a-pdf-file'}, {name: 'manually-added'}]
|
labels: [{name: 'touched-a-pdf-file'}]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
await run();
|
await run();
|
||||||
|
|
||||||
expect(setLabelsMock).toHaveBeenCalledTimes(1);
|
expect(addLabelsMock).toHaveBeenCalledTimes(0);
|
||||||
expect(setLabelsMock).toHaveBeenCalledWith({
|
expect(removeLabelMock).toHaveBeenCalledTimes(1);
|
||||||
|
expect(removeLabelMock).toHaveBeenCalledWith({
|
||||||
owner: 'monalisa',
|
owner: 'monalisa',
|
||||||
repo: 'helloworld',
|
repo: 'helloworld',
|
||||||
issue_number: 123,
|
issue_number: 123,
|
||||||
labels: ['manually-added']
|
name: 'touched-a-pdf-file'
|
||||||
});
|
});
|
||||||
expect(setOutputSpy).toHaveBeenCalledWith('new-labels', '');
|
|
||||||
expect(setOutputSpy).toHaveBeenCalledWith('all-labels', 'manually-added');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('(with sync-labels: false) it issues no delete calls even when there are preexisting PR labels that no longer match the glob pattern', async () => {
|
it('(with sync-labels: false) it issues no delete calls even when there are preexisting PR labels that no longer match the glob pattern', async () => {
|
||||||
configureInput({
|
const mockInput = {
|
||||||
'repo-token': 'foo',
|
'repo-token': 'foo',
|
||||||
'configuration-path': 'bar',
|
'configuration-path': 'bar',
|
||||||
'sync-labels': false
|
'sync-labels': 'false'
|
||||||
});
|
};
|
||||||
|
|
||||||
|
jest
|
||||||
|
.spyOn(core, 'getInput')
|
||||||
|
.mockImplementation((name: string, ...opts) => mockInput[name]);
|
||||||
|
jest
|
||||||
|
.spyOn(core, 'getBooleanInput')
|
||||||
|
.mockImplementation(
|
||||||
|
(name: string, ...opts) => mockInput[name] === 'true'
|
||||||
|
);
|
||||||
|
|
||||||
usingLabelerConfigYaml('only_pdfs.yml');
|
usingLabelerConfigYaml('only_pdfs.yml');
|
||||||
mockGitHubResponseChangedFiles('foo.txt');
|
mockGitHubResponseChangedFiles('foo.txt');
|
||||||
getPullMock.mockResolvedValue(<any>{
|
getPullMock.mockResolvedValue(<any>{
|
||||||
data: {
|
data: {
|
||||||
labels: [{name: 'touched-a-pdf-file'}, {name: 'manually-added'}]
|
labels: [{name: 'touched-a-pdf-file'}]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
await run();
|
await run();
|
||||||
|
|
||||||
expect(setLabelsMock).toHaveBeenCalledTimes(0);
|
expect(addLabelsMock).toHaveBeenCalledTimes(0);
|
||||||
expect(setOutputSpy).toHaveBeenCalledWith('new-labels', '');
|
expect(removeLabelMock).toHaveBeenCalledTimes(0);
|
||||||
expect(setOutputSpy).toHaveBeenCalledWith(
|
|
||||||
'all-labels',
|
|
||||||
'touched-a-pdf-file,manually-added'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('(with sync-labels: false) it only logs the excess labels', async () => {
|
|
||||||
configureInput({
|
|
||||||
'repo-token': 'foo',
|
|
||||||
'configuration-path': 'bar',
|
|
||||||
'sync-labels': false
|
|
||||||
});
|
|
||||||
|
|
||||||
usingLabelerConfigYaml('only_pdfs.yml');
|
|
||||||
mockGitHubResponseChangedFiles('foo.pdf');
|
|
||||||
|
|
||||||
const existingLabels = Array.from({length: 100}).map((_, idx) => ({
|
|
||||||
name: `existing-label-${idx}`
|
|
||||||
}));
|
|
||||||
getPullMock.mockResolvedValue(<any>{
|
|
||||||
data: {
|
|
||||||
labels: existingLabels
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('adds labels based on the branch names that match the regexp pattern', async () => {
|
||||||
|
github.context.payload.pull_request!.head = {ref: 'test/testing-time'};
|
||||||
|
usingLabelerConfigYaml('branches.yml');
|
||||||
await run();
|
await run();
|
||||||
|
|
||||||
expect(setLabelsMock).toHaveBeenCalledTimes(0);
|
expect(addLabelsMock).toHaveBeenCalledTimes(1);
|
||||||
|
expect(addLabelsMock).toHaveBeenCalledWith({
|
||||||
|
owner: 'monalisa',
|
||||||
|
repo: 'helloworld',
|
||||||
|
issue_number: 123,
|
||||||
|
labels: ['test-branch']
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
expect(coreWarningMock).toHaveBeenCalledTimes(1);
|
it('adds multiple labels based on branch names that match different regexp patterns', async () => {
|
||||||
expect(coreWarningMock).toHaveBeenCalledWith(
|
github.context.payload.pull_request!.head = {
|
||||||
'Maximum of 100 labels allowed. Excess labels: touched-a-pdf-file',
|
ref: 'test/feature/123'
|
||||||
{title: 'Label limit for a PR exceeded'}
|
};
|
||||||
);
|
usingLabelerConfigYaml('branches.yml');
|
||||||
const allLabels: string = existingLabels.map(i => i.name).join(',');
|
await run();
|
||||||
expect(setOutputSpy).toHaveBeenCalledWith('new-labels', '');
|
|
||||||
expect(setOutputSpy).toHaveBeenCalledWith('all-labels', allLabels);
|
expect(addLabelsMock).toHaveBeenCalledTimes(1);
|
||||||
|
expect(addLabelsMock).toHaveBeenCalledWith({
|
||||||
|
owner: 'monalisa',
|
||||||
|
repo: 'helloworld',
|
||||||
|
issue_number: 123,
|
||||||
|
labels: ['test-branch', 'feature-branch']
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('can support multiple branches by batching', async () => {
|
||||||
|
github.context.payload.pull_request!.head = {ref: 'fix/123'};
|
||||||
|
usingLabelerConfigYaml('branches.yml');
|
||||||
|
await run();
|
||||||
|
|
||||||
|
expect(addLabelsMock).toHaveBeenCalledTimes(1);
|
||||||
|
expect(addLabelsMock).toHaveBeenCalledWith({
|
||||||
|
owner: 'monalisa',
|
||||||
|
repo: 'helloworld',
|
||||||
|
issue_number: 123,
|
||||||
|
labels: ['bug-branch']
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('can support multiple branches by providing an array', async () => {
|
||||||
|
github.context.payload.pull_request!.head = {ref: 'array/123'};
|
||||||
|
usingLabelerConfigYaml('branches.yml');
|
||||||
|
await run();
|
||||||
|
|
||||||
|
expect(addLabelsMock).toHaveBeenCalledTimes(1);
|
||||||
|
expect(addLabelsMock).toHaveBeenCalledWith({
|
||||||
|
owner: 'monalisa',
|
||||||
|
repo: 'helloworld',
|
||||||
|
issue_number: 123,
|
||||||
|
labels: ['array-branch']
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('adds a label when matching any and all patterns are provided', async () => {
|
||||||
|
usingLabelerConfigYaml('any_and_all.yml');
|
||||||
|
mockGitHubResponseChangedFiles('tests/test.ts');
|
||||||
|
await run();
|
||||||
|
|
||||||
|
expect(addLabelsMock).toHaveBeenCalledTimes(1);
|
||||||
|
expect(addLabelsMock).toHaveBeenCalledWith({
|
||||||
|
owner: 'monalisa',
|
||||||
|
repo: 'helloworld',
|
||||||
|
issue_number: 123,
|
||||||
|
labels: ['tests']
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('does not add a label when not all any and all patterns are matched', async () => {
|
||||||
|
usingLabelerConfigYaml('any_and_all.yml');
|
||||||
|
mockGitHubResponseChangedFiles('tests/requirements.txt');
|
||||||
|
await run();
|
||||||
|
|
||||||
|
expect(addLabelsMock).toHaveBeenCalledTimes(0);
|
||||||
|
expect(removeLabelMock).toHaveBeenCalledTimes(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -14,16 +14,7 @@ inputs:
|
|||||||
description: 'Whether or not to remove labels when matching files are reverted'
|
description: 'Whether or not to remove labels when matching files are reverted'
|
||||||
default: false
|
default: false
|
||||||
required: false
|
required: false
|
||||||
dot:
|
|
||||||
description: 'Whether or not to auto-include paths starting with dot (e.g. `.github`)'
|
|
||||||
default: false
|
|
||||||
required: false
|
|
||||||
|
|
||||||
outputs:
|
|
||||||
new-labels:
|
|
||||||
description: 'A comma-separated list of all new labels'
|
|
||||||
all-labels:
|
|
||||||
description: 'A comma-separated list of all labels that the PR contains'
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node16'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
|||||||
2372
dist/index.js
vendored
2372
dist/index.js
vendored
File diff suppressed because it is too large
Load Diff
497
package-lock.json
generated
497
package-lock.json
generated
@@ -1,17 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "labeler",
|
"name": "labeler",
|
||||||
"version": "4.1.0",
|
"version": "4.0.1",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "labeler",
|
"name": "labeler",
|
||||||
"version": "4.1.0",
|
"version": "4.0.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/github": "^5.1.1",
|
"@actions/github": "^5.1.1",
|
||||||
"@octokit/plugin-retry": "^5.0.4",
|
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"minimatch": "^7.4.3"
|
"minimatch": "^7.4.3"
|
||||||
},
|
},
|
||||||
@@ -20,13 +19,12 @@
|
|||||||
"@types/js-yaml": "^4.0.5",
|
"@types/js-yaml": "^4.0.5",
|
||||||
"@types/minimatch": "^5.1.2",
|
"@types/minimatch": "^5.1.2",
|
||||||
"@types/node": "^16.11.7",
|
"@types/node": "^16.11.7",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.60.1",
|
"@typescript-eslint/eslint-plugin": "^5.59.7",
|
||||||
"@typescript-eslint/parser": "^5.60.1",
|
"@typescript-eslint/parser": "^5.59.7",
|
||||||
"@vercel/ncc": "^0.36.1",
|
"@vercel/ncc": "^0.36.1",
|
||||||
"eslint": "^8.43.0",
|
"eslint": "^8.41.0",
|
||||||
"eslint-config-prettier": "^8.8.0",
|
"eslint-config-prettier": "^8.8.0",
|
||||||
"eslint-plugin-jest": "^27.2.2",
|
"eslint-plugin-jest": "^27.2.1",
|
||||||
"eslint-plugin-node": "^11.1.0",
|
|
||||||
"jest": "^27.5.1",
|
"jest": "^27.5.1",
|
||||||
"prettier": "^2.8.8",
|
"prettier": "^2.8.8",
|
||||||
"ts-jest": "^27.1.3",
|
"ts-jest": "^27.1.3",
|
||||||
@@ -722,18 +720,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@eslint/js": {
|
"node_modules/@eslint/js": {
|
||||||
"version": "8.43.0",
|
"version": "8.41.0",
|
||||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.43.0.tgz",
|
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.41.0.tgz",
|
||||||
"integrity": "sha512-s2UHCoiXfxMvmfzqoN+vrQ84ahUSYde9qNO1MdxmoEhyHWsfmwOpFlwYV+ePJEVc7gFnATGUi376WowX1N7tFg==",
|
"integrity": "sha512-LxcyMGxwmTh2lY9FwHPGWOHmYFCZvbrFCBZL4FzSSsxsRPuhrYUg/49/0KDfW8tnIEaEHtfmn6+NPN+1DqaNmA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@humanwhocodes/config-array": {
|
"node_modules/@humanwhocodes/config-array": {
|
||||||
"version": "0.11.10",
|
"version": "0.11.8",
|
||||||
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz",
|
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz",
|
||||||
"integrity": "sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==",
|
"integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@humanwhocodes/object-schema": "^1.2.1",
|
"@humanwhocodes/object-schema": "^1.2.1",
|
||||||
@@ -1224,48 +1222,6 @@
|
|||||||
"@octokit/core": ">=3"
|
"@octokit/core": ">=3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@octokit/plugin-retry": {
|
|
||||||
"version": "5.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-5.0.4.tgz",
|
|
||||||
"integrity": "sha512-hw00fDIhOgijy4aSxS6weWF5uqZVeoiC/AptLLyjL8KFCJRGRaXfcfgj76h/Z3cSLTjRsEIQnNCTig8INttL/g==",
|
|
||||||
"dependencies": {
|
|
||||||
"@octokit/request-error": "^4.0.1",
|
|
||||||
"@octokit/types": "^10.0.0",
|
|
||||||
"bottleneck": "^2.15.3"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 18"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"@octokit/core": ">=3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@octokit/plugin-retry/node_modules/@octokit/openapi-types": {
|
|
||||||
"version": "18.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-18.0.0.tgz",
|
|
||||||
"integrity": "sha512-V8GImKs3TeQRxRtXFpG2wl19V7444NIOTDF24AWuIbmNaNYOQMWRbjcGDXV5B+0n887fgDcuMNOmlul+k+oJtw=="
|
|
||||||
},
|
|
||||||
"node_modules/@octokit/plugin-retry/node_modules/@octokit/request-error": {
|
|
||||||
"version": "4.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-4.0.2.tgz",
|
|
||||||
"integrity": "sha512-uqwUEmZw3x4I9DGYq9fODVAAvcLsPQv97NRycP6syEFu5916M189VnNBW2zANNwqg3OiligNcAey7P0SET843w==",
|
|
||||||
"dependencies": {
|
|
||||||
"@octokit/types": "^10.0.0",
|
|
||||||
"deprecation": "^2.0.0",
|
|
||||||
"once": "^1.4.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 18"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@octokit/plugin-retry/node_modules/@octokit/types": {
|
|
||||||
"version": "10.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-10.0.0.tgz",
|
|
||||||
"integrity": "sha512-Vm8IddVmhCgU1fxC1eyinpwqzXPEYu0NrYzD3YZjlGjyftdLBTeqNblRC0jmJmgxbJIsQlyogVeGnrNaaMVzIg==",
|
|
||||||
"dependencies": {
|
|
||||||
"@octokit/openapi-types": "^18.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@octokit/request": {
|
"node_modules/@octokit/request": {
|
||||||
"version": "5.6.3",
|
"version": "5.6.3",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.3.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.3.tgz",
|
||||||
@@ -1466,15 +1422,15 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||||
"version": "5.60.1",
|
"version": "5.59.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.60.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.7.tgz",
|
||||||
"integrity": "sha512-KSWsVvsJsLJv3c4e73y/Bzt7OpqMCADUO846bHcuWYSYM19bldbAeDv7dYyV0jwkbMfJ2XdlzwjhXtuD7OY6bw==",
|
"integrity": "sha512-BL+jYxUFIbuYwy+4fF86k5vdT9lT0CNJ6HtwrIvGh0PhH8s0yy5rjaKH2fDCrz5ITHy07WCzVGNvAmjJh4IJFA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/regexpp": "^4.4.0",
|
"@eslint-community/regexpp": "^4.4.0",
|
||||||
"@typescript-eslint/scope-manager": "5.60.1",
|
"@typescript-eslint/scope-manager": "5.59.7",
|
||||||
"@typescript-eslint/type-utils": "5.60.1",
|
"@typescript-eslint/type-utils": "5.59.7",
|
||||||
"@typescript-eslint/utils": "5.60.1",
|
"@typescript-eslint/utils": "5.59.7",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"grapheme-splitter": "^1.0.4",
|
"grapheme-splitter": "^1.0.4",
|
||||||
"ignore": "^5.2.0",
|
"ignore": "^5.2.0",
|
||||||
@@ -1533,14 +1489,14 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/parser": {
|
"node_modules/@typescript-eslint/parser": {
|
||||||
"version": "5.60.1",
|
"version": "5.59.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.60.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.59.7.tgz",
|
||||||
"integrity": "sha512-pHWlc3alg2oSMGwsU/Is8hbm3XFbcrb6P5wIxcQW9NsYBfnrubl/GhVVD/Jm/t8HXhA2WncoIRfBtnCgRGV96Q==",
|
"integrity": "sha512-VhpsIEuq/8i5SF+mPg9jSdIwgMBBp0z9XqjiEay+81PYLJuroN+ET1hM5IhkiYMJd9MkTz8iJLt7aaGAgzWUbQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/scope-manager": "5.60.1",
|
"@typescript-eslint/scope-manager": "5.59.7",
|
||||||
"@typescript-eslint/types": "5.60.1",
|
"@typescript-eslint/types": "5.59.7",
|
||||||
"@typescript-eslint/typescript-estree": "5.60.1",
|
"@typescript-eslint/typescript-estree": "5.59.7",
|
||||||
"debug": "^4.3.4"
|
"debug": "^4.3.4"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -1560,13 +1516,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/scope-manager": {
|
"node_modules/@typescript-eslint/scope-manager": {
|
||||||
"version": "5.60.1",
|
"version": "5.59.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.60.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.7.tgz",
|
||||||
"integrity": "sha512-Dn/LnN7fEoRD+KspEOV0xDMynEmR3iSHdgNsarlXNLGGtcUok8L4N71dxUgt3YvlO8si7E+BJ5Fe3wb5yUw7DQ==",
|
"integrity": "sha512-FL6hkYWK9zBGdxT2wWEd2W8ocXMu3K94i3gvMrjXpx+koFYdYV7KprKfirpgY34vTGzEPPuKoERpP8kD5h7vZQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "5.60.1",
|
"@typescript-eslint/types": "5.59.7",
|
||||||
"@typescript-eslint/visitor-keys": "5.60.1"
|
"@typescript-eslint/visitor-keys": "5.59.7"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||||
@@ -1577,13 +1533,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/type-utils": {
|
"node_modules/@typescript-eslint/type-utils": {
|
||||||
"version": "5.60.1",
|
"version": "5.59.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.60.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.59.7.tgz",
|
||||||
"integrity": "sha512-vN6UztYqIu05nu7JqwQGzQKUJctzs3/Hg7E2Yx8rz9J+4LgtIDFWjjl1gm3pycH0P3mHAcEUBd23LVgfrsTR8A==",
|
"integrity": "sha512-ozuz/GILuYG7osdY5O5yg0QxXUAEoI4Go3Do5xeu+ERH9PorHBPSdvD3Tjp2NN2bNLh1NJQSsQu2TPu/Ly+HaQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/typescript-estree": "5.60.1",
|
"@typescript-eslint/typescript-estree": "5.59.7",
|
||||||
"@typescript-eslint/utils": "5.60.1",
|
"@typescript-eslint/utils": "5.59.7",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"tsutils": "^3.21.0"
|
"tsutils": "^3.21.0"
|
||||||
},
|
},
|
||||||
@@ -1604,9 +1560,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/types": {
|
"node_modules/@typescript-eslint/types": {
|
||||||
"version": "5.60.1",
|
"version": "5.59.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.60.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.7.tgz",
|
||||||
"integrity": "sha512-zDcDx5fccU8BA0IDZc71bAtYIcG9PowaOwaD8rjYbqwK7dpe/UMQl3inJ4UtUK42nOCT41jTSCwg76E62JpMcg==",
|
"integrity": "sha512-UnVS2MRRg6p7xOSATscWkKjlf/NDKuqo5TdbWck6rIRZbmKpVNTLALzNvcjIfHBE7736kZOFc/4Z3VcZwuOM/A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||||
@@ -1617,13 +1573,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/typescript-estree": {
|
"node_modules/@typescript-eslint/typescript-estree": {
|
||||||
"version": "5.60.1",
|
"version": "5.59.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.60.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.7.tgz",
|
||||||
"integrity": "sha512-hkX70J9+2M2ZT6fhti5Q2FoU9zb+GeZK2SLP1WZlvUDqdMbEKhexZODD1WodNRyO8eS+4nScvT0dts8IdaBzfw==",
|
"integrity": "sha512-4A1NtZ1I3wMN2UGDkU9HMBL+TIQfbrh4uS0WDMMpf3xMRursDbqEf1ahh6vAAe3mObt8k3ZATnezwG4pdtWuUQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "5.60.1",
|
"@typescript-eslint/types": "5.59.7",
|
||||||
"@typescript-eslint/visitor-keys": "5.60.1",
|
"@typescript-eslint/visitor-keys": "5.59.7",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"globby": "^11.1.0",
|
"globby": "^11.1.0",
|
||||||
"is-glob": "^4.0.3",
|
"is-glob": "^4.0.3",
|
||||||
@@ -1656,9 +1612,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/typescript-estree/node_modules/semver": {
|
"node_modules/@typescript-eslint/typescript-estree/node_modules/semver": {
|
||||||
"version": "7.5.3",
|
"version": "7.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz",
|
||||||
"integrity": "sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==",
|
"integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lru-cache": "^6.0.0"
|
"lru-cache": "^6.0.0"
|
||||||
@@ -1677,17 +1633,17 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/utils": {
|
"node_modules/@typescript-eslint/utils": {
|
||||||
"version": "5.60.1",
|
"version": "5.59.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.60.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.59.7.tgz",
|
||||||
"integrity": "sha512-tiJ7FFdFQOWssFa3gqb94Ilexyw0JVxj6vBzaSpfN/8IhoKkDuSAenUKvsSHw2A/TMpJb26izIszTXaqygkvpQ==",
|
"integrity": "sha512-yCX9WpdQKaLufz5luG4aJbOpdXf/fjwGMcLFXZVPUz3QqLirG5QcwwnIHNf8cjLjxK4qtzTO8udUtMQSAToQnQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/eslint-utils": "^4.2.0",
|
"@eslint-community/eslint-utils": "^4.2.0",
|
||||||
"@types/json-schema": "^7.0.9",
|
"@types/json-schema": "^7.0.9",
|
||||||
"@types/semver": "^7.3.12",
|
"@types/semver": "^7.3.12",
|
||||||
"@typescript-eslint/scope-manager": "5.60.1",
|
"@typescript-eslint/scope-manager": "5.59.7",
|
||||||
"@typescript-eslint/types": "5.60.1",
|
"@typescript-eslint/types": "5.59.7",
|
||||||
"@typescript-eslint/typescript-estree": "5.60.1",
|
"@typescript-eslint/typescript-estree": "5.59.7",
|
||||||
"eslint-scope": "^5.1.1",
|
"eslint-scope": "^5.1.1",
|
||||||
"semver": "^7.3.7"
|
"semver": "^7.3.7"
|
||||||
},
|
},
|
||||||
@@ -1736,12 +1692,12 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/visitor-keys": {
|
"node_modules/@typescript-eslint/visitor-keys": {
|
||||||
"version": "5.60.1",
|
"version": "5.59.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.60.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.7.tgz",
|
||||||
"integrity": "sha512-xEYIxKcultP6E/RMKqube11pGjXH1DCo60mQoWhVYyKfLkwbIVVjYxmOenNMxILx0TjCujPTjjnTIVzm09TXIw==",
|
"integrity": "sha512-tyN+X2jvMslUszIiYbF0ZleP+RqQsFVpGrKI6e0Eet1w8WmhsAtmzaqm8oM8WJQ1ysLwhnsK/4hYHJjOgJVfQQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "5.60.1",
|
"@typescript-eslint/types": "5.59.7",
|
||||||
"eslint-visitor-keys": "^3.3.0"
|
"eslint-visitor-keys": "^3.3.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -2021,11 +1977,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz",
|
||||||
"integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ=="
|
"integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ=="
|
||||||
},
|
},
|
||||||
"node_modules/bottleneck": {
|
|
||||||
"version": "2.19.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz",
|
|
||||||
"integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw=="
|
|
||||||
},
|
|
||||||
"node_modules/brace-expansion": {
|
"node_modules/brace-expansion": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
|
||||||
@@ -2503,16 +2454,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/eslint": {
|
"node_modules/eslint": {
|
||||||
"version": "8.43.0",
|
"version": "8.41.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.43.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.41.0.tgz",
|
||||||
"integrity": "sha512-aaCpf2JqqKesMFGgmRPessmVKjcGXqdlAYLLC3THM8t5nBRZRQ+st5WM/hoJXkdioEXLLbXgclUpM0TXo5HX5Q==",
|
"integrity": "sha512-WQDQpzGBOP5IrXPo4Hc0814r4/v2rrIsB0rhT7jtunIalgg6gYXWhRMOejVO8yH21T/FGaxjmFjBMNqcIlmH1Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/eslint-utils": "^4.2.0",
|
"@eslint-community/eslint-utils": "^4.2.0",
|
||||||
"@eslint-community/regexpp": "^4.4.0",
|
"@eslint-community/regexpp": "^4.4.0",
|
||||||
"@eslint/eslintrc": "^2.0.3",
|
"@eslint/eslintrc": "^2.0.3",
|
||||||
"@eslint/js": "8.43.0",
|
"@eslint/js": "8.41.0",
|
||||||
"@humanwhocodes/config-array": "^0.11.10",
|
"@humanwhocodes/config-array": "^0.11.8",
|
||||||
"@humanwhocodes/module-importer": "^1.0.1",
|
"@humanwhocodes/module-importer": "^1.0.1",
|
||||||
"@nodelib/fs.walk": "^1.2.8",
|
"@nodelib/fs.walk": "^1.2.8",
|
||||||
"ajv": "^6.10.0",
|
"ajv": "^6.10.0",
|
||||||
@@ -2570,29 +2521,10 @@
|
|||||||
"eslint": ">=7.0.0"
|
"eslint": ">=7.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/eslint-plugin-es": {
|
|
||||||
"version": "3.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz",
|
|
||||||
"integrity": "sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"eslint-utils": "^2.0.0",
|
|
||||||
"regexpp": "^3.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8.10.0"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/mysticatea"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"eslint": ">=4.19.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/eslint-plugin-jest": {
|
"node_modules/eslint-plugin-jest": {
|
||||||
"version": "27.2.2",
|
"version": "27.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.2.1.tgz",
|
||||||
"integrity": "sha512-euzbp06F934Z7UDl5ZUaRPLAc9MKjh0rMPERrHT7UhlCEwgb25kBj37TvMgWeHZVkR5I9CayswrpoaqZU1RImw==",
|
"integrity": "sha512-l067Uxx7ZT8cO9NJuf+eJHvt6bqJyz2Z29wykyEdz/OtmcELQl2MQGQLX8J94O1cSJWAwUSEvCjwjA7KEK3Hmg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/utils": "^5.10.0"
|
"@typescript-eslint/utils": "^5.10.0"
|
||||||
@@ -2602,8 +2534,7 @@
|
|||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
||||||
"eslint": "^7.0.0 || ^8.0.0",
|
"eslint": "^7.0.0 || ^8.0.0"
|
||||||
"jest": "*"
|
|
||||||
},
|
},
|
||||||
"peerDependenciesMeta": {
|
"peerDependenciesMeta": {
|
||||||
"@typescript-eslint/eslint-plugin": {
|
"@typescript-eslint/eslint-plugin": {
|
||||||
@@ -2614,48 +2545,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/eslint-plugin-node": {
|
|
||||||
"version": "11.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz",
|
|
||||||
"integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"eslint-plugin-es": "^3.0.0",
|
|
||||||
"eslint-utils": "^2.0.0",
|
|
||||||
"ignore": "^5.1.1",
|
|
||||||
"minimatch": "^3.0.4",
|
|
||||||
"resolve": "^1.10.1",
|
|
||||||
"semver": "^6.1.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8.10.0"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"eslint": ">=5.16.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/eslint-plugin-node/node_modules/brace-expansion": {
|
|
||||||
"version": "1.1.11",
|
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
|
||||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"balanced-match": "^1.0.0",
|
|
||||||
"concat-map": "0.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/eslint-plugin-node/node_modules/minimatch": {
|
|
||||||
"version": "3.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
|
||||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"brace-expansion": "^1.1.7"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/eslint-scope": {
|
"node_modules/eslint-scope": {
|
||||||
"version": "5.1.1",
|
"version": "5.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
|
||||||
@@ -2678,30 +2567,6 @@
|
|||||||
"node": ">=4.0"
|
"node": ">=4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/eslint-utils": {
|
|
||||||
"version": "2.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz",
|
|
||||||
"integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"eslint-visitor-keys": "^1.1.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/mysticatea"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/eslint-utils/node_modules/eslint-visitor-keys": {
|
|
||||||
"version": "1.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz",
|
|
||||||
"integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/eslint-visitor-keys": {
|
"node_modules/eslint-visitor-keys": {
|
||||||
"version": "3.4.1",
|
"version": "3.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz",
|
||||||
@@ -4993,18 +4858,6 @@
|
|||||||
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
|
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/regexpp": {
|
|
||||||
"version": "3.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz",
|
|
||||||
"integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/mysticatea"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/require-directory": {
|
"node_modules/require-directory": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
||||||
@@ -6440,15 +6293,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@eslint/js": {
|
"@eslint/js": {
|
||||||
"version": "8.43.0",
|
"version": "8.41.0",
|
||||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.43.0.tgz",
|
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.41.0.tgz",
|
||||||
"integrity": "sha512-s2UHCoiXfxMvmfzqoN+vrQ84ahUSYde9qNO1MdxmoEhyHWsfmwOpFlwYV+ePJEVc7gFnATGUi376WowX1N7tFg==",
|
"integrity": "sha512-LxcyMGxwmTh2lY9FwHPGWOHmYFCZvbrFCBZL4FzSSsxsRPuhrYUg/49/0KDfW8tnIEaEHtfmn6+NPN+1DqaNmA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@humanwhocodes/config-array": {
|
"@humanwhocodes/config-array": {
|
||||||
"version": "0.11.10",
|
"version": "0.11.8",
|
||||||
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz",
|
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz",
|
||||||
"integrity": "sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==",
|
"integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@humanwhocodes/object-schema": "^1.2.1",
|
"@humanwhocodes/object-schema": "^1.2.1",
|
||||||
@@ -6848,41 +6701,6 @@
|
|||||||
"deprecation": "^2.3.1"
|
"deprecation": "^2.3.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@octokit/plugin-retry": {
|
|
||||||
"version": "5.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-5.0.4.tgz",
|
|
||||||
"integrity": "sha512-hw00fDIhOgijy4aSxS6weWF5uqZVeoiC/AptLLyjL8KFCJRGRaXfcfgj76h/Z3cSLTjRsEIQnNCTig8INttL/g==",
|
|
||||||
"requires": {
|
|
||||||
"@octokit/request-error": "^4.0.1",
|
|
||||||
"@octokit/types": "^10.0.0",
|
|
||||||
"bottleneck": "^2.15.3"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@octokit/openapi-types": {
|
|
||||||
"version": "18.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-18.0.0.tgz",
|
|
||||||
"integrity": "sha512-V8GImKs3TeQRxRtXFpG2wl19V7444NIOTDF24AWuIbmNaNYOQMWRbjcGDXV5B+0n887fgDcuMNOmlul+k+oJtw=="
|
|
||||||
},
|
|
||||||
"@octokit/request-error": {
|
|
||||||
"version": "4.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-4.0.2.tgz",
|
|
||||||
"integrity": "sha512-uqwUEmZw3x4I9DGYq9fODVAAvcLsPQv97NRycP6syEFu5916M189VnNBW2zANNwqg3OiligNcAey7P0SET843w==",
|
|
||||||
"requires": {
|
|
||||||
"@octokit/types": "^10.0.0",
|
|
||||||
"deprecation": "^2.0.0",
|
|
||||||
"once": "^1.4.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@octokit/types": {
|
|
||||||
"version": "10.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-10.0.0.tgz",
|
|
||||||
"integrity": "sha512-Vm8IddVmhCgU1fxC1eyinpwqzXPEYu0NrYzD3YZjlGjyftdLBTeqNblRC0jmJmgxbJIsQlyogVeGnrNaaMVzIg==",
|
|
||||||
"requires": {
|
|
||||||
"@octokit/openapi-types": "^18.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@octokit/request": {
|
"@octokit/request": {
|
||||||
"version": "5.6.3",
|
"version": "5.6.3",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.3.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.3.tgz",
|
||||||
@@ -7080,15 +6898,15 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@typescript-eslint/eslint-plugin": {
|
"@typescript-eslint/eslint-plugin": {
|
||||||
"version": "5.60.1",
|
"version": "5.59.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.60.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.7.tgz",
|
||||||
"integrity": "sha512-KSWsVvsJsLJv3c4e73y/Bzt7OpqMCADUO846bHcuWYSYM19bldbAeDv7dYyV0jwkbMfJ2XdlzwjhXtuD7OY6bw==",
|
"integrity": "sha512-BL+jYxUFIbuYwy+4fF86k5vdT9lT0CNJ6HtwrIvGh0PhH8s0yy5rjaKH2fDCrz5ITHy07WCzVGNvAmjJh4IJFA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@eslint-community/regexpp": "^4.4.0",
|
"@eslint-community/regexpp": "^4.4.0",
|
||||||
"@typescript-eslint/scope-manager": "5.60.1",
|
"@typescript-eslint/scope-manager": "5.59.7",
|
||||||
"@typescript-eslint/type-utils": "5.60.1",
|
"@typescript-eslint/type-utils": "5.59.7",
|
||||||
"@typescript-eslint/utils": "5.60.1",
|
"@typescript-eslint/utils": "5.59.7",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"grapheme-splitter": "^1.0.4",
|
"grapheme-splitter": "^1.0.4",
|
||||||
"ignore": "^5.2.0",
|
"ignore": "^5.2.0",
|
||||||
@@ -7124,53 +6942,53 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/parser": {
|
"@typescript-eslint/parser": {
|
||||||
"version": "5.60.1",
|
"version": "5.59.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.60.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.59.7.tgz",
|
||||||
"integrity": "sha512-pHWlc3alg2oSMGwsU/Is8hbm3XFbcrb6P5wIxcQW9NsYBfnrubl/GhVVD/Jm/t8HXhA2WncoIRfBtnCgRGV96Q==",
|
"integrity": "sha512-VhpsIEuq/8i5SF+mPg9jSdIwgMBBp0z9XqjiEay+81PYLJuroN+ET1hM5IhkiYMJd9MkTz8iJLt7aaGAgzWUbQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/scope-manager": "5.60.1",
|
"@typescript-eslint/scope-manager": "5.59.7",
|
||||||
"@typescript-eslint/types": "5.60.1",
|
"@typescript-eslint/types": "5.59.7",
|
||||||
"@typescript-eslint/typescript-estree": "5.60.1",
|
"@typescript-eslint/typescript-estree": "5.59.7",
|
||||||
"debug": "^4.3.4"
|
"debug": "^4.3.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/scope-manager": {
|
"@typescript-eslint/scope-manager": {
|
||||||
"version": "5.60.1",
|
"version": "5.59.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.60.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.7.tgz",
|
||||||
"integrity": "sha512-Dn/LnN7fEoRD+KspEOV0xDMynEmR3iSHdgNsarlXNLGGtcUok8L4N71dxUgt3YvlO8si7E+BJ5Fe3wb5yUw7DQ==",
|
"integrity": "sha512-FL6hkYWK9zBGdxT2wWEd2W8ocXMu3K94i3gvMrjXpx+koFYdYV7KprKfirpgY34vTGzEPPuKoERpP8kD5h7vZQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/types": "5.60.1",
|
"@typescript-eslint/types": "5.59.7",
|
||||||
"@typescript-eslint/visitor-keys": "5.60.1"
|
"@typescript-eslint/visitor-keys": "5.59.7"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/type-utils": {
|
"@typescript-eslint/type-utils": {
|
||||||
"version": "5.60.1",
|
"version": "5.59.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.60.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.59.7.tgz",
|
||||||
"integrity": "sha512-vN6UztYqIu05nu7JqwQGzQKUJctzs3/Hg7E2Yx8rz9J+4LgtIDFWjjl1gm3pycH0P3mHAcEUBd23LVgfrsTR8A==",
|
"integrity": "sha512-ozuz/GILuYG7osdY5O5yg0QxXUAEoI4Go3Do5xeu+ERH9PorHBPSdvD3Tjp2NN2bNLh1NJQSsQu2TPu/Ly+HaQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/typescript-estree": "5.60.1",
|
"@typescript-eslint/typescript-estree": "5.59.7",
|
||||||
"@typescript-eslint/utils": "5.60.1",
|
"@typescript-eslint/utils": "5.59.7",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"tsutils": "^3.21.0"
|
"tsutils": "^3.21.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/types": {
|
"@typescript-eslint/types": {
|
||||||
"version": "5.60.1",
|
"version": "5.59.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.60.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.7.tgz",
|
||||||
"integrity": "sha512-zDcDx5fccU8BA0IDZc71bAtYIcG9PowaOwaD8rjYbqwK7dpe/UMQl3inJ4UtUK42nOCT41jTSCwg76E62JpMcg==",
|
"integrity": "sha512-UnVS2MRRg6p7xOSATscWkKjlf/NDKuqo5TdbWck6rIRZbmKpVNTLALzNvcjIfHBE7736kZOFc/4Z3VcZwuOM/A==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@typescript-eslint/typescript-estree": {
|
"@typescript-eslint/typescript-estree": {
|
||||||
"version": "5.60.1",
|
"version": "5.59.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.60.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.7.tgz",
|
||||||
"integrity": "sha512-hkX70J9+2M2ZT6fhti5Q2FoU9zb+GeZK2SLP1WZlvUDqdMbEKhexZODD1WodNRyO8eS+4nScvT0dts8IdaBzfw==",
|
"integrity": "sha512-4A1NtZ1I3wMN2UGDkU9HMBL+TIQfbrh4uS0WDMMpf3xMRursDbqEf1ahh6vAAe3mObt8k3ZATnezwG4pdtWuUQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/types": "5.60.1",
|
"@typescript-eslint/types": "5.59.7",
|
||||||
"@typescript-eslint/visitor-keys": "5.60.1",
|
"@typescript-eslint/visitor-keys": "5.59.7",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"globby": "^11.1.0",
|
"globby": "^11.1.0",
|
||||||
"is-glob": "^4.0.3",
|
"is-glob": "^4.0.3",
|
||||||
@@ -7188,9 +7006,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"semver": {
|
"semver": {
|
||||||
"version": "7.5.3",
|
"version": "7.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz",
|
||||||
"integrity": "sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==",
|
"integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"lru-cache": "^6.0.0"
|
"lru-cache": "^6.0.0"
|
||||||
@@ -7205,17 +7023,17 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/utils": {
|
"@typescript-eslint/utils": {
|
||||||
"version": "5.60.1",
|
"version": "5.59.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.60.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.59.7.tgz",
|
||||||
"integrity": "sha512-tiJ7FFdFQOWssFa3gqb94Ilexyw0JVxj6vBzaSpfN/8IhoKkDuSAenUKvsSHw2A/TMpJb26izIszTXaqygkvpQ==",
|
"integrity": "sha512-yCX9WpdQKaLufz5luG4aJbOpdXf/fjwGMcLFXZVPUz3QqLirG5QcwwnIHNf8cjLjxK4qtzTO8udUtMQSAToQnQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@eslint-community/eslint-utils": "^4.2.0",
|
"@eslint-community/eslint-utils": "^4.2.0",
|
||||||
"@types/json-schema": "^7.0.9",
|
"@types/json-schema": "^7.0.9",
|
||||||
"@types/semver": "^7.3.12",
|
"@types/semver": "^7.3.12",
|
||||||
"@typescript-eslint/scope-manager": "5.60.1",
|
"@typescript-eslint/scope-manager": "5.59.7",
|
||||||
"@typescript-eslint/types": "5.60.1",
|
"@typescript-eslint/types": "5.59.7",
|
||||||
"@typescript-eslint/typescript-estree": "5.60.1",
|
"@typescript-eslint/typescript-estree": "5.59.7",
|
||||||
"eslint-scope": "^5.1.1",
|
"eslint-scope": "^5.1.1",
|
||||||
"semver": "^7.3.7"
|
"semver": "^7.3.7"
|
||||||
},
|
},
|
||||||
@@ -7247,12 +7065,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/visitor-keys": {
|
"@typescript-eslint/visitor-keys": {
|
||||||
"version": "5.60.1",
|
"version": "5.59.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.60.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.7.tgz",
|
||||||
"integrity": "sha512-xEYIxKcultP6E/RMKqube11pGjXH1DCo60mQoWhVYyKfLkwbIVVjYxmOenNMxILx0TjCujPTjjnTIVzm09TXIw==",
|
"integrity": "sha512-tyN+X2jvMslUszIiYbF0ZleP+RqQsFVpGrKI6e0Eet1w8WmhsAtmzaqm8oM8WJQ1ysLwhnsK/4hYHJjOgJVfQQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/types": "5.60.1",
|
"@typescript-eslint/types": "5.59.7",
|
||||||
"eslint-visitor-keys": "^3.3.0"
|
"eslint-visitor-keys": "^3.3.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -7458,11 +7276,6 @@
|
|||||||
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz",
|
||||||
"integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ=="
|
"integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ=="
|
||||||
},
|
},
|
||||||
"bottleneck": {
|
|
||||||
"version": "2.19.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz",
|
|
||||||
"integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw=="
|
|
||||||
},
|
|
||||||
"brace-expansion": {
|
"brace-expansion": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
|
||||||
@@ -7816,16 +7629,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"eslint": {
|
"eslint": {
|
||||||
"version": "8.43.0",
|
"version": "8.41.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.43.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.41.0.tgz",
|
||||||
"integrity": "sha512-aaCpf2JqqKesMFGgmRPessmVKjcGXqdlAYLLC3THM8t5nBRZRQ+st5WM/hoJXkdioEXLLbXgclUpM0TXo5HX5Q==",
|
"integrity": "sha512-WQDQpzGBOP5IrXPo4Hc0814r4/v2rrIsB0rhT7jtunIalgg6gYXWhRMOejVO8yH21T/FGaxjmFjBMNqcIlmH1Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@eslint-community/eslint-utils": "^4.2.0",
|
"@eslint-community/eslint-utils": "^4.2.0",
|
||||||
"@eslint-community/regexpp": "^4.4.0",
|
"@eslint-community/regexpp": "^4.4.0",
|
||||||
"@eslint/eslintrc": "^2.0.3",
|
"@eslint/eslintrc": "^2.0.3",
|
||||||
"@eslint/js": "8.43.0",
|
"@eslint/js": "8.41.0",
|
||||||
"@humanwhocodes/config-array": "^0.11.10",
|
"@humanwhocodes/config-array": "^0.11.8",
|
||||||
"@humanwhocodes/module-importer": "^1.0.1",
|
"@humanwhocodes/module-importer": "^1.0.1",
|
||||||
"@nodelib/fs.walk": "^1.2.8",
|
"@nodelib/fs.walk": "^1.2.8",
|
||||||
"ajv": "^6.10.0",
|
"ajv": "^6.10.0",
|
||||||
@@ -7997,60 +7810,15 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {}
|
"requires": {}
|
||||||
},
|
},
|
||||||
"eslint-plugin-es": {
|
|
||||||
"version": "3.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz",
|
|
||||||
"integrity": "sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"eslint-utils": "^2.0.0",
|
|
||||||
"regexpp": "^3.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"eslint-plugin-jest": {
|
"eslint-plugin-jest": {
|
||||||
"version": "27.2.2",
|
"version": "27.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.2.1.tgz",
|
||||||
"integrity": "sha512-euzbp06F934Z7UDl5ZUaRPLAc9MKjh0rMPERrHT7UhlCEwgb25kBj37TvMgWeHZVkR5I9CayswrpoaqZU1RImw==",
|
"integrity": "sha512-l067Uxx7ZT8cO9NJuf+eJHvt6bqJyz2Z29wykyEdz/OtmcELQl2MQGQLX8J94O1cSJWAwUSEvCjwjA7KEK3Hmg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/utils": "^5.10.0"
|
"@typescript-eslint/utils": "^5.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"eslint-plugin-node": {
|
|
||||||
"version": "11.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz",
|
|
||||||
"integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"eslint-plugin-es": "^3.0.0",
|
|
||||||
"eslint-utils": "^2.0.0",
|
|
||||||
"ignore": "^5.1.1",
|
|
||||||
"minimatch": "^3.0.4",
|
|
||||||
"resolve": "^1.10.1",
|
|
||||||
"semver": "^6.1.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"brace-expansion": {
|
|
||||||
"version": "1.1.11",
|
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
|
||||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"balanced-match": "^1.0.0",
|
|
||||||
"concat-map": "0.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"minimatch": {
|
|
||||||
"version": "3.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
|
||||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"brace-expansion": "^1.1.7"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"eslint-scope": {
|
"eslint-scope": {
|
||||||
"version": "5.1.1",
|
"version": "5.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
|
||||||
@@ -8069,23 +7837,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"eslint-utils": {
|
|
||||||
"version": "2.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz",
|
|
||||||
"integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"eslint-visitor-keys": "^1.1.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"eslint-visitor-keys": {
|
|
||||||
"version": "1.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz",
|
|
||||||
"integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==",
|
|
||||||
"dev": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"eslint-visitor-keys": {
|
"eslint-visitor-keys": {
|
||||||
"version": "3.4.1",
|
"version": "3.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz",
|
||||||
@@ -9683,12 +9434,6 @@
|
|||||||
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
|
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"regexpp": {
|
|
||||||
"version": "3.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz",
|
|
||||||
"integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"require-directory": {
|
"require-directory": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
||||||
|
|||||||
12
package.json
12
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "labeler",
|
"name": "labeler",
|
||||||
"version": "4.1.0",
|
"version": "4.0.1",
|
||||||
"description": "Labels pull requests by files altered",
|
"description": "Labels pull requests by files altered",
|
||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -26,7 +26,6 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/github": "^5.1.1",
|
"@actions/github": "^5.1.1",
|
||||||
"@octokit/plugin-retry": "^5.0.4",
|
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"minimatch": "^7.4.3"
|
"minimatch": "^7.4.3"
|
||||||
},
|
},
|
||||||
@@ -35,13 +34,12 @@
|
|||||||
"@types/js-yaml": "^4.0.5",
|
"@types/js-yaml": "^4.0.5",
|
||||||
"@types/minimatch": "^5.1.2",
|
"@types/minimatch": "^5.1.2",
|
||||||
"@types/node": "^16.11.7",
|
"@types/node": "^16.11.7",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.60.1",
|
"@typescript-eslint/eslint-plugin": "^5.59.7",
|
||||||
"@typescript-eslint/parser": "^5.60.1",
|
"@typescript-eslint/parser": "^5.59.7",
|
||||||
"@vercel/ncc": "^0.36.1",
|
"@vercel/ncc": "^0.36.1",
|
||||||
"eslint": "^8.43.0",
|
"eslint": "^8.41.0",
|
||||||
"eslint-config-prettier": "^8.8.0",
|
"eslint-config-prettier": "^8.8.0",
|
||||||
"eslint-plugin-jest": "^27.2.2",
|
"eslint-plugin-jest": "^27.2.1",
|
||||||
"eslint-plugin-node": "^11.1.0",
|
|
||||||
"jest": "^27.5.1",
|
"jest": "^27.5.1",
|
||||||
"prettier": "^2.8.8",
|
"prettier": "^2.8.8",
|
||||||
"ts-jest": "^27.1.3",
|
"ts-jest": "^27.1.3",
|
||||||
|
|||||||
98
src/branch.ts
Normal file
98
src/branch.ts
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
import * as core from '@actions/core';
|
||||||
|
import * as github from '@actions/github';
|
||||||
|
|
||||||
|
export interface BranchMatchConfig {
|
||||||
|
headBranch?: string[];
|
||||||
|
baseBranch?: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
type BranchBase = 'base' | 'head';
|
||||||
|
|
||||||
|
export function toBranchMatchConfig(config: any): BranchMatchConfig {
|
||||||
|
if (!config['head-branch'] && !config['base-branch']) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
const branchConfig = {
|
||||||
|
headBranch: config['head-branch'],
|
||||||
|
baseBranch: config['base-branch']
|
||||||
|
};
|
||||||
|
|
||||||
|
for (const branchName in branchConfig) {
|
||||||
|
if (typeof branchConfig[branchName] === 'string') {
|
||||||
|
branchConfig[branchName] = [branchConfig[branchName]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return branchConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getBranchName(branchBase: BranchBase): string | undefined {
|
||||||
|
const pullRequest = github.context.payload.pull_request;
|
||||||
|
if (!pullRequest) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (branchBase === 'base') {
|
||||||
|
return pullRequest.base?.ref;
|
||||||
|
} else {
|
||||||
|
return pullRequest.head?.ref;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function checkAnyBranch(
|
||||||
|
regexps: string[],
|
||||||
|
branchBase: BranchBase
|
||||||
|
): boolean {
|
||||||
|
const branchName = getBranchName(branchBase);
|
||||||
|
if (!branchName) {
|
||||||
|
core.debug(` no branch name`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
core.debug(` checking "branch" pattern against ${branchName}`);
|
||||||
|
const matchers = regexps.map(regexp => new RegExp(regexp));
|
||||||
|
for (const matcher of matchers) {
|
||||||
|
if (matchBranchPattern(matcher, branchName)) {
|
||||||
|
core.debug(` "branch" patterns matched against ${branchName}`);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
core.debug(` "branch" patterns did not match against ${branchName}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function checkAllBranch(
|
||||||
|
regexps: string[],
|
||||||
|
branchBase: BranchBase
|
||||||
|
): boolean {
|
||||||
|
const branchName = getBranchName(branchBase);
|
||||||
|
if (!branchName) {
|
||||||
|
core.debug(` cannot fetch branch name from the pull request`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
core.debug(` checking "branch" pattern against ${branchName}`);
|
||||||
|
const matchers = regexps.map(regexp => new RegExp(regexp));
|
||||||
|
for (const matcher of matchers) {
|
||||||
|
if (!matchBranchPattern(matcher, branchName)) {
|
||||||
|
core.debug(` "branch" patterns did not match against ${branchName}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
core.debug(` "branch" patterns matched against ${branchName}`);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function matchBranchPattern(matcher: RegExp, branchName: string): boolean {
|
||||||
|
core.debug(` - ${matcher}`);
|
||||||
|
if (matcher.test(branchName)) {
|
||||||
|
core.debug(` "branch" pattern matched`);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
core.debug(` ${matcher} did not match`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
353
src/changedFiles.ts
Normal file
353
src/changedFiles.ts
Normal file
@@ -0,0 +1,353 @@
|
|||||||
|
import * as core from '@actions/core';
|
||||||
|
import * as github from '@actions/github';
|
||||||
|
import {Minimatch} from 'minimatch';
|
||||||
|
|
||||||
|
export interface ChangedFilesMatchConfig {
|
||||||
|
changedFiles?: ChangedFilesGlobPatternsConfig[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ChangedFilesGlobPatternsConfig {
|
||||||
|
AnyGlobToAnyFile?: string[];
|
||||||
|
AnyGlobToAllFiles?: string[];
|
||||||
|
AllGlobsToAnyFile?: string[];
|
||||||
|
AllGlobsToAllFiles?: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
type ClientType = ReturnType<typeof github.getOctokit>;
|
||||||
|
|
||||||
|
const ALLOWED_FILES_CONFIG_KEYS = [
|
||||||
|
'AnyGlobToAnyFile',
|
||||||
|
'AnyGlobToAllFiles',
|
||||||
|
'AllGlobsToAnyFile',
|
||||||
|
'AllGlobsToAllFiles'
|
||||||
|
];
|
||||||
|
|
||||||
|
export async function getChangedFiles(
|
||||||
|
client: ClientType,
|
||||||
|
prNumber: number
|
||||||
|
): Promise<string[]> {
|
||||||
|
const listFilesOptions = client.rest.pulls.listFiles.endpoint.merge({
|
||||||
|
owner: github.context.repo.owner,
|
||||||
|
repo: github.context.repo.repo,
|
||||||
|
pull_number: prNumber
|
||||||
|
});
|
||||||
|
|
||||||
|
const listFilesResponse = await client.paginate(listFilesOptions);
|
||||||
|
const changedFiles = listFilesResponse.map((f: any) => f.filename);
|
||||||
|
|
||||||
|
core.debug('found changed files:');
|
||||||
|
for (const file of changedFiles) {
|
||||||
|
core.debug(' ' + file);
|
||||||
|
}
|
||||||
|
|
||||||
|
return changedFiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function toChangedFilesMatchConfig(
|
||||||
|
config: any
|
||||||
|
): ChangedFilesMatchConfig {
|
||||||
|
if (!config['changed-files'] || !config['changed-files'].length) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
const changedFilesConfigs = Array.isArray(config['changed-files'])
|
||||||
|
? config['changed-files']
|
||||||
|
: [config['changed-files']];
|
||||||
|
|
||||||
|
const validChangedFilesConfigs: ChangedFilesGlobPatternsConfig[] = [];
|
||||||
|
|
||||||
|
changedFilesConfigs.forEach(changedFilesConfig => {
|
||||||
|
if (!isObject(changedFilesConfig)) {
|
||||||
|
throw new Error(
|
||||||
|
`The "changed-files" section must have a valid config structure. Please read the action documentation for more information`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const changedFilesConfigKeys = Object.keys(changedFilesConfig);
|
||||||
|
const invalidKeys = changedFilesConfigKeys.filter(
|
||||||
|
key => !ALLOWED_FILES_CONFIG_KEYS.includes(key)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (invalidKeys.length) {
|
||||||
|
throw new Error(
|
||||||
|
`Unknown config options were under "changed-files": ${invalidKeys.join(
|
||||||
|
', '
|
||||||
|
)}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
changedFilesConfigKeys.forEach(key => {
|
||||||
|
validChangedFilesConfigs.push({
|
||||||
|
[key]: Array.isArray(changedFilesConfig[key])
|
||||||
|
? changedFilesConfig[key]
|
||||||
|
: [changedFilesConfig[key]]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
changedFiles: validChangedFilesConfigs
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function isObject(obj: unknown): obj is object {
|
||||||
|
return obj !== null && typeof obj === 'object' && !Array.isArray(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
function printPattern(matcher: Minimatch): string {
|
||||||
|
return (matcher.negate ? '!' : '') + matcher.pattern;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function checkAnyChangedFiles(
|
||||||
|
changedFiles: string[],
|
||||||
|
globPatternsConfigs: ChangedFilesGlobPatternsConfig[]
|
||||||
|
): boolean {
|
||||||
|
core.debug(` checking "changed-files" patterns`);
|
||||||
|
|
||||||
|
for (const globPatternsConfig of globPatternsConfigs) {
|
||||||
|
if (globPatternsConfig.AnyGlobToAnyFile) {
|
||||||
|
if (
|
||||||
|
checkIfAnyGlobMatchesAnyFile(
|
||||||
|
changedFiles,
|
||||||
|
globPatternsConfig.AnyGlobToAnyFile
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
core.debug(` "changed-files" matched`);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (globPatternsConfig.AnyGlobToAllFiles) {
|
||||||
|
if (
|
||||||
|
checkIfAnyGlobMatchesAllFiles(
|
||||||
|
changedFiles,
|
||||||
|
globPatternsConfig.AnyGlobToAllFiles
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
core.debug(` "changed-files" matched`);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (globPatternsConfig.AllGlobsToAnyFile) {
|
||||||
|
if (
|
||||||
|
checkIfAllGlobsMatchAnyFile(
|
||||||
|
changedFiles,
|
||||||
|
globPatternsConfig.AllGlobsToAnyFile
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
core.debug(` "changed-files" matched`);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (globPatternsConfig.AllGlobsToAllFiles) {
|
||||||
|
if (
|
||||||
|
checkIfAllGlobsMatchAllFiles(
|
||||||
|
changedFiles,
|
||||||
|
globPatternsConfig.AllGlobsToAllFiles
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
core.debug(` "changed-files" matched`);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
core.debug(` "changed-files" did not match`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function checkAllChangedFiles(
|
||||||
|
changedFiles: string[],
|
||||||
|
globPatternsConfigs: ChangedFilesGlobPatternsConfig[]
|
||||||
|
): boolean {
|
||||||
|
core.debug(` checking "changed-files" patterns`);
|
||||||
|
|
||||||
|
for (const globPatternsConfig of globPatternsConfigs) {
|
||||||
|
if (globPatternsConfig.AnyGlobToAnyFile) {
|
||||||
|
if (
|
||||||
|
!checkIfAnyGlobMatchesAnyFile(
|
||||||
|
changedFiles,
|
||||||
|
globPatternsConfig.AnyGlobToAnyFile
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
core.debug(` "changed-files" did not match`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (globPatternsConfig.AnyGlobToAllFiles) {
|
||||||
|
if (
|
||||||
|
!checkIfAnyGlobMatchesAllFiles(
|
||||||
|
changedFiles,
|
||||||
|
globPatternsConfig.AnyGlobToAllFiles
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
core.debug(` "changed-files" did not match`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (globPatternsConfig.AllGlobsToAnyFile) {
|
||||||
|
if (
|
||||||
|
!checkIfAllGlobsMatchAnyFile(
|
||||||
|
changedFiles,
|
||||||
|
globPatternsConfig.AllGlobsToAnyFile
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
core.debug(` "changed-files" did not match`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (globPatternsConfig.AllGlobsToAllFiles) {
|
||||||
|
if (
|
||||||
|
!checkIfAllGlobsMatchAllFiles(
|
||||||
|
changedFiles,
|
||||||
|
globPatternsConfig.AllGlobsToAllFiles
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
core.debug(` "changed-files" did not match`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
core.debug(` "changed-files" patterns matched`);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function checkIfAnyGlobMatchesAnyFile(
|
||||||
|
changedFiles: string[],
|
||||||
|
globs: string[]
|
||||||
|
): boolean {
|
||||||
|
core.debug(` checking "AnyGlobToAnyFile" config patterns`);
|
||||||
|
const matchers = globs.map(g => new Minimatch(g));
|
||||||
|
|
||||||
|
for (const matcher of matchers) {
|
||||||
|
const matchedFile = changedFiles.find(changedFile => {
|
||||||
|
core.debug(
|
||||||
|
` checking "${printPattern(
|
||||||
|
matcher
|
||||||
|
)}" pattern against ${changedFile}`
|
||||||
|
);
|
||||||
|
|
||||||
|
return matcher.match(changedFile);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (matchedFile) {
|
||||||
|
core.debug(
|
||||||
|
` "${printPattern(matcher)}" pattern matched ${matchedFile}`
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
core.debug(` none of the patterns matched any of the files`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function checkIfAllGlobsMatchAnyFile(
|
||||||
|
changedFiles: string[],
|
||||||
|
globs: string[]
|
||||||
|
): boolean {
|
||||||
|
core.debug(` checking "AllGlobsToAnyFile" config patterns`);
|
||||||
|
const matchers = globs.map(g => new Minimatch(g));
|
||||||
|
|
||||||
|
for (const changedFile of changedFiles) {
|
||||||
|
const mismatchedGlob = matchers.find(matcher => {
|
||||||
|
core.debug(
|
||||||
|
` checking "${printPattern(
|
||||||
|
matcher
|
||||||
|
)}" pattern against ${changedFile}`
|
||||||
|
);
|
||||||
|
|
||||||
|
return !matcher.match(changedFile);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (mismatchedGlob) {
|
||||||
|
core.debug(
|
||||||
|
` "${printPattern(
|
||||||
|
mismatchedGlob
|
||||||
|
)}" pattern did not match ${changedFile}`
|
||||||
|
);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
core.debug(` all patterns matched ${changedFile}`);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
core.debug(` none of the files matched all patterns`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function checkIfAnyGlobMatchesAllFiles(
|
||||||
|
changedFiles: string[],
|
||||||
|
globs: string[]
|
||||||
|
): boolean {
|
||||||
|
core.debug(` checking "AnyGlobToAllFiles" config patterns`);
|
||||||
|
const matchers = globs.map(g => new Minimatch(g));
|
||||||
|
|
||||||
|
for (const matcher of matchers) {
|
||||||
|
const mismatchedFile = changedFiles.find(changedFile => {
|
||||||
|
core.debug(
|
||||||
|
` checking "${printPattern(
|
||||||
|
matcher
|
||||||
|
)}" pattern against ${changedFile}`
|
||||||
|
);
|
||||||
|
|
||||||
|
return !matcher.match(changedFile);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (mismatchedFile) {
|
||||||
|
core.debug(
|
||||||
|
` "${printPattern(
|
||||||
|
matcher
|
||||||
|
)}" pattern did not match ${mismatchedFile}`
|
||||||
|
);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
core.debug(` "${printPattern(matcher)}" pattern matched all files`);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
core.debug(` none of the patterns matched all files`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function checkIfAllGlobsMatchAllFiles(
|
||||||
|
changedFiles: string[],
|
||||||
|
globs: string[]
|
||||||
|
): boolean {
|
||||||
|
core.debug(` checking "AllGlobsToAllFiles" config patterns`);
|
||||||
|
const matchers = globs.map(g => new Minimatch(g));
|
||||||
|
|
||||||
|
for (const changedFile of changedFiles) {
|
||||||
|
const mismatchedGlob = matchers.find(matcher => {
|
||||||
|
core.debug(
|
||||||
|
` checking "${printPattern(
|
||||||
|
matcher
|
||||||
|
)}" pattern against ${changedFile}`
|
||||||
|
);
|
||||||
|
|
||||||
|
return !matcher.match(changedFile);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (mismatchedGlob) {
|
||||||
|
core.debug(
|
||||||
|
` "${printPattern(
|
||||||
|
mismatchedGlob
|
||||||
|
)}" pattern did not match ${changedFile}`
|
||||||
|
);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
core.debug(` all patterns matched all files`);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
362
src/labeler.ts
362
src/labeler.ts
@@ -1,26 +1,37 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as github from '@actions/github';
|
import * as github from '@actions/github';
|
||||||
import * as pluginRetry from '@octokit/plugin-retry';
|
|
||||||
import * as yaml from 'js-yaml';
|
import * as yaml from 'js-yaml';
|
||||||
import {Minimatch} from 'minimatch';
|
|
||||||
|
|
||||||
interface MatchConfig {
|
import {
|
||||||
all?: string[];
|
ChangedFilesMatchConfig,
|
||||||
any?: string[];
|
getChangedFiles,
|
||||||
}
|
toChangedFilesMatchConfig,
|
||||||
|
checkAllChangedFiles,
|
||||||
|
checkAnyChangedFiles
|
||||||
|
} from './changedFiles';
|
||||||
|
import {
|
||||||
|
checkAnyBranch,
|
||||||
|
checkAllBranch,
|
||||||
|
toBranchMatchConfig,
|
||||||
|
BranchMatchConfig
|
||||||
|
} from './branch';
|
||||||
|
|
||||||
|
export type BaseMatchConfig = BranchMatchConfig & ChangedFilesMatchConfig;
|
||||||
|
|
||||||
|
export type MatchConfig = {
|
||||||
|
any?: BaseMatchConfig[];
|
||||||
|
all?: BaseMatchConfig[];
|
||||||
|
};
|
||||||
|
|
||||||
type StringOrMatchConfig = string | MatchConfig;
|
|
||||||
type ClientType = ReturnType<typeof github.getOctokit>;
|
type ClientType = ReturnType<typeof github.getOctokit>;
|
||||||
|
|
||||||
// GitHub Issues cannot have more than 100 labels
|
const ALLOWED_CONFIG_KEYS = ['changed-files', 'head-branch', 'base-branch'];
|
||||||
const GITHUB_MAX_LABELS = 100;
|
|
||||||
|
|
||||||
export async function run() {
|
export async function run() {
|
||||||
try {
|
try {
|
||||||
const token = core.getInput('repo-token');
|
const token = core.getInput('repo-token');
|
||||||
const configPath = core.getInput('configuration-path', {required: true});
|
const configPath = core.getInput('configuration-path', {required: true});
|
||||||
const syncLabels = !!core.getInput('sync-labels');
|
const syncLabels = core.getBooleanInput('sync-labels');
|
||||||
const dot = core.getBooleanInput('dot');
|
|
||||||
|
|
||||||
const prNumber = getPrNumber();
|
const prNumber = getPrNumber();
|
||||||
if (!prNumber) {
|
if (!prNumber) {
|
||||||
@@ -28,7 +39,7 @@ export async function run() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const client: ClientType = github.getOctokit(token, {}, pluginRetry.retry);
|
const client: ClientType = github.getOctokit(token);
|
||||||
|
|
||||||
const {data: pullRequest} = await client.rest.pulls.get({
|
const {data: pullRequest} = await client.rest.pulls.get({
|
||||||
owner: github.context.repo.owner,
|
owner: github.context.repo.owner,
|
||||||
@@ -38,60 +49,28 @@ export async function run() {
|
|||||||
|
|
||||||
core.debug(`fetching changed files for pr #${prNumber}`);
|
core.debug(`fetching changed files for pr #${prNumber}`);
|
||||||
const changedFiles: string[] = await getChangedFiles(client, prNumber);
|
const changedFiles: string[] = await getChangedFiles(client, prNumber);
|
||||||
const labelGlobs: Map<string, StringOrMatchConfig[]> = await getLabelGlobs(
|
const labelConfigs: Map<string, MatchConfig[]> = await getMatchConfigs(
|
||||||
client,
|
client,
|
||||||
configPath
|
configPath
|
||||||
);
|
);
|
||||||
|
|
||||||
const preexistingLabels = pullRequest.labels.map(l => l.name);
|
const labels: string[] = [];
|
||||||
const allLabels: Set<string> = new Set<string>(preexistingLabels);
|
const labelsToRemove: string[] = [];
|
||||||
|
for (const [label, configs] of labelConfigs.entries()) {
|
||||||
for (const [label, globs] of labelGlobs.entries()) {
|
|
||||||
core.debug(`processing ${label}`);
|
core.debug(`processing ${label}`);
|
||||||
if (checkGlobs(changedFiles, globs, dot)) {
|
if (checkMatchConfigs(changedFiles, configs)) {
|
||||||
allLabels.add(label);
|
labels.push(label);
|
||||||
} else if (syncLabels) {
|
} else if (pullRequest.labels.find(l => l.name === label)) {
|
||||||
allLabels.delete(label);
|
labelsToRemove.push(label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const labelsToAdd = [...allLabels].slice(0, GITHUB_MAX_LABELS);
|
if (labels.length > 0) {
|
||||||
const excessLabels = [...allLabels].slice(GITHUB_MAX_LABELS);
|
await addLabels(client, prNumber, labels);
|
||||||
|
|
||||||
try {
|
|
||||||
let newLabels: string[] = [];
|
|
||||||
|
|
||||||
if (!isListEqual(labelsToAdd, preexistingLabels)) {
|
|
||||||
await setLabels(client, prNumber, labelsToAdd);
|
|
||||||
newLabels = labelsToAdd.filter(l => !preexistingLabels.includes(l));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
core.setOutput('new-labels', newLabels.join(','));
|
if (syncLabels && labelsToRemove.length) {
|
||||||
core.setOutput('all-labels', labelsToAdd.join(','));
|
await removeLabels(client, prNumber, labelsToRemove);
|
||||||
|
|
||||||
if (excessLabels.length) {
|
|
||||||
core.warning(
|
|
||||||
`Maximum of ${GITHUB_MAX_LABELS} labels allowed. Excess labels: ${excessLabels.join(
|
|
||||||
', '
|
|
||||||
)}`,
|
|
||||||
{title: 'Label limit for a PR exceeded'}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} catch (error: any) {
|
|
||||||
if (
|
|
||||||
error.name === 'HttpError' &&
|
|
||||||
error.message === 'Resource not accessible by integration'
|
|
||||||
) {
|
|
||||||
core.warning(
|
|
||||||
`The action requires write permission to add labels to pull requests. For more information please refer to the action documentation: https://github.com/actions/labeler#permissions`,
|
|
||||||
{
|
|
||||||
title: `${process.env['GITHUB_ACTION_REPOSITORY']} running under '${github.context.eventName}' is misconfigured`
|
|
||||||
}
|
|
||||||
);
|
|
||||||
core.setFailed(error.message);
|
|
||||||
} else {
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
core.error(error);
|
core.error(error);
|
||||||
@@ -108,41 +87,20 @@ function getPrNumber(): number | undefined {
|
|||||||
return pullRequest.number;
|
return pullRequest.number;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getChangedFiles(
|
async function getMatchConfigs(
|
||||||
client: ClientType,
|
|
||||||
prNumber: number
|
|
||||||
): Promise<string[]> {
|
|
||||||
const listFilesOptions = client.rest.pulls.listFiles.endpoint.merge({
|
|
||||||
owner: github.context.repo.owner,
|
|
||||||
repo: github.context.repo.repo,
|
|
||||||
pull_number: prNumber
|
|
||||||
});
|
|
||||||
|
|
||||||
const listFilesResponse = await client.paginate(listFilesOptions);
|
|
||||||
const changedFiles = listFilesResponse.map((f: any) => f.filename);
|
|
||||||
|
|
||||||
core.debug('found changed files:');
|
|
||||||
for (const file of changedFiles) {
|
|
||||||
core.debug(' ' + file);
|
|
||||||
}
|
|
||||||
|
|
||||||
return changedFiles;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getLabelGlobs(
|
|
||||||
client: ClientType,
|
client: ClientType,
|
||||||
configurationPath: string
|
configurationPath: string
|
||||||
): Promise<Map<string, StringOrMatchConfig[]>> {
|
): Promise<Map<string, MatchConfig[]>> {
|
||||||
const configurationContent: string = await fetchContent(
|
const configurationContent: string = await fetchContent(
|
||||||
client,
|
client,
|
||||||
configurationPath
|
configurationPath
|
||||||
);
|
);
|
||||||
|
|
||||||
// loads (hopefully) a `{[label:string]: string | StringOrMatchConfig[]}`, but is `any`:
|
// loads (hopefully) a `{[label:string]: MatchConfig[]}`, but is `any`:
|
||||||
const configObject: any = yaml.load(configurationContent);
|
const configObject: any = yaml.load(configurationContent);
|
||||||
|
|
||||||
// transform `any` => `Map<string,StringOrMatchConfig[]>` or throw if yaml is malformed:
|
// transform `any` => `Map<string,MatchConfig[]>` or throw if yaml is malformed:
|
||||||
return getLabelGlobMapFromObject(configObject);
|
return getLabelConfigMapFromObject(configObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchContent(
|
async function fetchContent(
|
||||||
@@ -159,139 +117,221 @@ async function fetchContent(
|
|||||||
return Buffer.from(response.data.content, response.data.encoding).toString();
|
return Buffer.from(response.data.content, response.data.encoding).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLabelGlobMapFromObject(
|
export function getLabelConfigMapFromObject(
|
||||||
configObject: any
|
configObject: any
|
||||||
): Map<string, StringOrMatchConfig[]> {
|
): Map<string, MatchConfig[]> {
|
||||||
const labelGlobs: Map<string, StringOrMatchConfig[]> = new Map();
|
const labelMap: Map<string, MatchConfig[]> = new Map();
|
||||||
for (const label in configObject) {
|
for (const label in configObject) {
|
||||||
if (typeof configObject[label] === 'string') {
|
const configOptions = configObject[label];
|
||||||
labelGlobs.set(label, [configObject[label]]);
|
if (
|
||||||
} else if (configObject[label] instanceof Array) {
|
!Array.isArray(configOptions) ||
|
||||||
labelGlobs.set(label, configObject[label]);
|
!configOptions.every(opts => typeof opts === 'object')
|
||||||
} else {
|
) {
|
||||||
throw Error(
|
throw Error(
|
||||||
`found unexpected type for label ${label} (should be string or array of globs)`
|
`found unexpected type for label '${label}' (should be array of config options)`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
const matchConfigs = configOptions.reduce<MatchConfig[]>(
|
||||||
|
(updatedConfig, configValue) => {
|
||||||
|
if (!configValue) {
|
||||||
|
return updatedConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
return labelGlobs;
|
Object.entries(configValue).forEach(([key, value]) => {
|
||||||
|
// If the top level `any` or `all` keys are provided then set them, and convert their values to
|
||||||
|
// our config objects.
|
||||||
|
if (key === 'any' || key === 'all') {
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
const newConfigs = value.map(toMatchConfig);
|
||||||
|
updatedConfig.push({[key]: newConfigs});
|
||||||
|
}
|
||||||
|
} else if (ALLOWED_CONFIG_KEYS.includes(key)) {
|
||||||
|
const newMatchConfig = toMatchConfig({[key]: value});
|
||||||
|
// Find or set the `any` key so that we can add these properties to that rule,
|
||||||
|
// Or create a new `any` key and add that to our array of configs.
|
||||||
|
const indexOfAny = updatedConfig.findIndex(mc => !!mc['any']);
|
||||||
|
if (indexOfAny >= 0) {
|
||||||
|
updatedConfig[indexOfAny].any?.push(newMatchConfig);
|
||||||
|
} else {
|
||||||
|
updatedConfig.push({any: [newMatchConfig]});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Log the key that we don't know what to do with.
|
||||||
|
core.info(`An unknown config option was under ${label}: ${key}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return updatedConfig;
|
||||||
|
},
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (matchConfigs.length) {
|
||||||
|
labelMap.set(label, matchConfigs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toMatchConfig(config: StringOrMatchConfig): MatchConfig {
|
return labelMap;
|
||||||
if (typeof config === 'string') {
|
}
|
||||||
|
|
||||||
|
export function toMatchConfig(config: any): BaseMatchConfig {
|
||||||
|
const changedFilesConfig = toChangedFilesMatchConfig(config);
|
||||||
|
const branchConfig = toBranchMatchConfig(config);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
any: [config]
|
...changedFilesConfig,
|
||||||
|
...branchConfig
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return config;
|
export function checkMatchConfigs(
|
||||||
}
|
|
||||||
|
|
||||||
function printPattern(matcher: Minimatch): string {
|
|
||||||
return (matcher.negate ? '!' : '') + matcher.pattern;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function checkGlobs(
|
|
||||||
changedFiles: string[],
|
changedFiles: string[],
|
||||||
globs: StringOrMatchConfig[],
|
matchConfigs: MatchConfig[]
|
||||||
dot: boolean
|
|
||||||
): boolean {
|
): boolean {
|
||||||
for (const glob of globs) {
|
for (const config of matchConfigs) {
|
||||||
core.debug(` checking pattern ${JSON.stringify(glob)}`);
|
core.debug(` checking config ${JSON.stringify(config)}`);
|
||||||
const matchConfig = toMatchConfig(glob);
|
if (!checkMatch(changedFiles, config)) {
|
||||||
if (checkMatch(changedFiles, matchConfig, dot)) {
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
function checkMatch(changedFiles: string[], matchConfig: MatchConfig): boolean {
|
||||||
|
if (!Object.keys(matchConfig).length) {
|
||||||
|
core.debug(` no "any" or "all" patterns to check`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isMatch(changedFile: string, matchers: Minimatch[]): boolean {
|
if (matchConfig.all) {
|
||||||
core.debug(` matching patterns against file ${changedFile}`);
|
if (!checkAll(matchConfig.all, changedFiles)) {
|
||||||
for (const matcher of matchers) {
|
return false;
|
||||||
core.debug(` - ${printPattern(matcher)}`);
|
}
|
||||||
if (!matcher.match(changedFile)) {
|
}
|
||||||
core.debug(` ${printPattern(matcher)} did not match`);
|
|
||||||
|
if (matchConfig.any) {
|
||||||
|
if (!checkAny(matchConfig.any, changedFiles)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
core.debug(` all patterns matched`);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// equivalent to "Array.some()" but expanded for debugging and clarity
|
// equivalent to "Array.some()" but expanded for debugging and clarity
|
||||||
function checkAny(
|
export function checkAny(
|
||||||
changedFiles: string[],
|
matchConfigs: BaseMatchConfig[],
|
||||||
globs: string[],
|
changedFiles: string[]
|
||||||
dot: boolean
|
|
||||||
): boolean {
|
): boolean {
|
||||||
const matchers = globs.map(g => new Minimatch(g, {dot}));
|
|
||||||
core.debug(` checking "any" patterns`);
|
core.debug(` checking "any" patterns`);
|
||||||
for (const changedFile of changedFiles) {
|
if (
|
||||||
if (isMatch(changedFile, matchers)) {
|
!matchConfigs.length ||
|
||||||
core.debug(` "any" patterns matched against ${changedFile}`);
|
!matchConfigs.some(configOption => Object.keys(configOption).length)
|
||||||
|
) {
|
||||||
|
core.debug(` no "any" patterns to check`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const matchConfig of matchConfigs) {
|
||||||
|
if (matchConfig.baseBranch) {
|
||||||
|
if (checkAnyBranch(matchConfig.baseBranch, 'base')) {
|
||||||
|
core.debug(` "any" patterns matched`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
core.debug(` "any" patterns did not match any files`);
|
if (matchConfig.changedFiles) {
|
||||||
|
if (checkAnyChangedFiles(changedFiles, matchConfig.changedFiles)) {
|
||||||
|
core.debug(` "any" patterns matched`);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (matchConfig.headBranch) {
|
||||||
|
if (checkAnyBranch(matchConfig.headBranch, 'head')) {
|
||||||
|
core.debug(` "any" patterns matched`);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
core.debug(` "any" patterns did not match any configs`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// equivalent to "Array.every()" but expanded for debugging and clarity
|
// equivalent to "Array.every()" but expanded for debugging and clarity
|
||||||
function checkAll(
|
export function checkAll(
|
||||||
changedFiles: string[],
|
matchConfigs: BaseMatchConfig[],
|
||||||
globs: string[],
|
changedFiles: string[]
|
||||||
dot: boolean
|
|
||||||
): boolean {
|
): boolean {
|
||||||
const matchers = globs.map(g => new Minimatch(g, {dot}));
|
|
||||||
core.debug(` checking "all" patterns`);
|
core.debug(` checking "all" patterns`);
|
||||||
for (const changedFile of changedFiles) {
|
if (
|
||||||
if (!isMatch(changedFile, matchers)) {
|
!matchConfigs.length ||
|
||||||
core.debug(` "all" patterns did not match against ${changedFile}`);
|
!matchConfigs.some(configOption => Object.keys(configOption).length)
|
||||||
|
) {
|
||||||
|
core.debug(` no "all" patterns to check`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const matchConfig of matchConfigs) {
|
||||||
|
if (matchConfig.baseBranch) {
|
||||||
|
if (!checkAllBranch(matchConfig.baseBranch, 'base')) {
|
||||||
|
core.debug(` "all" patterns did not match`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
core.debug(` "all" patterns matched all files`);
|
if (matchConfig.changedFiles) {
|
||||||
|
if (!changedFiles.length) {
|
||||||
|
core.debug(` no files to check "changed-files" patterns against`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!checkAllChangedFiles(changedFiles, matchConfig.changedFiles)) {
|
||||||
|
core.debug(` "all" patterns did not match`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (matchConfig.headBranch) {
|
||||||
|
if (!checkAllBranch(matchConfig.headBranch, 'head')) {
|
||||||
|
core.debug(` "all" patterns did not match`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
core.debug(` "all" patterns matched all configs`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkMatch(
|
async function addLabels(
|
||||||
changedFiles: string[],
|
|
||||||
matchConfig: MatchConfig,
|
|
||||||
dot: boolean
|
|
||||||
): boolean {
|
|
||||||
if (matchConfig.all !== undefined) {
|
|
||||||
if (!checkAll(changedFiles, matchConfig.all, dot)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (matchConfig.any !== undefined) {
|
|
||||||
if (!checkAny(changedFiles, matchConfig.any, dot)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function isListEqual(listA: string[], listB: string[]): boolean {
|
|
||||||
return listA.length === listB.length && listA.every(el => listB.includes(el));
|
|
||||||
}
|
|
||||||
|
|
||||||
async function setLabels(
|
|
||||||
client: ClientType,
|
client: ClientType,
|
||||||
prNumber: number,
|
prNumber: number,
|
||||||
labels: string[]
|
labels: string[]
|
||||||
) {
|
) {
|
||||||
await client.rest.issues.setLabels({
|
await client.rest.issues.addLabels({
|
||||||
owner: github.context.repo.owner,
|
owner: github.context.repo.owner,
|
||||||
repo: github.context.repo.repo,
|
repo: github.context.repo.repo,
|
||||||
issue_number: prNumber,
|
issue_number: prNumber,
|
||||||
labels: labels
|
labels: labels
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function removeLabels(
|
||||||
|
client: ClientType,
|
||||||
|
prNumber: number,
|
||||||
|
labels: string[]
|
||||||
|
) {
|
||||||
|
await Promise.all(
|
||||||
|
labels.map(label =>
|
||||||
|
client.rest.issues.removeLabel({
|
||||||
|
owner: github.context.repo.owner,
|
||||||
|
repo: github.context.repo.repo,
|
||||||
|
issue_number: prNumber,
|
||||||
|
name: label
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user