build(deps): bump @actions/github from 4.0.0 to 5.0.0 (#305)

* build(deps): bump @actions/github from 4.0.0 to 5.0.0

Bumps [@actions/github](https://github.com/actions/toolkit/tree/HEAD/packages/github) from 4.0.0 to 5.0.0.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/github/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/github)

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

* fix: Update @action/github 5

* build: new deps & rest fix

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: marocchino <marocchino@users.noreply.github.com>
This commit is contained in:
dependabot[bot] 2021-05-30 10:50:41 +09:00 committed by GitHub
parent 21998583f4
commit 7874cc39cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 336 additions and 167 deletions

View file

@ -49,17 +49,19 @@ it('findPreviousComment', async () => {
}
]
const octokit: any = {
issues: {
listComments: jest.fn(() =>
Promise.resolve({
data: [
commentWithCustomHeader,
comment,
headerFirstComment,
...otherComments
]
})
)
rest: {
issues: {
listComments: jest.fn(() =>
Promise.resolve({
data: [
commentWithCustomHeader,
comment,
headerFirstComment,
...otherComments
]
})
)
}
}
}
@ -70,7 +72,7 @@ it('findPreviousComment', async () => {
expect(await findPreviousComment(octokit, repo, 123, 'LegacyComment')).toBe(
headerFirstComment
)
expect(octokit.issues.listComments).toBeCalledWith({
expect(octokit.rest.issues.listComments).toBeCalledWith({
owner: 'marocchino',
repo: 'sticky-pull-request-comment',
issue_number: 123
@ -82,8 +84,10 @@ describe('updateComment', () => {
beforeEach(() => {
octokit = {
issues: {
updateComment: jest.fn(() => Promise.resolve())
rest: {
issues: {
updateComment: jest.fn(() => Promise.resolve())
}
}
}
})
@ -92,7 +96,7 @@ describe('updateComment', () => {
expect(
await updateComment(octokit, repo, 456, 'hello there', '')
).toBeUndefined()
expect(octokit.issues.updateComment).toBeCalledWith({
expect(octokit.rest.issues.updateComment).toBeCalledWith({
comment_id: 456,
owner: 'marocchino',
repo: 'sticky-pull-request-comment',
@ -101,7 +105,7 @@ describe('updateComment', () => {
expect(
await updateComment(octokit, repo, 456, 'hello there', 'TypeA')
).toBeUndefined()
expect(octokit.issues.updateComment).toBeCalledWith({
expect(octokit.rest.issues.updateComment).toBeCalledWith({
comment_id: 456,
owner: 'marocchino',
repo: 'sticky-pull-request-comment',
@ -117,7 +121,7 @@ describe('updateComment', () => {
'hello there\n<!-- Sticky Pull Request CommentTypeA -->'
)
).toBeUndefined()
expect(octokit.issues.updateComment).toBeCalledWith({
expect(octokit.rest.issues.updateComment).toBeCalledWith({
comment_id: 456,
owner: 'marocchino',
repo: 'sticky-pull-request-comment',
@ -125,9 +129,9 @@ describe('updateComment', () => {
})
})
it('without comment body and previousbody', async () => {
it('without comment body and previous body', async () => {
expect(await updateComment(octokit, repo, 456, '', '')).toBeUndefined()
expect(octokit.issues.updateComment).not.toBeCalled()
expect(octokit.rest.issues.updateComment).not.toBeCalled()
expect(core.warning).toBeCalledWith('Comment body cannot be blank')
})
})
@ -137,8 +141,10 @@ describe('createComment', () => {
beforeEach(() => {
octokit = {
issues: {
createComment: jest.fn(() => Promise.resolve())
rest: {
issues: {
createComment: jest.fn(() => Promise.resolve())
}
}
}
})
@ -147,7 +153,7 @@ describe('createComment', () => {
expect(
await createComment(octokit, repo, 456, 'hello there', '')
).toBeUndefined()
expect(octokit.issues.createComment).toBeCalledWith({
expect(octokit.rest.issues.createComment).toBeCalledWith({
issue_number: 456,
owner: 'marocchino',
repo: 'sticky-pull-request-comment',
@ -156,7 +162,7 @@ describe('createComment', () => {
expect(
await createComment(octokit, repo, 456, 'hello there', 'TypeA')
).toBeUndefined()
expect(octokit.issues.createComment).toBeCalledWith({
expect(octokit.rest.issues.createComment).toBeCalledWith({
issue_number: 456,
owner: 'marocchino',
repo: 'sticky-pull-request-comment',
@ -165,19 +171,21 @@ describe('createComment', () => {
})
it('without comment body and previousBody', async () => {
expect(await createComment(octokit, repo, 456, '', '')).toBeUndefined()
expect(octokit.issues.createComment).not.toBeCalled()
expect(octokit.rest.issues.createComment).not.toBeCalled()
expect(core.warning).toBeCalledWith('Comment body cannot be blank')
})
})
it('deleteComment', async () => {
const octokit: any = {
issues: {
deleteComment: jest.fn(() => Promise.resolve())
rest: {
issues: {
deleteComment: jest.fn(() => Promise.resolve())
}
}
}
expect(await deleteComment(octokit, repo, 456)).toBeUndefined()
expect(octokit.issues.deleteComment).toBeCalledWith({
expect(octokit.rest.issues.deleteComment).toBeCalledWith({
comment_id: 456,
owner: 'marocchino',
repo: 'sticky-pull-request-comment'

305
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

9
dist/licenses.txt generated vendored
View file

@ -12,6 +12,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
@actions/github
MIT
The MIT License (MIT)
Copyright 2019 GitHub
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.
@actions/http-client
MIT

8
lib/comment.js generated
View file

@ -35,7 +35,7 @@ function headerComment(header) {
}
function findPreviousComment(octokit, repo, issue_number, header) {
return __awaiter(this, void 0, void 0, function* () {
const { data: comments } = yield octokit.issues.listComments(Object.assign(Object.assign({}, repo), { issue_number }));
const { data: comments } = yield octokit.rest.issues.listComments(Object.assign(Object.assign({}, repo), { issue_number }));
const h = headerComment(header);
return comments.find(comment => { var _a; return (_a = comment.body) === null || _a === void 0 ? void 0 : _a.includes(h); });
});
@ -45,7 +45,7 @@ function updateComment(octokit, repo, comment_id, body, header, previousBody) {
return __awaiter(this, void 0, void 0, function* () {
if (!body && !previousBody)
return core.warning('Comment body cannot be blank');
yield octokit.issues.updateComment(Object.assign(Object.assign({}, repo), { comment_id, body: previousBody
yield octokit.rest.issues.updateComment(Object.assign(Object.assign({}, repo), { comment_id, body: previousBody
? `${previousBody}\n${body}`
: `${body}\n${headerComment(header)}` }));
});
@ -55,7 +55,7 @@ function createComment(octokit, repo, issue_number, body, header, previousBody)
return __awaiter(this, void 0, void 0, function* () {
if (!body && !previousBody)
return core.warning('Comment body cannot be blank');
yield octokit.issues.createComment(Object.assign(Object.assign({}, repo), { issue_number, body: previousBody
yield octokit.rest.issues.createComment(Object.assign(Object.assign({}, repo), { issue_number, body: previousBody
? `${previousBody}\n${body}`
: `${body}\n${headerComment(header)}` }));
});
@ -63,7 +63,7 @@ function createComment(octokit, repo, issue_number, body, header, previousBody)
exports.createComment = createComment;
function deleteComment(octokit, repo, comment_id) {
return __awaiter(this, void 0, void 0, function* () {
yield octokit.issues.deleteComment(Object.assign(Object.assign({}, repo), { comment_id }));
yield octokit.rest.issues.deleteComment(Object.assign(Object.assign({}, repo), { comment_id }));
});
}
exports.deleteComment = deleteComment;

107
package-lock.json generated
View file

@ -10,20 +10,20 @@
"integrity": "sha512-xxtX0Cwdhb8LcgatfJkokqT8KzPvcIbwL9xpLU09nOwBzaStbfm0dNncsP0M4us+EpoPdWy7vbzU5vSOH7K6pg=="
},
"@actions/github": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@actions/github/-/github-4.0.0.tgz",
"integrity": "sha512-Ej/Y2E+VV6sR9X7pWL5F3VgEWrABaT292DRqRU6R4hnQjPtC/zD3nagxVdXWiRQvYDh8kHXo7IDmG42eJ/dOMA==",
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@actions/github/-/github-5.0.0.tgz",
"integrity": "sha512-QvE9eAAfEsS+yOOk0cylLBIO/d6WyWIOvsxxzdrPFaud39G6BOkUwScXZn1iBzQzHyu9SBkkLSWlohDWdsasAQ==",
"requires": {
"@actions/http-client": "^1.0.8",
"@octokit/core": "^3.0.0",
"@octokit/plugin-paginate-rest": "^2.2.3",
"@octokit/plugin-rest-endpoint-methods": "^4.0.0"
"@actions/http-client": "^1.0.11",
"@octokit/core": "^3.4.0",
"@octokit/plugin-paginate-rest": "^2.13.3",
"@octokit/plugin-rest-endpoint-methods": "^5.1.1"
}
},
"@actions/http-client": {
"version": "1.0.9",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.9.tgz",
"integrity": "sha512-0O4SsJ7q+MK0ycvXPl2e6bMXV7dxAXOGjrXS1eTF9s2S401Tp6c/P3c3Joz04QefC1J6Gt942Wl2jbm3f4mLcg==",
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
"integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
"requires": {
"tunnel": "0.0.6"
}
@ -1035,99 +1035,98 @@
}
},
"@octokit/auth-token": {
"version": "2.4.4",
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.4.tgz",
"integrity": "sha512-LNfGu3Ro9uFAYh10MUZVaT7X2CnNm2C8IDQmabx+3DygYIQjs9FwzFAHN/0t6mu5HEPhxcb1XOuxdpY82vCg2Q==",
"version": "2.4.5",
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.5.tgz",
"integrity": "sha512-BpGYsPgJt05M7/L/5FoE1PiAbdxXFZkX/3kDYcsvd1v6UhlnE5e96dTDr0ezX/EFwciQxf3cNV0loipsURU+WA==",
"requires": {
"@octokit/types": "^6.0.0"
"@octokit/types": "^6.0.3"
}
},
"@octokit/core": {
"version": "3.2.4",
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.2.4.tgz",
"integrity": "sha512-d9dTsqdePBqOn7aGkyRFe7pQpCXdibSJ5SFnrTr0axevObZrpz3qkWm7t/NjYv5a66z6vhfteriaq4FRz3e0Qg==",
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.4.0.tgz",
"integrity": "sha512-6/vlKPP8NF17cgYXqucdshWqmMZGXkuvtcrWCgU5NOI0Pl2GjlmZyWgBMrU8zJ3v2MJlM6++CiB45VKYmhiWWg==",
"requires": {
"@octokit/auth-token": "^2.4.4",
"@octokit/graphql": "^4.5.8",
"@octokit/request": "^5.4.12",
"@octokit/request-error": "^2.0.5",
"@octokit/types": "^6.0.3",
"before-after-hook": "^2.1.0",
"before-after-hook": "^2.2.0",
"universal-user-agent": "^6.0.0"
}
},
"@octokit/endpoint": {
"version": "6.0.10",
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.10.tgz",
"integrity": "sha512-9+Xef8nT7OKZglfkOMm7IL6VwxXUQyR7DUSU0LH/F7VNqs8vyd7es5pTfz9E7DwUIx7R3pGscxu1EBhYljyu7Q==",
"version": "6.0.11",
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.11.tgz",
"integrity": "sha512-fUIPpx+pZyoLW4GCs3yMnlj2LfoXTWDUVPTC4V3MUEKZm48W+XYpeWSZCv+vYF1ZABUm2CqnDVf1sFtIYrj7KQ==",
"requires": {
"@octokit/types": "^6.0.0",
"@octokit/types": "^6.0.3",
"is-plain-object": "^5.0.0",
"universal-user-agent": "^6.0.0"
}
},
"@octokit/graphql": {
"version": "4.5.8",
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.5.8.tgz",
"integrity": "sha512-WnCtNXWOrupfPJgXe+vSmprZJUr0VIu14G58PMlkWGj3cH+KLZEfKMmbUQ6C3Wwx6fdhzVW1CD5RTnBdUHxhhA==",
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.6.2.tgz",
"integrity": "sha512-WmsIR1OzOr/3IqfG9JIczI8gMJUMzzyx5j0XXQ4YihHtKlQc+u35VpVoOXhlKAlaBntvry1WpAzPl/a+s3n89Q==",
"requires": {
"@octokit/request": "^5.3.0",
"@octokit/types": "^6.0.0",
"@octokit/types": "^6.0.3",
"universal-user-agent": "^6.0.0"
}
},
"@octokit/openapi-types": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-5.1.1.tgz",
"integrity": "sha512-yMyaX9EDWCiyv7m85/K8L7bLFj1wrLdfDkKcZEZ6gNmepSW5mfSMFJnYwRINN7lF58wvevKPWvw0MYy6sxcFlQ=="
"version": "7.2.1",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-7.2.1.tgz",
"integrity": "sha512-IHQJpLciwzwDvciLxiFj3IEV5VYn7lSVcj5cu0jbTwMfK4IG6/g8SPrVp3Le1VRzIiYSRcBzm1dA7vgWelYP3Q=="
},
"@octokit/plugin-paginate-rest": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.7.1.tgz",
"integrity": "sha512-dUsxsEIrBqhlQNfXRhMhXOTQi0SSG38+QWcPGO226HFPFJk44vWukegHfMG3496vLv9T2oT7IuAGssGpcUg5bQ==",
"version": "2.13.3",
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.13.3.tgz",
"integrity": "sha512-46lptzM9lTeSmIBt/sVP/FLSTPGx6DCzAdSX3PfeJ3mTf4h9sGC26WpaQzMEq/Z44cOcmx8VsOhO+uEgE3cjYg==",
"requires": {
"@octokit/types": "^6.3.1"
"@octokit/types": "^6.11.0"
}
},
"@octokit/plugin-rest-endpoint-methods": {
"version": "4.5.2",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.5.2.tgz",
"integrity": "sha512-JXoDIh+QnzFb6C5ZqIcUzDkn1fLrxawi98ZbvYb9s7Z2CJLITUWpbTAxSgseczEho18pYhamEBRR/h3o3HIXJQ==",
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.3.0.tgz",
"integrity": "sha512-+4NAJ9WzPN5gW6W1H1tblw/DesTD6PaWuU5+/x3Pa7nyK6qjR6cn4jwkJtzxVPTgtzryOFLX+5vs7MROFswp5Q==",
"requires": {
"@octokit/types": "^6.3.2",
"@octokit/types": "^6.16.0",
"deprecation": "^2.3.1"
}
},
"@octokit/request": {
"version": "5.4.12",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.12.tgz",
"integrity": "sha512-MvWYdxengUWTGFpfpefBBpVmmEYfkwMoxonIB3sUGp5rhdgwjXL1ejo6JbgzG/QD9B/NYt/9cJX1pxXeSIUCkg==",
"version": "5.4.15",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.15.tgz",
"integrity": "sha512-6UnZfZzLwNhdLRreOtTkT9n57ZwulCve8q3IT/Z477vThu6snfdkBuhxnChpOKNGxcQ71ow561Qoa6uqLdPtag==",
"requires": {
"@octokit/endpoint": "^6.0.1",
"@octokit/request-error": "^2.0.0",
"@octokit/types": "^6.0.3",
"deprecation": "^2.0.0",
"@octokit/types": "^6.7.1",
"is-plain-object": "^5.0.0",
"node-fetch": "^2.6.1",
"once": "^1.4.0",
"universal-user-agent": "^6.0.0"
}
},
"@octokit/request-error": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.4.tgz",
"integrity": "sha512-LjkSiTbsxIErBiRh5wSZvpZqT4t0/c9+4dOe0PII+6jXR+oj/h66s7E4a/MghV7iT8W9ffoQ5Skoxzs96+gBPA==",
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.5.tgz",
"integrity": "sha512-T/2wcCFyM7SkXzNoyVNWjyVlUwBvW3igM3Btr/eKYiPmucXTtkxt2RBsf6gn3LTzaLSLTQtNmvg+dGsOxQrjZg==",
"requires": {
"@octokit/types": "^6.0.0",
"@octokit/types": "^6.0.3",
"deprecation": "^2.0.0",
"once": "^1.4.0"
}
},
"@octokit/types": {
"version": "6.10.1",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.10.1.tgz",
"integrity": "sha512-hgNC5jxKG8/RlqxU/6GThkGrvFpz25+cPzjQjyiXTNBvhyltn2Z4GhFY25+kbtXwZ4Co4zM0goW5jak1KLp1ug==",
"version": "6.16.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.16.0.tgz",
"integrity": "sha512-EktqSNq8EKXE82a7Vw33ozOEhFXIRik+rZHJTHAgVZRm/p2K5r5ecn5fVpRkLCm3CAVFwchRvt3yvtmfbt2LCQ==",
"requires": {
"@octokit/openapi-types": "^5.1.0"
"@octokit/openapi-types": "^7.2.0"
}
},
"@sinonjs/commons": {
@ -1766,9 +1765,9 @@
"dev": true
},
"before-after-hook": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.1.0.tgz",
"integrity": "sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A=="
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.1.tgz",
"integrity": "sha512-/6FKxSTWoJdbsLDF8tdIjaRiFXiE6UHsEHE3OPI/cwPURCVi1ukP0gmLn7XWEiFk5TcwQjjY5PWsU+j+tgXgmw=="
},
"brace-expansion": {
"version": "1.1.11",

View file

@ -27,7 +27,7 @@
"license": "MIT",
"dependencies": {
"@actions/core": "^1.3.0",
"@actions/github": "^4.0.0"
"@actions/github": "^5.0.0"
},
"devDependencies": {
"@types/jest": "^26.0.23",

View file

@ -14,7 +14,7 @@ export async function findPreviousComment(
issue_number: number,
header: string
): Promise<{body?: string; id: number} | undefined> {
const {data: comments} = await octokit.issues.listComments({
const {data: comments} = await octokit.rest.issues.listComments({
...repo,
issue_number
})
@ -35,7 +35,7 @@ export async function updateComment(
if (!body && !previousBody)
return core.warning('Comment body cannot be blank')
await octokit.issues.updateComment({
await octokit.rest.issues.updateComment({
...repo,
comment_id,
body: previousBody
@ -57,7 +57,7 @@ export async function createComment(
if (!body && !previousBody)
return core.warning('Comment body cannot be blank')
await octokit.issues.createComment({
await octokit.rest.issues.createComment({
...repo,
issue_number,
body: previousBody
@ -73,7 +73,7 @@ export async function deleteComment(
},
comment_id: number
): Promise<void> {
await octokit.issues.deleteComment({
await octokit.rest.issues.deleteComment({
...repo,
comment_id
})