Compare commits

...

47 Commits

Author SHA1 Message Date
Evgenii Korolevskii
6870bfd4e8 Update CODEOWNERS 2022-12-26 09:47:41 +01:00
Ivan
91690a7e55 Merge pull request #470 from akv-platform/apply-reusable-workflows
Update action to use reusable workflows
2022-12-22 10:50:36 +02:00
Lukas Hennies
f7b1827ed3 docs: minor hint regarding glob notation (#285) 2022-12-21 15:59:36 +01:00
IvanZosimov
55e1958307 Fix review points 2022-12-20 16:53:03 +01:00
MaksimZhukov
34b1b365e1 Merge pull request #278 from jsoref/fix-at-example
Fix @ example
2022-12-20 10:25:28 +01:00
IvanZosimov
ce7f13552d Rebuild project 2022-12-19 17:18:39 +01:00
IvanZosimov
0cad484cd0 Add .prettierrc.json to configure Prettier, reformat code 2022-12-19 17:09:22 +01:00
IvanZosimov
d42abd99fe Update prettier commands 2022-12-19 16:58:25 +01:00
IvanZosimov
e63db1786a Update licenses and rebuild action 2022-12-19 16:48:00 +01:00
IvanZosimov
cdcdd9a42c Update dependency to eliminate vulnerability 2022-12-19 16:43:21 +01:00
IvanZosimov
e07202b67f Update workflows to use reusable-workflows 2022-12-19 16:40:34 +01:00
Marko Zivic
5776c3457c Merge pull request #463 from MaksimZhukov/add-issue-templates
Add issue templates and workflow files
2022-12-14 09:50:11 +01:00
MaksimZhukov
1e8fa0b154 Add issue templates and workflow files 2022-12-07 09:17:16 +01:00
dependabot[bot]
3e20f3d061 Bump typescript from 4.8.2 to 4.8.4 (#440)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.8.2 to 4.8.4.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.8.2...v4.8.4)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-15 11:43:09 -05:00
Francesco Renzi
5c7539237e Merge pull request #444 from actions/rentziass/update-actions-core
Update @actions/core to 1.10.0
2022-10-07 11:04:13 +01:00
Francesco Renzi
d8fb392051 Update @actions/core to 1.10.0 2022-10-06 11:51:14 +01:00
Patrick Ellis
a96e5aec3e Regenerate package-lock with latest node/npm (#435)
This just added a "name" field to the innermost "package" entry.
2022-09-07 11:19:54 -04:00
dependabot[bot]
9f8414f4c4 Bump typescript from 4.6.3 to 4.8.2 (#430)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.6.3 to 4.8.2.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.6.3...v4.8.2)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-07 10:41:20 -04:00
dependabot[bot]
97727458a9 Bump prettier from 2.6.2 to 2.7.1 (#402)
Bumps [prettier](https://github.com/prettier/prettier) from 2.6.2 to 2.7.1.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.6.2...2.7.1)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-07 10:36:59 -04:00
Patrick Ellis
e54e5b338f 4.0.1 (#422) 2022-08-12 12:23:34 -04:00
Patrick Ellis
fd87190791 Bump package.json version to 4.0.0 (#419) 2022-08-12 11:01:38 -04:00
Patrick Ellis
c959bdd7a7 Merge pull request #417 from cory-miller/main
Bump @actions/core to 1.9.1
2022-08-12 10:32:46 -04:00
Cory Miller
493ae8a9ee re-build package 2022-08-11 15:43:30 -04:00
Cory Miller
15508143cd fix license type for other version of actions/http-client 2022-08-11 15:31:09 -04:00
Cory Miller
a29491a7fe fix license type for actions/http-client 2022-08-11 15:29:30 -04:00
Cory Miller
6e5bdb78b3 Updates licenses 2022-08-11 14:57:12 -04:00
Cory Miller
3d918ddbb6 Bump @actions/core 2022-08-11 14:24:26 -04:00
Patrick Ellis
74e99cda29 Merge pull request #376 from actions/dependabot/npm_and_yarn/vercel/ncc-0.34.0
Bump @vercel/ncc from 0.33.3 to 0.34.0
2022-07-18 07:31:49 -07:00
dependabot[bot]
d81b3992ae Bump @vercel/ncc from 0.33.3 to 0.34.0
Bumps [@vercel/ncc](https://github.com/vercel/ncc) from 0.33.3 to 0.34.0.
- [Release notes](https://github.com/vercel/ncc/releases)
- [Commits](https://github.com/vercel/ncc/compare/0.33.3...0.34.0)

---
updated-dependencies:
- dependency-name: "@vercel/ncc"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-26 15:01:09 +00:00
Patrick Ellis
ed55e8ab1f Merge pull request #341 from actions/dependabot/npm_and_yarn/typescript-4.6.3
Bump typescript from 4.6.2 to 4.6.3
2022-04-21 13:28:23 -04:00
dependabot[bot]
a0f7b6adbb Bump typescript from 4.6.2 to 4.6.3
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.6.2 to 4.6.3.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.6.2...v4.6.3)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-21 17:26:03 +00:00
Patrick Ellis
cec8dc03de Merge pull request #345 from actions/dependabot/npm_and_yarn/prettier-2.6.2
Bump prettier from 2.6.0 to 2.6.2
2022-04-21 13:25:20 -04:00
dependabot[bot]
6683f4636c Bump prettier from 2.6.0 to 2.6.2
Bumps [prettier](https://github.com/prettier/prettier) from 2.6.0 to 2.6.2.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.6.0...2.6.2)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-04 15:01:05 +00:00
Tingluo Huang
0214ec66d5 Merge pull request #343 from actions/dependabot/npm_and_yarn/minimist-1.2.6
Bump minimist from 1.2.5 to 1.2.6
2022-03-31 10:07:39 -04:00
dependabot[bot]
e53d3555ec Bump minimist from 1.2.5 to 1.2.6
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-31 14:04:03 +00:00
Patrick Ellis
6a315d4ea5 Merge pull request #314 from jamietanna/patch-1
Clarify `permissions` required to use Action
2022-03-16 11:24:09 -04:00
Patrick Ellis
b322dc2e83 Merge pull request #336 from actions/dependabot/npm_and_yarn/prettier-2.6.0
Bump prettier from 2.5.1 to 2.6.0
2022-03-16 11:22:13 -04:00
dependabot[bot]
ede5dd4883 Bump prettier from 2.5.1 to 2.6.0
Bumps [prettier](https://github.com/prettier/prettier) from 2.5.1 to 2.6.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.5.1...2.6.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-16 15:01:14 +00:00
licensed-ci
2a23f11dfe Auto-update license files 2022-03-15 16:06:37 +00:00
Patrick Ellis
df112f56d9 Merge pull request #331 from actions/dependabot/npm_and_yarn/node-fetch-2.6.7
Bump node-fetch from 2.6.1 to 2.6.7
2022-03-15 12:05:56 -04:00
Patrick Ellis
1dd2c80f71 Merge pull request #332 from actions/dependabot/npm_and_yarn/typescript-4.6.2
Bump typescript from 4.5.5 to 4.6.2
2022-03-11 13:13:37 -05:00
Patrick Ellis
3f59b1dc2a Merge pull request #333 from actions/dependabot/npm_and_yarn/types/jest-27.4.1
Bump @types/jest from 27.4.0 to 27.4.1
2022-03-11 13:13:20 -05:00
dependabot[bot]
0628b00436 Bump @types/jest from 27.4.0 to 27.4.1
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 27.4.0 to 27.4.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

---
updated-dependencies:
- dependency-name: "@types/jest"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-01 15:01:09 +00:00
dependabot[bot]
a426bff63f Bump typescript from 4.5.5 to 4.6.2
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.5.5 to 4.6.2.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.5.5...v4.6.2)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-01 15:01:00 +00:00
dependabot[bot]
f8b85e1472 Bump node-fetch from 2.6.1 to 2.6.7
Bumps [node-fetch](https://github.com/node-fetch/node-fetch) from 2.6.1 to 2.6.7.
- [Release notes](https://github.com/node-fetch/node-fetch/releases)
- [Commits](https://github.com/node-fetch/node-fetch/compare/v2.6.1...v2.6.7)

---
updated-dependencies:
- dependency-name: node-fetch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-28 18:38:32 +00:00
Jamie Tanna
c8a666accc Clarify permissions required to use Action
As a means to reduce the privileges provided to the job executing, we
can document what the minimal `permissions` required for the Actions'
`GITHUB_TOKEN` is.
2022-02-02 15:43:53 +00:00
Josh Soref
c79c655b8b Fix @ example 2021-11-23 20:57:39 -05:00
31 changed files with 4931 additions and 412 deletions

35
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View 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
View File

@@ -0,0 +1 @@
blank_issues_enabled: false

View 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
View 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
View 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

View File

@@ -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
View 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
View 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
View 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

View 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 }}

View File

@@ -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

View File

@@ -1,6 +1,6 @@
--- ---
name: "@actions/core" name: "@actions/core"
version: 1.6.0 version: 1.10.0
type: npm type: npm
summary: Actions core lib summary: Actions core lib
homepage: https://github.com/actions/toolkit/tree/main/packages/core homepage: https://github.com/actions/toolkit/tree/main/packages/core

View 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: []

View File

@@ -1,6 +1,6 @@
--- ---
name: minimatch name: minimatch
version: 3.0.4 version: 3.1.2
type: npm type: npm
summary: a glob matcher in javascript summary: a glob matcher in javascript
homepage: homepage:

View File

@@ -1,6 +1,6 @@
--- ---
name: node-fetch name: node-fetch
version: 2.6.1 version: 2.6.7
type: npm type: npm
summary: A light-weight module that brings window.fetch to node.js summary: A light-weight module that brings window.fetch to node.js
homepage: https://github.com/bitinn/node-fetch homepage: https://github.com/bitinn/node-fetch

30
.licenses/npm/tr46.dep.yml generated Normal file
View 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
View 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
View 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
View 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) 20152016 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
View 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"
}

View File

@@ -1 +1 @@
* @actions/actions-runtime * @actions/setup-actions-team

View File

@@ -56,6 +56,11 @@ label1:
# Add 'label2' to any file changes within 'example2' folder # Add 'label2' to any file changes within 'example2' folder
label2: example2/* 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 #### Common Examples
@@ -66,7 +71,7 @@ repo:
- '*' - '*'
# 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/* - package/core/*
- package/core/**/* - package/core/**/*
@@ -95,6 +100,9 @@ on:
jobs: jobs:
triage: triage:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/labeler@v4 - 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 | | 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` | | `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`

View File

@@ -1,34 +1,34 @@
export const context = { export const context = {
payload: { payload: {
pull_request: { pull_request: {
number: 123, number: 123
}, }
}, },
repo: { repo: {
owner: "monalisa", owner: 'monalisa',
repo: "helloworld", repo: 'helloworld'
}, }
}; };
const mockApi = { const mockApi = {
rest: { rest: {
issues: { issues: {
addLabels: jest.fn(), addLabels: jest.fn(),
removeLabel: jest.fn(), removeLabel: jest.fn()
}, },
pulls: { pulls: {
get: jest.fn().mockResolvedValue({}), get: jest.fn().mockResolvedValue({}),
listFiles: { listFiles: {
endpoint: { endpoint: {
merge: jest.fn().mockReturnValue({}), merge: jest.fn().mockReturnValue({})
}, }
}, }
}, },
repos: { repos: {
getContent: jest.fn(), getContent: jest.fn()
}, }
}, },
paginate: jest.fn(), paginate: jest.fn()
}; };
export const getOctokit = jest.fn().mockImplementation(() => mockApi); export const getOctokit = jest.fn().mockImplementation(() => mockApi);

View File

@@ -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(() => { beforeAll(() => {
jest.spyOn(core, "getInput").mockImplementation((name, options) => { jest.spyOn(core, 'getInput').mockImplementation((name, options) => {
return jest.requireActual("@actions/core").getInput(name, options); return jest.requireActual('@actions/core').getInput(name, options);
}); });
}); });
const matchConfig = [{ any: ["*.txt"] }]; const matchConfig = [{any: ['*.txt']}];
describe("checkGlobs", () => { 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); const result = checkGlobs(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); const result = checkGlobs(changedFiles, matchConfig);
expect(result).toBeFalsy(); expect(result).toBeFalsy();

View File

@@ -1,45 +1,45 @@
import { run } from "../src/labeler"; import {run} from '../src/labeler';
import * as github from "@actions/github"; import * as github from '@actions/github';
import * as core from "@actions/core"; import * as core from '@actions/core';
const fs = jest.requireActual("fs"); const fs = jest.requireActual('fs');
jest.mock("@actions/core"); jest.mock('@actions/core');
jest.mock("@actions/github"); jest.mock('@actions/github');
const gh = github.getOctokit("_"); const gh = github.getOctokit('_');
const addLabelsMock = jest.spyOn(gh.rest.issues, "addLabels"); const addLabelsMock = jest.spyOn(gh.rest.issues, 'addLabels');
const removeLabelMock = jest.spyOn(gh.rest.issues, "removeLabel"); 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 yamlFixtures = { 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()); afterAll(() => jest.restoreAllMocks());
describe("run", () => { describe('run', () => {
it("adds labels to PRs that match our glob patterns", async () => { it('adds labels to PRs that match our glob patterns', async () => {
usingLabelerConfigYaml("only_pdfs.yml"); usingLabelerConfigYaml('only_pdfs.yml');
mockGitHubResponseChangedFiles("foo.pdf"); mockGitHubResponseChangedFiles('foo.pdf');
await run(); await run();
expect(removeLabelMock).toHaveBeenCalledTimes(0); expect(removeLabelMock).toHaveBeenCalledTimes(0);
expect(addLabelsMock).toHaveBeenCalledTimes(1); expect(addLabelsMock).toHaveBeenCalledTimes(1);
expect(addLabelsMock).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']
}); });
}); });
it("does not add labels to PRs that do not match our glob patterns", async () => { it('does not add labels to PRs that do not match our glob patterns', async () => {
usingLabelerConfigYaml("only_pdfs.yml"); usingLabelerConfigYaml('only_pdfs.yml');
mockGitHubResponseChangedFiles("foo.txt"); mockGitHubResponseChangedFiles('foo.txt');
await run(); await run();
@@ -47,23 +47,23 @@ describe("run", () => {
expect(addLabelsMock).toHaveBeenCalledTimes(0); 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 = { let mockInput = {
"repo-token": "foo", 'repo-token': 'foo',
"configuration-path": "bar", 'configuration-path': 'bar',
"sync-labels": true, 'sync-labels': true
}; };
jest jest
.spyOn(core, "getInput") .spyOn(core, 'getInput')
.mockImplementation((name: string, ...opts) => mockInput[name]); .mockImplementation((name: string, ...opts) => mockInput[name]);
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" }], labels: [{name: 'touched-a-pdf-file'}]
}, }
}); });
await run(); await run();
@@ -71,30 +71,30 @@ describe("run", () => {
expect(addLabelsMock).toHaveBeenCalledTimes(0); expect(addLabelsMock).toHaveBeenCalledTimes(0);
expect(removeLabelMock).toHaveBeenCalledTimes(1); expect(removeLabelMock).toHaveBeenCalledTimes(1);
expect(removeLabelMock).toHaveBeenCalledWith({ expect(removeLabelMock).toHaveBeenCalledWith({
owner: "monalisa", owner: 'monalisa',
repo: "helloworld", repo: 'helloworld',
issue_number: 123, 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 = { let mockInput = {
"repo-token": "foo", 'repo-token': 'foo',
"configuration-path": "bar", 'configuration-path': 'bar',
"sync-labels": false, 'sync-labels': false
}; };
jest jest
.spyOn(core, "getInput") .spyOn(core, 'getInput')
.mockImplementation((name: string, ...opts) => mockInput[name]); .mockImplementation((name: string, ...opts) => mockInput[name]);
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" }], labels: [{name: 'touched-a-pdf-file'}]
}, }
}); });
await run(); await run();
@@ -106,11 +106,11 @@ describe("run", () => {
function usingLabelerConfigYaml(fixtureName: keyof typeof yamlFixtures): void { function usingLabelerConfigYaml(fixtureName: keyof typeof yamlFixtures): void {
reposMock.mockResolvedValue(<any>{ reposMock.mockResolvedValue(<any>{
data: { content: yamlFixtures[fixtureName], encoding: "utf8" }, data: {content: yamlFixtures[fixtureName], encoding: 'utf8'}
}); });
} }
function mockGitHubResponseChangedFiles(...files: string[]): void { function mockGitHubResponseChangedFiles(...files: string[]): void {
const returnValue = files.map((f) => ({ filename: f })); const returnValue = files.map(f => ({filename: f}));
paginateMock.mockReturnValue(<any>returnValue); paginateMock.mockReturnValue(<any>returnValue);
} }

4529
dist/index.js vendored

File diff suppressed because one or more lines are too long

208
package-lock.json generated
View File

@@ -1,37 +1,46 @@
{ {
"name": "labeler", "name": "labeler",
"version": "3.1.0", "version": "4.0.1",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "labeler", "name": "labeler",
"version": "3.0.2", "version": "4.0.1",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.6.0", "@actions/core": "^1.10.0",
"@actions/github": "^5.0.0", "@actions/github": "^5.0.0",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"minimatch": "^3.0.4" "minimatch": "^3.0.4"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^27.4.0", "@types/jest": "^27.4.1",
"@types/js-yaml": "^4.0.5", "@types/js-yaml": "^4.0.5",
"@types/minimatch": "^3.0.5", "@types/minimatch": "^3.0.5",
"@types/node": "^16.11.7", "@types/node": "^16.11.7",
"@vercel/ncc": "^0.33.3", "@vercel/ncc": "^0.34.0",
"jest": "^27.5.1", "jest": "^27.5.1",
"prettier": "^2.5.1", "prettier": "^2.7.1",
"ts-jest": "^27.1.3", "ts-jest": "^27.1.3",
"typescript": "^4.5.5" "typescript": "^4.8.4"
} }
}, },
"node_modules/@actions/core": { "node_modules/@actions/core": {
"version": "1.6.0", "version": "1.10.0",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.6.0.tgz", "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz",
"integrity": "sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==", "integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==",
"dependencies": { "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": { "node_modules/@actions/github": {
@@ -1172,12 +1181,12 @@
} }
}, },
"node_modules/@types/jest": { "node_modules/@types/jest": {
"version": "27.4.0", "version": "27.4.1",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.4.0.tgz", "resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.4.1.tgz",
"integrity": "sha512-gHl8XuC1RZ8H2j5sHv/JqsaxXkDDM9iDOgu0Wp8sjs4u/snb2PVehyWXJPr+ORA0RPpgw231mnutWI1+0hgjIQ==", "integrity": "sha512-23iPJADSmicDVrWk+HT58LMJtzLAnB2AgIzplQuq/bSrGaxCrlvRFjGbXmamnnk/mAmCdLStiGqggu28ocUyiw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"jest-diff": "^27.0.0", "jest-matcher-utils": "^27.0.0",
"pretty-format": "^27.0.0" "pretty-format": "^27.0.0"
} }
}, },
@@ -1227,9 +1236,9 @@
"dev": true "dev": true
}, },
"node_modules/@vercel/ncc": { "node_modules/@vercel/ncc": {
"version": "0.33.3", "version": "0.34.0",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.33.3.tgz", "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.34.0.tgz",
"integrity": "sha512-JGZ11QV+/ZcfudW2Cz2JVp54/pJNXbsuWRgSh2ZmmZdQBKXqBtIGrwI1Wyx8nlbzAiEFe7FHi4K1zX4//jxTnQ==", "integrity": "sha512-G9h5ZLBJ/V57Ou9vz5hI8pda/YQX5HQszCs3AmIus3XzsmRn/0Ptic5otD3xVST8QLKk7AMk7AqpsyQGN7MZ9A==",
"dev": true, "dev": true,
"bin": { "bin": {
"ncc": "dist/ncc/cli.js" "ncc": "dist/ncc/cli.js"
@@ -3297,9 +3306,9 @@
} }
}, },
"node_modules/minimatch": { "node_modules/minimatch": {
"version": "3.0.4", "version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dependencies": { "dependencies": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
}, },
@@ -3308,9 +3317,9 @@
} }
}, },
"node_modules/minimist": { "node_modules/minimist": {
"version": "1.2.5", "version": "1.2.6",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
"dev": true "dev": true
}, },
"node_modules/ms": { "node_modules/ms": {
@@ -3326,11 +3335,41 @@
"dev": true "dev": true
}, },
"node_modules/node-fetch": { "node_modules/node-fetch": {
"version": "2.6.1", "version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
"dependencies": {
"whatwg-url": "^5.0.0"
},
"engines": { "engines": {
"node": "4.x || >=6.0.0" "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": { "node_modules/node-int64": {
@@ -3545,15 +3584,18 @@
} }
}, },
"node_modules/prettier": { "node_modules/prettier": {
"version": "2.5.1", "version": "2.7.1",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz",
"integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==", "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==",
"dev": true, "dev": true,
"bin": { "bin": {
"prettier": "bin-prettier.js" "prettier": "bin-prettier.js"
}, },
"engines": { "engines": {
"node": ">=10.13.0" "node": ">=10.13.0"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
} }
}, },
"node_modules/pretty-format": { "node_modules/pretty-format": {
@@ -4110,9 +4152,9 @@
} }
}, },
"node_modules/typescript": { "node_modules/typescript": {
"version": "4.5.5", "version": "4.8.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
"integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
"dev": true, "dev": true,
"bin": { "bin": {
"tsc": "bin/tsc", "tsc": "bin/tsc",
@@ -4136,6 +4178,14 @@
"node": ">= 4.0.0" "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": { "node_modules/v8-to-istanbul": {
"version": "8.1.1", "version": "8.1.1",
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz",
@@ -4363,11 +4413,22 @@
}, },
"dependencies": { "dependencies": {
"@actions/core": { "@actions/core": {
"version": "1.6.0", "version": "1.10.0",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.6.0.tgz", "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz",
"integrity": "sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==", "integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==",
"requires": { "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": { "@actions/github": {
@@ -5292,12 +5353,12 @@
} }
}, },
"@types/jest": { "@types/jest": {
"version": "27.4.0", "version": "27.4.1",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.4.0.tgz", "resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.4.1.tgz",
"integrity": "sha512-gHl8XuC1RZ8H2j5sHv/JqsaxXkDDM9iDOgu0Wp8sjs4u/snb2PVehyWXJPr+ORA0RPpgw231mnutWI1+0hgjIQ==", "integrity": "sha512-23iPJADSmicDVrWk+HT58LMJtzLAnB2AgIzplQuq/bSrGaxCrlvRFjGbXmamnnk/mAmCdLStiGqggu28ocUyiw==",
"dev": true, "dev": true,
"requires": { "requires": {
"jest-diff": "^27.0.0", "jest-matcher-utils": "^27.0.0",
"pretty-format": "^27.0.0" "pretty-format": "^27.0.0"
} }
}, },
@@ -5347,9 +5408,9 @@
"dev": true "dev": true
}, },
"@vercel/ncc": { "@vercel/ncc": {
"version": "0.33.3", "version": "0.34.0",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.33.3.tgz", "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.34.0.tgz",
"integrity": "sha512-JGZ11QV+/ZcfudW2Cz2JVp54/pJNXbsuWRgSh2ZmmZdQBKXqBtIGrwI1Wyx8nlbzAiEFe7FHi4K1zX4//jxTnQ==", "integrity": "sha512-G9h5ZLBJ/V57Ou9vz5hI8pda/YQX5HQszCs3AmIus3XzsmRn/0Ptic5otD3xVST8QLKk7AMk7AqpsyQGN7MZ9A==",
"dev": true "dev": true
}, },
"abab": { "abab": {
@@ -6933,17 +6994,17 @@
"dev": true "dev": true
}, },
"minimatch": { "minimatch": {
"version": "3.0.4", "version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
}, },
"minimist": { "minimist": {
"version": "1.2.5", "version": "1.2.6",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
"dev": true "dev": true
}, },
"ms": { "ms": {
@@ -6959,9 +7020,33 @@
"dev": true "dev": true
}, },
"node-fetch": { "node-fetch": {
"version": "2.6.1", "version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" "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": { "node-int64": {
"version": "0.4.0", "version": "0.4.0",
@@ -7121,9 +7206,9 @@
"dev": true "dev": true
}, },
"prettier": { "prettier": {
"version": "2.5.1", "version": "2.7.1",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz",
"integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==", "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==",
"dev": true "dev": true
}, },
"pretty-format": { "pretty-format": {
@@ -7521,9 +7606,9 @@
} }
}, },
"typescript": { "typescript": {
"version": "4.5.5", "version": "4.8.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
"integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
"dev": true "dev": true
}, },
"universal-user-agent": { "universal-user-agent": {
@@ -7537,6 +7622,11 @@
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
"dev": true "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": { "v8-to-istanbul": {
"version": "8.1.1", "version": "8.1.1",
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz",

View File

@@ -1,12 +1,13 @@
{ {
"name": "labeler", "name": "labeler",
"version": "3.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": {
"build": "tsc && ncc build lib/main.js", "build": "tsc && ncc build lib/main.js",
"format": "prettier --write \"**/*.ts\"", "format": "prettier --write **/*.ts",
"format-check": "prettier --check \"**/*.ts\"", "format-check": "prettier --check **/*.ts",
"lint": "echo \"Fake command that does nothing. It is used in reusable workflows\"",
"test": "jest" "test": "jest"
}, },
"repository": { "repository": {
@@ -22,20 +23,20 @@
"author": "GitHub", "author": "GitHub",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.6.0", "@actions/core": "^1.10.0",
"@actions/github": "^5.0.0", "@actions/github": "^5.0.0",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"minimatch": "^3.0.4" "minimatch": "^3.0.4"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^27.4.0", "@types/jest": "^27.4.1",
"@types/node": "^16.11.7", "@types/node": "^16.11.7",
"@types/minimatch": "^3.0.5", "@types/minimatch": "^3.0.5",
"@types/js-yaml": "^4.0.5", "@types/js-yaml": "^4.0.5",
"@vercel/ncc": "^0.33.3", "@vercel/ncc": "^0.34.0",
"jest": "^27.5.1", "jest": "^27.5.1",
"prettier": "^2.5.1", "prettier": "^2.7.1",
"ts-jest": "^27.1.3", "ts-jest": "^27.1.3",
"typescript": "^4.5.5" "typescript": "^4.8.4"
} }
} }

View File

@@ -1,7 +1,7 @@
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 yaml from "js-yaml"; import * as yaml from 'js-yaml';
import { Minimatch, IMinimatch } from "minimatch"; import {Minimatch, IMinimatch} from 'minimatch';
interface MatchConfig { interface MatchConfig {
all?: string[]; all?: string[];
@@ -13,22 +13,22 @@ type ClientType = ReturnType<typeof github.getOctokit>;
export async function run() { export async function run() {
try { try {
const token = core.getInput("repo-token", { required: true }); const token = core.getInput('repo-token', {required: true});
const configPath = core.getInput("configuration-path", { required: true }); const configPath = core.getInput('configuration-path', {required: true});
const syncLabels = !!core.getInput("sync-labels", { required: false }); const syncLabels = !!core.getInput('sync-labels', {required: false});
const prNumber = getPrNumber(); const prNumber = getPrNumber();
if (!prNumber) { 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; return;
} }
const client: ClientType = github.getOctokit(token); 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,
repo: github.context.repo.repo, repo: github.context.repo.repo,
pull_number: prNumber, pull_number: prNumber
}); });
core.debug(`fetching changed files for pr #${prNumber}`); core.debug(`fetching changed files for pr #${prNumber}`);
@@ -44,7 +44,7 @@ export async function run() {
core.debug(`processing ${label}`); core.debug(`processing ${label}`);
if (checkGlobs(changedFiles, globs)) { if (checkGlobs(changedFiles, globs)) {
labels.push(label); labels.push(label);
} else if (pullRequest.labels.find((l) => l.name === label)) { } else if (pullRequest.labels.find(l => l.name === label)) {
labelsToRemove.push(label); labelsToRemove.push(label);
} }
} }
@@ -78,15 +78,15 @@ async function getChangedFiles(
const listFilesOptions = client.rest.pulls.listFiles.endpoint.merge({ const listFilesOptions = client.rest.pulls.listFiles.endpoint.merge({
owner: github.context.repo.owner, owner: github.context.repo.owner,
repo: github.context.repo.repo, repo: github.context.repo.repo,
pull_number: prNumber, pull_number: prNumber
}); });
const listFilesResponse = await client.paginate(listFilesOptions); const listFilesResponse = await client.paginate(listFilesOptions);
const changedFiles = listFilesResponse.map((f: any) => f.filename); const changedFiles = listFilesResponse.map((f: any) => f.filename);
core.debug("found changed files:"); core.debug('found changed files:');
for (const file of changedFiles) { for (const file of changedFiles) {
core.debug(" " + file); core.debug(' ' + file);
} }
return changedFiles; return changedFiles;
@@ -116,7 +116,7 @@ async function fetchContent(
owner: github.context.repo.owner, owner: github.context.repo.owner,
repo: github.context.repo.repo, repo: github.context.repo.repo,
path: repoPath, path: repoPath,
ref: github.context.sha, ref: github.context.sha
}); });
return Buffer.from(response.data.content, response.data.encoding).toString(); return Buffer.from(response.data.content, response.data.encoding).toString();
@@ -127,7 +127,7 @@ function getLabelGlobMapFromObject(
): Map<string, StringOrMatchConfig[]> { ): Map<string, StringOrMatchConfig[]> {
const labelGlobs: Map<string, StringOrMatchConfig[]> = new Map(); const labelGlobs: Map<string, StringOrMatchConfig[]> = new Map();
for (const label in configObject) { for (const label in configObject) {
if (typeof configObject[label] === "string") { if (typeof configObject[label] === 'string') {
labelGlobs.set(label, [configObject[label]]); labelGlobs.set(label, [configObject[label]]);
} else if (configObject[label] instanceof Array) { } else if (configObject[label] instanceof Array) {
labelGlobs.set(label, configObject[label]); labelGlobs.set(label, configObject[label]);
@@ -142,9 +142,9 @@ function getLabelGlobMapFromObject(
} }
function toMatchConfig(config: StringOrMatchConfig): MatchConfig { function toMatchConfig(config: StringOrMatchConfig): MatchConfig {
if (typeof config === "string") { if (typeof config === 'string') {
return { return {
any: [config], any: [config]
}; };
} }
@@ -152,7 +152,7 @@ function toMatchConfig(config: StringOrMatchConfig): MatchConfig {
} }
function printPattern(matcher: IMinimatch): string { function printPattern(matcher: IMinimatch): string {
return (matcher.negate ? "!" : "") + matcher.pattern; return (matcher.negate ? '!' : '') + matcher.pattern;
} }
export function checkGlobs( export function checkGlobs(
@@ -185,7 +185,7 @@ function isMatch(changedFile: string, matchers: IMinimatch[]): boolean {
// equivalent to "Array.some()" but expanded for debugging and clarity // equivalent to "Array.some()" but expanded for debugging and clarity
function checkAny(changedFiles: string[], globs: string[]): boolean { 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`); core.debug(` checking "any" patterns`);
for (const changedFile of changedFiles) { for (const changedFile of changedFiles) {
if (isMatch(changedFile, matchers)) { 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 // equivalent to "Array.every()" but expanded for debugging and clarity
function checkAll(changedFiles: string[], globs: string[]): boolean { 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`); core.debug(` checking "all" patterns`);
for (const changedFile of changedFiles) { for (const changedFile of changedFiles) {
if (!isMatch(changedFile, matchers)) { if (!isMatch(changedFile, matchers)) {
@@ -238,7 +238,7 @@ async function 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
}); });
} }
@@ -248,12 +248,12 @@ async function removeLabels(
labels: string[] labels: string[]
) { ) {
await Promise.all( await Promise.all(
labels.map((label) => labels.map(label =>
client.rest.issues.removeLabel({ client.rest.issues.removeLabel({
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,
name: label, name: label
}) })
) )
); );

View File

@@ -1,3 +1,3 @@
import { run } from "./labeler"; import {run} from './labeler';
run(); run();