mirror of
https://github.com/actions/labeler.git
synced 2025-12-11 20:24:51 +00:00
Compare commits
47 Commits
v4.0.0
...
update-cod
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6870bfd4e8 | ||
|
|
91690a7e55 | ||
|
|
f7b1827ed3 | ||
|
|
55e1958307 | ||
|
|
34b1b365e1 | ||
|
|
ce7f13552d | ||
|
|
0cad484cd0 | ||
|
|
d42abd99fe | ||
|
|
e63db1786a | ||
|
|
cdcdd9a42c | ||
|
|
e07202b67f | ||
|
|
5776c3457c | ||
|
|
1e8fa0b154 | ||
|
|
3e20f3d061 | ||
|
|
5c7539237e | ||
|
|
d8fb392051 | ||
|
|
a96e5aec3e | ||
|
|
9f8414f4c4 | ||
|
|
97727458a9 | ||
|
|
e54e5b338f | ||
|
|
fd87190791 | ||
|
|
c959bdd7a7 | ||
|
|
493ae8a9ee | ||
|
|
15508143cd | ||
|
|
a29491a7fe | ||
|
|
6e5bdb78b3 | ||
|
|
3d918ddbb6 | ||
|
|
74e99cda29 | ||
|
|
d81b3992ae | ||
|
|
ed55e8ab1f | ||
|
|
a0f7b6adbb | ||
|
|
cec8dc03de | ||
|
|
6683f4636c | ||
|
|
0214ec66d5 | ||
|
|
e53d3555ec | ||
|
|
6a315d4ea5 | ||
|
|
b322dc2e83 | ||
|
|
ede5dd4883 | ||
|
|
2a23f11dfe | ||
|
|
df112f56d9 | ||
|
|
1dd2c80f71 | ||
|
|
3f59b1dc2a | ||
|
|
0628b00436 | ||
|
|
a426bff63f | ||
|
|
f8b85e1472 | ||
|
|
c8a666accc | ||
|
|
c79c655b8b |
35
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
35
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a bug report
|
||||
title: ''
|
||||
labels: bug, needs triage
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!--- Please direct any generic questions related to actions to our support community forum at https://github.community/c/code-to-cloud/github-actions/41 --->
|
||||
<!--- Before opening up a new bug report, please make sure to check for similar existing issues -->
|
||||
|
||||
**Description:**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**Action version:**
|
||||
Specify the action version
|
||||
|
||||
**Platform:**
|
||||
- [ ] Ubuntu
|
||||
- [ ] macOS
|
||||
- [ ] Windows
|
||||
|
||||
**Runner type:**
|
||||
- [ ] Hosted
|
||||
- [ ] Self-hosted
|
||||
|
||||
**Repro steps:**
|
||||
A description with steps to reproduce the issue. If your have a public example or repo to share, please provide the link.
|
||||
|
||||
**Expected behavior:**
|
||||
A description of what you expected to happen.
|
||||
|
||||
**Actual behavior:**
|
||||
A description of what is actually happening.
|
||||
1
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
1
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
blank_issues_enabled: false
|
||||
18
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
18
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: feature request, needs triage
|
||||
assignees: ''
|
||||
---
|
||||
<!--- Please direct any generic questions related to actions to our support community forum at https://github.community/c/code-to-cloud/github-actions/41 --->
|
||||
<!--- Before opening up a new feature request, please make sure to check for similar existing issues and pull requests -->
|
||||
|
||||
**Description:**
|
||||
Describe your proposal.
|
||||
|
||||
**Justification:**
|
||||
Justification or a use case for your proposal.
|
||||
|
||||
**Are you willing to submit a PR?**
|
||||
<!--- We accept contributions! -->
|
||||
9
.github/pull_request_template.md
vendored
Normal file
9
.github/pull_request_template.md
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
**Description:**
|
||||
Describe your changes.
|
||||
|
||||
**Related issue:**
|
||||
Add link to the related issue.
|
||||
|
||||
**Check list:**
|
||||
- [ ] Mark if documentation changes are required.
|
||||
- [ ] Mark if tests were added or updated to cover the changes.
|
||||
17
.github/workflows/basic-validation.yml
vendored
Normal file
17
.github/workflows/basic-validation.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
name: Basic validation
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/*
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
|
||||
jobs:
|
||||
call-basic-validation:
|
||||
name: Basic validation
|
||||
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main
|
||||
28
.github/workflows/build_test.yml
vendored
28
.github/workflows/build_test.yml
vendored
@@ -1,28 +0,0 @@
|
||||
name: Build & Test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/*
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup node 16
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16.x
|
||||
- run: npm install
|
||||
- run: npm run build
|
||||
- run: npm test
|
||||
17
.github/workflows/check-dist.yml
vendored
Normal file
17
.github/workflows/check-dist.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
name: Check dist/
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
call-check-dist:
|
||||
name: Check dist/
|
||||
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
|
||||
14
.github/workflows/codeql-analysis.yml
vendored
Normal file
14
.github/workflows/codeql-analysis.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
name: CodeQL analysis
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
schedule:
|
||||
- cron: '0 3 * * 0'
|
||||
|
||||
jobs:
|
||||
call-codeQL-analysis:
|
||||
name: CodeQL analysis
|
||||
uses: actions/reusable-workflows/.github/workflows/codeql-analysis.yml@main
|
||||
15
.github/workflows/licensed.yml
vendored
Normal file
15
.github/workflows/licensed.yml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
name: Licensed
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
call-licensed:
|
||||
name: Licensed
|
||||
uses: actions/reusable-workflows/.github/workflows/licensed.yml@main
|
||||
28
.github/workflows/release-new-action-version.yml
vendored
Normal file
28
.github/workflows/release-new-action-version.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
name: Release new action version
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [released]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
TAG_NAME:
|
||||
description: 'Tag name that the major tag will point to'
|
||||
required: true
|
||||
|
||||
env:
|
||||
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
update_tag:
|
||||
name: Update the major tag to include the ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} changes
|
||||
environment:
|
||||
name: releaseNewActionVersion
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Update the ${{ env.TAG_NAME }} tag
|
||||
uses: actions/publish-action@v0.2.1
|
||||
with:
|
||||
source-tag: ${{ env.TAG_NAME }}
|
||||
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
|
||||
50
.github/workflows/update_and_check_licenses.yml
vendored
50
.github/workflows/update_and_check_licenses.yml
vendored
@@ -1,50 +0,0 @@
|
||||
name: Licenses
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths: [package.json, package-lock.json]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths: [package.json, package-lock.json]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
# Updates our cache of license files in response to changes to our dependencies
|
||||
# declared in package-lock.json. Automatically commits the changes and pushes
|
||||
# them to your branch. NB `check_license_status` should always run *after* this
|
||||
#
|
||||
# see https://github.com/actions/labeler/pull/155 for more context
|
||||
update_licenses:
|
||||
runs-on: ubuntu-latest
|
||||
name: Update Licenses
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: jonabc/setup-licensed@v1
|
||||
with:
|
||||
version: '3.x'
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- run: npm install --production
|
||||
- uses: jonabc/licensed-ci@v1
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# Fails if any of our dependencies have licenses that our incompatible with our
|
||||
# requirements (see .licensed.yml) OR if any of our dependencies have been
|
||||
# upgraded to a new version without us having updated their corresponding
|
||||
# license metadata file in .licenses/
|
||||
#
|
||||
# see https://github.com/actions/labeler/pull/91 for more context
|
||||
check_licenses:
|
||||
needs: update_licenses
|
||||
if: always() # always run after we update the license cache. if it failed, we will probably just fail as well
|
||||
runs-on: ubuntu-latest
|
||||
name: Check Licenses
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: jonabc/setup-licensed@v1.0.2
|
||||
with:
|
||||
version: '3.x'
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- run: npm install
|
||||
- run: licensed status
|
||||
2
.licenses/npm/@actions/core.dep.yml
generated
2
.licenses/npm/@actions/core.dep.yml
generated
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@actions/core"
|
||||
version: 1.6.0
|
||||
version: 1.10.0
|
||||
type: npm
|
||||
summary: Actions core lib
|
||||
homepage: https://github.com/actions/toolkit/tree/main/packages/core
|
||||
|
||||
32
.licenses/npm/@actions/http-client-2.0.1.dep.yml
generated
Normal file
32
.licenses/npm/@actions/http-client-2.0.1.dep.yml
generated
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: "@actions/http-client"
|
||||
version: 2.0.1
|
||||
type: npm
|
||||
summary: Actions Http Client
|
||||
homepage: https://github.com/actions/toolkit/tree/main/packages/http-client
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
Actions Http Client for Node.js
|
||||
|
||||
Copyright (c) GitHub, Inc.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
||||
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
notices: []
|
||||
2
.licenses/npm/minimatch.dep.yml
generated
2
.licenses/npm/minimatch.dep.yml
generated
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: minimatch
|
||||
version: 3.0.4
|
||||
version: 3.1.2
|
||||
type: npm
|
||||
summary: a glob matcher in javascript
|
||||
homepage:
|
||||
|
||||
2
.licenses/npm/node-fetch.dep.yml
generated
2
.licenses/npm/node-fetch.dep.yml
generated
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: node-fetch
|
||||
version: 2.6.1
|
||||
version: 2.6.7
|
||||
type: npm
|
||||
summary: A light-weight module that brings window.fetch to node.js
|
||||
homepage: https://github.com/bitinn/node-fetch
|
||||
|
||||
30
.licenses/npm/tr46.dep.yml
generated
Normal file
30
.licenses/npm/tr46.dep.yml
generated
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
name: tr46
|
||||
version: 0.0.3
|
||||
type: npm
|
||||
summary: An implementation of the Unicode TR46 spec
|
||||
homepage: https://github.com/Sebmaster/tr46.js#readme
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: Auto-generated MIT license text
|
||||
text: |
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
notices: []
|
||||
20
.licenses/npm/uuid.dep.yml
generated
Normal file
20
.licenses/npm/uuid.dep.yml
generated
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: uuid
|
||||
version: 8.3.2
|
||||
type: npm
|
||||
summary: RFC4122 (v1, v4, and v5) UUIDs
|
||||
homepage:
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE.md
|
||||
text: |
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2010-2020 Robert Kieffer and other 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.
|
||||
notices: []
|
||||
23
.licenses/npm/webidl-conversions.dep.yml
generated
Normal file
23
.licenses/npm/webidl-conversions.dep.yml
generated
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
name: webidl-conversions
|
||||
version: 3.0.1
|
||||
type: npm
|
||||
summary: Implements the WebIDL algorithms for converting to and from JavaScript values
|
||||
homepage:
|
||||
license: bsd-2-clause
|
||||
licenses:
|
||||
- sources: LICENSE.md
|
||||
text: |
|
||||
# The BSD 2-Clause License
|
||||
|
||||
Copyright (c) 2014, Domenic Denicola
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
notices: []
|
||||
32
.licenses/npm/whatwg-url.dep.yml
generated
Normal file
32
.licenses/npm/whatwg-url.dep.yml
generated
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: whatwg-url
|
||||
version: 5.0.0
|
||||
type: npm
|
||||
summary: An implementation of the WHATWG URL Standard's URL API and parsing machinery
|
||||
homepage:
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE.txt
|
||||
text: |
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015–2016 Sebastian Mayr
|
||||
|
||||
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: []
|
||||
12
.prettierrc.json
Normal file
12
.prettierrc.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"printWidth": 80,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"bracketSpacing": false,
|
||||
"arrowParens": "avoid",
|
||||
"parser": "typescript",
|
||||
"endOfLine": "auto"
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
* @actions/actions-runtime
|
||||
* @actions/setup-actions-team
|
||||
|
||||
12
README.md
12
README.md
@@ -56,6 +56,11 @@ label1:
|
||||
|
||||
# Add 'label2' to any file changes within 'example2' folder
|
||||
label2: example2/*
|
||||
|
||||
# Add label3 to any change to .txt files within the entire repository. Quotation marks are required for the leading asterisk
|
||||
label3:
|
||||
- '**/*.txt'
|
||||
|
||||
```
|
||||
|
||||
#### Common Examples
|
||||
@@ -66,7 +71,7 @@ repo:
|
||||
- '*'
|
||||
|
||||
# Add '@domain/core' label to any change within the 'core' package
|
||||
@domain/core:
|
||||
'@domain/core':
|
||||
- package/core/*
|
||||
- package/core/**/*
|
||||
|
||||
@@ -95,6 +100,9 @@ on:
|
||||
|
||||
jobs:
|
||||
triage:
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/labeler@v4
|
||||
@@ -110,7 +118,7 @@ Various inputs are defined in [`action.yml`](action.yml) to let you configure th
|
||||
|
||||
| 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 | N/A |
|
||||
| `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`
|
||||
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
export const context = {
|
||||
payload: {
|
||||
pull_request: {
|
||||
number: 123,
|
||||
},
|
||||
number: 123
|
||||
}
|
||||
},
|
||||
repo: {
|
||||
owner: "monalisa",
|
||||
repo: "helloworld",
|
||||
},
|
||||
owner: 'monalisa',
|
||||
repo: 'helloworld'
|
||||
}
|
||||
};
|
||||
|
||||
const mockApi = {
|
||||
rest: {
|
||||
issues: {
|
||||
addLabels: jest.fn(),
|
||||
removeLabel: jest.fn(),
|
||||
removeLabel: jest.fn()
|
||||
},
|
||||
pulls: {
|
||||
get: jest.fn().mockResolvedValue({}),
|
||||
listFiles: {
|
||||
endpoint: {
|
||||
merge: jest.fn().mockReturnValue({}),
|
||||
},
|
||||
},
|
||||
merge: jest.fn().mockReturnValue({})
|
||||
}
|
||||
}
|
||||
},
|
||||
repos: {
|
||||
getContent: jest.fn(),
|
||||
},
|
||||
getContent: jest.fn()
|
||||
}
|
||||
},
|
||||
paginate: jest.fn(),
|
||||
paginate: jest.fn()
|
||||
};
|
||||
|
||||
export const getOctokit = jest.fn().mockImplementation(() => mockApi);
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
import { checkGlobs } from "../src/labeler";
|
||||
import {checkGlobs} from '../src/labeler';
|
||||
|
||||
import * as core from "@actions/core";
|
||||
import * as core from '@actions/core';
|
||||
|
||||
jest.mock("@actions/core");
|
||||
jest.mock('@actions/core');
|
||||
|
||||
beforeAll(() => {
|
||||
jest.spyOn(core, "getInput").mockImplementation((name, options) => {
|
||||
return jest.requireActual("@actions/core").getInput(name, options);
|
||||
jest.spyOn(core, 'getInput').mockImplementation((name, options) => {
|
||||
return jest.requireActual('@actions/core').getInput(name, options);
|
||||
});
|
||||
});
|
||||
|
||||
const matchConfig = [{ any: ["*.txt"] }];
|
||||
const matchConfig = [{any: ['*.txt']}];
|
||||
|
||||
describe("checkGlobs", () => {
|
||||
it("returns true when our pattern does match changed files", () => {
|
||||
const changedFiles = ["foo.txt", "bar.txt"];
|
||||
describe('checkGlobs', () => {
|
||||
it('returns true when our pattern does match changed files', () => {
|
||||
const changedFiles = ['foo.txt', 'bar.txt'];
|
||||
const result = checkGlobs(changedFiles, matchConfig);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
it("returns false when our pattern does not match changed files", () => {
|
||||
const changedFiles = ["foo.docx"];
|
||||
it('returns false when our pattern does not match changed files', () => {
|
||||
const changedFiles = ['foo.docx'];
|
||||
const result = checkGlobs(changedFiles, matchConfig);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
|
||||
@@ -1,45 +1,45 @@
|
||||
import { run } from "../src/labeler";
|
||||
import * as github from "@actions/github";
|
||||
import * as core from "@actions/core";
|
||||
import {run} from '../src/labeler';
|
||||
import * as github from '@actions/github';
|
||||
import * as core from '@actions/core';
|
||||
|
||||
const fs = jest.requireActual("fs");
|
||||
const fs = jest.requireActual('fs');
|
||||
|
||||
jest.mock("@actions/core");
|
||||
jest.mock("@actions/github");
|
||||
jest.mock('@actions/core');
|
||||
jest.mock('@actions/github');
|
||||
|
||||
const gh = github.getOctokit("_");
|
||||
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 paginateMock = jest.spyOn(gh, "paginate");
|
||||
const getPullMock = jest.spyOn(gh.rest.pulls, "get");
|
||||
const gh = github.getOctokit('_');
|
||||
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 paginateMock = jest.spyOn(gh, 'paginate');
|
||||
const getPullMock = jest.spyOn(gh.rest.pulls, 'get');
|
||||
|
||||
const yamlFixtures = {
|
||||
"only_pdfs.yml": fs.readFileSync("__tests__/fixtures/only_pdfs.yml"),
|
||||
'only_pdfs.yml': fs.readFileSync('__tests__/fixtures/only_pdfs.yml')
|
||||
};
|
||||
|
||||
afterAll(() => jest.restoreAllMocks());
|
||||
|
||||
describe("run", () => {
|
||||
it("adds labels to PRs that match our glob patterns", async () => {
|
||||
usingLabelerConfigYaml("only_pdfs.yml");
|
||||
mockGitHubResponseChangedFiles("foo.pdf");
|
||||
describe('run', () => {
|
||||
it('adds labels to PRs that match our glob patterns', async () => {
|
||||
usingLabelerConfigYaml('only_pdfs.yml');
|
||||
mockGitHubResponseChangedFiles('foo.pdf');
|
||||
|
||||
await run();
|
||||
|
||||
expect(removeLabelMock).toHaveBeenCalledTimes(0);
|
||||
expect(addLabelsMock).toHaveBeenCalledTimes(1);
|
||||
expect(addLabelsMock).toHaveBeenCalledWith({
|
||||
owner: "monalisa",
|
||||
repo: "helloworld",
|
||||
owner: 'monalisa',
|
||||
repo: 'helloworld',
|
||||
issue_number: 123,
|
||||
labels: ["touched-a-pdf-file"],
|
||||
labels: ['touched-a-pdf-file']
|
||||
});
|
||||
});
|
||||
|
||||
it("does not add labels to PRs that do not match our glob patterns", async () => {
|
||||
usingLabelerConfigYaml("only_pdfs.yml");
|
||||
mockGitHubResponseChangedFiles("foo.txt");
|
||||
it('does not add labels to PRs that do not match our glob patterns', async () => {
|
||||
usingLabelerConfigYaml('only_pdfs.yml');
|
||||
mockGitHubResponseChangedFiles('foo.txt');
|
||||
|
||||
await run();
|
||||
|
||||
@@ -47,23 +47,23 @@ describe("run", () => {
|
||||
expect(addLabelsMock).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 () => {
|
||||
let mockInput = {
|
||||
"repo-token": "foo",
|
||||
"configuration-path": "bar",
|
||||
"sync-labels": true,
|
||||
'repo-token': 'foo',
|
||||
'configuration-path': 'bar',
|
||||
'sync-labels': true
|
||||
};
|
||||
|
||||
jest
|
||||
.spyOn(core, "getInput")
|
||||
.spyOn(core, 'getInput')
|
||||
.mockImplementation((name: string, ...opts) => mockInput[name]);
|
||||
|
||||
usingLabelerConfigYaml("only_pdfs.yml");
|
||||
mockGitHubResponseChangedFiles("foo.txt");
|
||||
usingLabelerConfigYaml('only_pdfs.yml');
|
||||
mockGitHubResponseChangedFiles('foo.txt');
|
||||
getPullMock.mockResolvedValue(<any>{
|
||||
data: {
|
||||
labels: [{ name: "touched-a-pdf-file" }],
|
||||
},
|
||||
labels: [{name: 'touched-a-pdf-file'}]
|
||||
}
|
||||
});
|
||||
|
||||
await run();
|
||||
@@ -71,30 +71,30 @@ describe("run", () => {
|
||||
expect(addLabelsMock).toHaveBeenCalledTimes(0);
|
||||
expect(removeLabelMock).toHaveBeenCalledTimes(1);
|
||||
expect(removeLabelMock).toHaveBeenCalledWith({
|
||||
owner: "monalisa",
|
||||
repo: "helloworld",
|
||||
owner: 'monalisa',
|
||||
repo: 'helloworld',
|
||||
issue_number: 123,
|
||||
name: "touched-a-pdf-file",
|
||||
name: 'touched-a-pdf-file'
|
||||
});
|
||||
});
|
||||
|
||||
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 () => {
|
||||
let mockInput = {
|
||||
"repo-token": "foo",
|
||||
"configuration-path": "bar",
|
||||
"sync-labels": false,
|
||||
'repo-token': 'foo',
|
||||
'configuration-path': 'bar',
|
||||
'sync-labels': false
|
||||
};
|
||||
|
||||
jest
|
||||
.spyOn(core, "getInput")
|
||||
.spyOn(core, 'getInput')
|
||||
.mockImplementation((name: string, ...opts) => mockInput[name]);
|
||||
|
||||
usingLabelerConfigYaml("only_pdfs.yml");
|
||||
mockGitHubResponseChangedFiles("foo.txt");
|
||||
usingLabelerConfigYaml('only_pdfs.yml');
|
||||
mockGitHubResponseChangedFiles('foo.txt');
|
||||
getPullMock.mockResolvedValue(<any>{
|
||||
data: {
|
||||
labels: [{ name: "touched-a-pdf-file" }],
|
||||
},
|
||||
labels: [{name: 'touched-a-pdf-file'}]
|
||||
}
|
||||
});
|
||||
|
||||
await run();
|
||||
@@ -106,11 +106,11 @@ describe("run", () => {
|
||||
|
||||
function usingLabelerConfigYaml(fixtureName: keyof typeof yamlFixtures): void {
|
||||
reposMock.mockResolvedValue(<any>{
|
||||
data: { content: yamlFixtures[fixtureName], encoding: "utf8" },
|
||||
data: {content: yamlFixtures[fixtureName], encoding: 'utf8'}
|
||||
});
|
||||
}
|
||||
|
||||
function mockGitHubResponseChangedFiles(...files: string[]): void {
|
||||
const returnValue = files.map((f) => ({ filename: f }));
|
||||
const returnValue = files.map(f => ({filename: f}));
|
||||
paginateMock.mockReturnValue(<any>returnValue);
|
||||
}
|
||||
|
||||
4529
dist/index.js
vendored
4529
dist/index.js
vendored
File diff suppressed because one or more lines are too long
208
package-lock.json
generated
208
package-lock.json
generated
@@ -1,37 +1,46 @@
|
||||
{
|
||||
"name": "labeler",
|
||||
"version": "3.1.0",
|
||||
"version": "4.0.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "labeler",
|
||||
"version": "3.0.2",
|
||||
"version": "4.0.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.6.0",
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/github": "^5.0.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"minimatch": "^3.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.4.0",
|
||||
"@types/jest": "^27.4.1",
|
||||
"@types/js-yaml": "^4.0.5",
|
||||
"@types/minimatch": "^3.0.5",
|
||||
"@types/node": "^16.11.7",
|
||||
"@vercel/ncc": "^0.33.3",
|
||||
"@vercel/ncc": "^0.34.0",
|
||||
"jest": "^27.5.1",
|
||||
"prettier": "^2.5.1",
|
||||
"prettier": "^2.7.1",
|
||||
"ts-jest": "^27.1.3",
|
||||
"typescript": "^4.5.5"
|
||||
"typescript": "^4.8.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/core": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.6.0.tgz",
|
||||
"integrity": "sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==",
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz",
|
||||
"integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==",
|
||||
"dependencies": {
|
||||
"@actions/http-client": "^1.0.11"
|
||||
"@actions/http-client": "^2.0.1",
|
||||
"uuid": "^8.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/core/node_modules/@actions/http-client": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
|
||||
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
|
||||
"dependencies": {
|
||||
"tunnel": "^0.0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/github": {
|
||||
@@ -1172,12 +1181,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@types/jest": {
|
||||
"version": "27.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.4.0.tgz",
|
||||
"integrity": "sha512-gHl8XuC1RZ8H2j5sHv/JqsaxXkDDM9iDOgu0Wp8sjs4u/snb2PVehyWXJPr+ORA0RPpgw231mnutWI1+0hgjIQ==",
|
||||
"version": "27.4.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.4.1.tgz",
|
||||
"integrity": "sha512-23iPJADSmicDVrWk+HT58LMJtzLAnB2AgIzplQuq/bSrGaxCrlvRFjGbXmamnnk/mAmCdLStiGqggu28ocUyiw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"jest-diff": "^27.0.0",
|
||||
"jest-matcher-utils": "^27.0.0",
|
||||
"pretty-format": "^27.0.0"
|
||||
}
|
||||
},
|
||||
@@ -1227,9 +1236,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@vercel/ncc": {
|
||||
"version": "0.33.3",
|
||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.33.3.tgz",
|
||||
"integrity": "sha512-JGZ11QV+/ZcfudW2Cz2JVp54/pJNXbsuWRgSh2ZmmZdQBKXqBtIGrwI1Wyx8nlbzAiEFe7FHi4K1zX4//jxTnQ==",
|
||||
"version": "0.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.34.0.tgz",
|
||||
"integrity": "sha512-G9h5ZLBJ/V57Ou9vz5hI8pda/YQX5HQszCs3AmIus3XzsmRn/0Ptic5otD3xVST8QLKk7AMk7AqpsyQGN7MZ9A==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"ncc": "dist/ncc/cli.js"
|
||||
@@ -3297,9 +3306,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/minimatch": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||
"dependencies": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
},
|
||||
@@ -3308,9 +3317,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/minimist": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
|
||||
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/ms": {
|
||||
@@ -3326,11 +3335,41 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/node-fetch": {
|
||||
"version": "2.6.1",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
|
||||
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==",
|
||||
"version": "2.6.7",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
|
||||
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
|
||||
"dependencies": {
|
||||
"whatwg-url": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.x || >=6.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"encoding": "^0.1.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"encoding": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/node-fetch/node_modules/tr46": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||
"integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
|
||||
},
|
||||
"node_modules/node-fetch/node_modules/webidl-conversions": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||
"integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
|
||||
},
|
||||
"node_modules/node-fetch/node_modules/whatwg-url": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
||||
"integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=",
|
||||
"dependencies": {
|
||||
"tr46": "~0.0.3",
|
||||
"webidl-conversions": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/node-int64": {
|
||||
@@ -3545,15 +3584,18 @@
|
||||
}
|
||||
},
|
||||
"node_modules/prettier": {
|
||||
"version": "2.5.1",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz",
|
||||
"integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==",
|
||||
"version": "2.7.1",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz",
|
||||
"integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"prettier": "bin-prettier.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.13.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/prettier/prettier?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/pretty-format": {
|
||||
@@ -4110,9 +4152,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.5.5",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz",
|
||||
"integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==",
|
||||
"version": "4.8.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
|
||||
"integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
@@ -4136,6 +4178,14 @@
|
||||
"node": ">= 4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/uuid": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/v8-to-istanbul": {
|
||||
"version": "8.1.1",
|
||||
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz",
|
||||
@@ -4363,11 +4413,22 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.6.0.tgz",
|
||||
"integrity": "sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==",
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz",
|
||||
"integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==",
|
||||
"requires": {
|
||||
"@actions/http-client": "^1.0.11"
|
||||
"@actions/http-client": "^2.0.1",
|
||||
"uuid": "^8.3.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/http-client": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
|
||||
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
|
||||
"requires": {
|
||||
"tunnel": "^0.0.6"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@actions/github": {
|
||||
@@ -5292,12 +5353,12 @@
|
||||
}
|
||||
},
|
||||
"@types/jest": {
|
||||
"version": "27.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.4.0.tgz",
|
||||
"integrity": "sha512-gHl8XuC1RZ8H2j5sHv/JqsaxXkDDM9iDOgu0Wp8sjs4u/snb2PVehyWXJPr+ORA0RPpgw231mnutWI1+0hgjIQ==",
|
||||
"version": "27.4.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.4.1.tgz",
|
||||
"integrity": "sha512-23iPJADSmicDVrWk+HT58LMJtzLAnB2AgIzplQuq/bSrGaxCrlvRFjGbXmamnnk/mAmCdLStiGqggu28ocUyiw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"jest-diff": "^27.0.0",
|
||||
"jest-matcher-utils": "^27.0.0",
|
||||
"pretty-format": "^27.0.0"
|
||||
}
|
||||
},
|
||||
@@ -5347,9 +5408,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@vercel/ncc": {
|
||||
"version": "0.33.3",
|
||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.33.3.tgz",
|
||||
"integrity": "sha512-JGZ11QV+/ZcfudW2Cz2JVp54/pJNXbsuWRgSh2ZmmZdQBKXqBtIGrwI1Wyx8nlbzAiEFe7FHi4K1zX4//jxTnQ==",
|
||||
"version": "0.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.34.0.tgz",
|
||||
"integrity": "sha512-G9h5ZLBJ/V57Ou9vz5hI8pda/YQX5HQszCs3AmIus3XzsmRn/0Ptic5otD3xVST8QLKk7AMk7AqpsyQGN7MZ9A==",
|
||||
"dev": true
|
||||
},
|
||||
"abab": {
|
||||
@@ -6933,17 +6994,17 @@
|
||||
"dev": true
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
},
|
||||
"minimist": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
|
||||
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
|
||||
"dev": true
|
||||
},
|
||||
"ms": {
|
||||
@@ -6959,9 +7020,33 @@
|
||||
"dev": true
|
||||
},
|
||||
"node-fetch": {
|
||||
"version": "2.6.1",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
|
||||
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
|
||||
"version": "2.6.7",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
|
||||
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
|
||||
"requires": {
|
||||
"whatwg-url": "^5.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"tr46": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||
"integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
|
||||
},
|
||||
"webidl-conversions": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||
"integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
|
||||
},
|
||||
"whatwg-url": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
||||
"integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=",
|
||||
"requires": {
|
||||
"tr46": "~0.0.3",
|
||||
"webidl-conversions": "^3.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"node-int64": {
|
||||
"version": "0.4.0",
|
||||
@@ -7121,9 +7206,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"prettier": {
|
||||
"version": "2.5.1",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz",
|
||||
"integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==",
|
||||
"version": "2.7.1",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz",
|
||||
"integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==",
|
||||
"dev": true
|
||||
},
|
||||
"pretty-format": {
|
||||
@@ -7521,9 +7606,9 @@
|
||||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.5.5",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz",
|
||||
"integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==",
|
||||
"version": "4.8.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
|
||||
"integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
|
||||
"dev": true
|
||||
},
|
||||
"universal-user-agent": {
|
||||
@@ -7537,6 +7622,11 @@
|
||||
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
|
||||
"dev": true
|
||||
},
|
||||
"uuid": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
|
||||
},
|
||||
"v8-to-istanbul": {
|
||||
"version": "8.1.1",
|
||||
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz",
|
||||
|
||||
17
package.json
17
package.json
@@ -1,12 +1,13 @@
|
||||
{
|
||||
"name": "labeler",
|
||||
"version": "3.1.0",
|
||||
"version": "4.0.1",
|
||||
"description": "Labels pull requests by files altered",
|
||||
"main": "lib/main.js",
|
||||
"scripts": {
|
||||
"build": "tsc && ncc build lib/main.js",
|
||||
"format": "prettier --write \"**/*.ts\"",
|
||||
"format-check": "prettier --check \"**/*.ts\"",
|
||||
"format": "prettier --write **/*.ts",
|
||||
"format-check": "prettier --check **/*.ts",
|
||||
"lint": "echo \"Fake command that does nothing. It is used in reusable workflows\"",
|
||||
"test": "jest"
|
||||
},
|
||||
"repository": {
|
||||
@@ -22,20 +23,20 @@
|
||||
"author": "GitHub",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.6.0",
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/github": "^5.0.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"minimatch": "^3.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.4.0",
|
||||
"@types/jest": "^27.4.1",
|
||||
"@types/node": "^16.11.7",
|
||||
"@types/minimatch": "^3.0.5",
|
||||
"@types/js-yaml": "^4.0.5",
|
||||
"@vercel/ncc": "^0.33.3",
|
||||
"@vercel/ncc": "^0.34.0",
|
||||
"jest": "^27.5.1",
|
||||
"prettier": "^2.5.1",
|
||||
"prettier": "^2.7.1",
|
||||
"ts-jest": "^27.1.3",
|
||||
"typescript": "^4.5.5"
|
||||
"typescript": "^4.8.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as core from "@actions/core";
|
||||
import * as github from "@actions/github";
|
||||
import * as yaml from "js-yaml";
|
||||
import { Minimatch, IMinimatch } from "minimatch";
|
||||
import * as core from '@actions/core';
|
||||
import * as github from '@actions/github';
|
||||
import * as yaml from 'js-yaml';
|
||||
import {Minimatch, IMinimatch} from 'minimatch';
|
||||
|
||||
interface MatchConfig {
|
||||
all?: string[];
|
||||
@@ -13,22 +13,22 @@ type ClientType = ReturnType<typeof github.getOctokit>;
|
||||
|
||||
export async function run() {
|
||||
try {
|
||||
const token = core.getInput("repo-token", { required: true });
|
||||
const configPath = core.getInput("configuration-path", { required: true });
|
||||
const syncLabels = !!core.getInput("sync-labels", { required: false });
|
||||
const token = core.getInput('repo-token', {required: true});
|
||||
const configPath = core.getInput('configuration-path', {required: true});
|
||||
const syncLabels = !!core.getInput('sync-labels', {required: false});
|
||||
|
||||
const prNumber = getPrNumber();
|
||||
if (!prNumber) {
|
||||
console.log("Could not get pull request number from context, exiting");
|
||||
console.log('Could not get pull request number from context, exiting');
|
||||
return;
|
||||
}
|
||||
|
||||
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,
|
||||
repo: github.context.repo.repo,
|
||||
pull_number: prNumber,
|
||||
pull_number: prNumber
|
||||
});
|
||||
|
||||
core.debug(`fetching changed files for pr #${prNumber}`);
|
||||
@@ -44,7 +44,7 @@ export async function run() {
|
||||
core.debug(`processing ${label}`);
|
||||
if (checkGlobs(changedFiles, globs)) {
|
||||
labels.push(label);
|
||||
} else if (pullRequest.labels.find((l) => l.name === label)) {
|
||||
} else if (pullRequest.labels.find(l => l.name === label)) {
|
||||
labelsToRemove.push(label);
|
||||
}
|
||||
}
|
||||
@@ -78,15 +78,15 @@ async function getChangedFiles(
|
||||
const listFilesOptions = client.rest.pulls.listFiles.endpoint.merge({
|
||||
owner: github.context.repo.owner,
|
||||
repo: github.context.repo.repo,
|
||||
pull_number: prNumber,
|
||||
pull_number: prNumber
|
||||
});
|
||||
|
||||
const listFilesResponse = await client.paginate(listFilesOptions);
|
||||
const changedFiles = listFilesResponse.map((f: any) => f.filename);
|
||||
|
||||
core.debug("found changed files:");
|
||||
core.debug('found changed files:');
|
||||
for (const file of changedFiles) {
|
||||
core.debug(" " + file);
|
||||
core.debug(' ' + file);
|
||||
}
|
||||
|
||||
return changedFiles;
|
||||
@@ -116,7 +116,7 @@ async function fetchContent(
|
||||
owner: github.context.repo.owner,
|
||||
repo: github.context.repo.repo,
|
||||
path: repoPath,
|
||||
ref: github.context.sha,
|
||||
ref: github.context.sha
|
||||
});
|
||||
|
||||
return Buffer.from(response.data.content, response.data.encoding).toString();
|
||||
@@ -127,7 +127,7 @@ function getLabelGlobMapFromObject(
|
||||
): Map<string, StringOrMatchConfig[]> {
|
||||
const labelGlobs: Map<string, StringOrMatchConfig[]> = new Map();
|
||||
for (const label in configObject) {
|
||||
if (typeof configObject[label] === "string") {
|
||||
if (typeof configObject[label] === 'string') {
|
||||
labelGlobs.set(label, [configObject[label]]);
|
||||
} else if (configObject[label] instanceof Array) {
|
||||
labelGlobs.set(label, configObject[label]);
|
||||
@@ -142,9 +142,9 @@ function getLabelGlobMapFromObject(
|
||||
}
|
||||
|
||||
function toMatchConfig(config: StringOrMatchConfig): MatchConfig {
|
||||
if (typeof config === "string") {
|
||||
if (typeof config === 'string') {
|
||||
return {
|
||||
any: [config],
|
||||
any: [config]
|
||||
};
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ function toMatchConfig(config: StringOrMatchConfig): MatchConfig {
|
||||
}
|
||||
|
||||
function printPattern(matcher: IMinimatch): string {
|
||||
return (matcher.negate ? "!" : "") + matcher.pattern;
|
||||
return (matcher.negate ? '!' : '') + matcher.pattern;
|
||||
}
|
||||
|
||||
export function checkGlobs(
|
||||
@@ -185,7 +185,7 @@ function isMatch(changedFile: string, matchers: IMinimatch[]): boolean {
|
||||
|
||||
// equivalent to "Array.some()" but expanded for debugging and clarity
|
||||
function checkAny(changedFiles: string[], globs: string[]): boolean {
|
||||
const matchers = globs.map((g) => new Minimatch(g));
|
||||
const matchers = globs.map(g => new Minimatch(g));
|
||||
core.debug(` checking "any" patterns`);
|
||||
for (const changedFile of changedFiles) {
|
||||
if (isMatch(changedFile, matchers)) {
|
||||
@@ -200,7 +200,7 @@ function checkAny(changedFiles: string[], globs: string[]): boolean {
|
||||
|
||||
// equivalent to "Array.every()" but expanded for debugging and clarity
|
||||
function checkAll(changedFiles: string[], globs: string[]): boolean {
|
||||
const matchers = globs.map((g) => new Minimatch(g));
|
||||
const matchers = globs.map(g => new Minimatch(g));
|
||||
core.debug(` checking "all" patterns`);
|
||||
for (const changedFile of changedFiles) {
|
||||
if (!isMatch(changedFile, matchers)) {
|
||||
@@ -238,7 +238,7 @@ async function addLabels(
|
||||
owner: github.context.repo.owner,
|
||||
repo: github.context.repo.repo,
|
||||
issue_number: prNumber,
|
||||
labels: labels,
|
||||
labels: labels
|
||||
});
|
||||
}
|
||||
|
||||
@@ -248,12 +248,12 @@ async function removeLabels(
|
||||
labels: string[]
|
||||
) {
|
||||
await Promise.all(
|
||||
labels.map((label) =>
|
||||
labels.map(label =>
|
||||
client.rest.issues.removeLabel({
|
||||
owner: github.context.repo.owner,
|
||||
repo: github.context.repo.repo,
|
||||
issue_number: prNumber,
|
||||
name: label,
|
||||
name: label
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import { run } from "./labeler";
|
||||
import {run} from './labeler';
|
||||
|
||||
run();
|
||||
|
||||
Reference in New Issue
Block a user