Merge pull request #207 from oke-py/update-actions-github
Update @actions/github to v6.0.0 and @octokit/rest to v21.1.1
This commit is contained in:
@@ -8,6 +8,19 @@ import * as pr from '../src/pr'
|
|||||||
jest.mock('../src/audit')
|
jest.mock('../src/audit')
|
||||||
jest.mock('../src/issue')
|
jest.mock('../src/issue')
|
||||||
jest.mock('../src/pr')
|
jest.mock('../src/pr')
|
||||||
|
jest.mock('@octokit/rest', () => {
|
||||||
|
return {
|
||||||
|
Octokit: jest.fn().mockImplementation(() => {
|
||||||
|
return {
|
||||||
|
issues: {
|
||||||
|
listForRepo: jest.fn(),
|
||||||
|
createComment: jest.fn(),
|
||||||
|
create: jest.fn()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
describe('run: pr', () => {
|
describe('run: pr', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|||||||
35362
dist/index.js
vendored
35362
dist/index.js
vendored
File diff suppressed because one or more lines are too long
957
package-lock.json
generated
957
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -30,8 +30,8 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.1",
|
"@actions/core": "^1.10.1",
|
||||||
"@actions/github": "^5.1.1",
|
"@actions/github": "^6.0.0",
|
||||||
"@octokit/rest": "^19.0.13",
|
"@octokit/rest": "^21.1.1",
|
||||||
"strip-ansi": "^6.0.1"
|
"strip-ansi": "^6.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ export type GetIssuesFunc = (options: {
|
|||||||
owner: string
|
owner: string
|
||||||
repo: string
|
repo: string
|
||||||
state: 'open' | 'closed' | 'all' | undefined
|
state: 'open' | 'closed' | 'all' | undefined
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
[key: string]: any // Allow additional properties
|
||||||
}) => Promise<{data: {title: string; number: number}[]}>
|
}) => Promise<{data: {title: string; number: number}[]}>
|
||||||
|
|
||||||
export async function getExistingIssueNumber(
|
export async function getExistingIssueNumber(
|
||||||
|
|||||||
15
src/main.ts
15
src/main.ts
@@ -91,21 +91,20 @@ export async function run(): Promise<void> {
|
|||||||
const existingIssueNumber =
|
const existingIssueNumber =
|
||||||
core.getInput('dedupe_issues') === 'true'
|
core.getInput('dedupe_issues') === 'true'
|
||||||
? await issue.getExistingIssueNumber(
|
? await issue.getExistingIssueNumber(
|
||||||
octokit.rest.issues.listForRepo,
|
octokit.issues.listForRepo,
|
||||||
github.context.repo
|
github.context.repo
|
||||||
)
|
)
|
||||||
: null
|
: null
|
||||||
|
|
||||||
if (existingIssueNumber !== null) {
|
if (existingIssueNumber !== null) {
|
||||||
const {data: createdComment} =
|
const {data: createdComment} = await octokit.issues.createComment({
|
||||||
await octokit.rest.issues.createComment({
|
...github.context.repo,
|
||||||
...github.context.repo,
|
issue_number: existingIssueNumber,
|
||||||
issue_number: existingIssueNumber,
|
body: option.body
|
||||||
body: option.body
|
})
|
||||||
})
|
|
||||||
core.debug(`comment ${createdComment.url}`)
|
core.debug(`comment ${createdComment.url}`)
|
||||||
} else {
|
} else {
|
||||||
const {data: createdIssue} = await octokit.rest.issues.create({
|
const {data: createdIssue} = await octokit.issues.create({
|
||||||
...github.context.repo,
|
...github.context.repo,
|
||||||
...option
|
...option
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export async function createComment(
|
|||||||
prNumber: number,
|
prNumber: number,
|
||||||
body: string
|
body: string
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
octokit.rest.issues.createComment({
|
octokit.issues.createComment({
|
||||||
owner,
|
owner,
|
||||||
repo,
|
repo,
|
||||||
issue_number: prNumber,
|
issue_number: prNumber,
|
||||||
|
|||||||
Reference in New Issue
Block a user