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/issue')
|
||||
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', () => {
|
||||
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",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.1",
|
||||
"@actions/github": "^5.1.1",
|
||||
"@octokit/rest": "^19.0.13",
|
||||
"@actions/github": "^6.0.0",
|
||||
"@octokit/rest": "^21.1.1",
|
||||
"strip-ansi": "^6.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -27,6 +27,8 @@ export type GetIssuesFunc = (options: {
|
||||
owner: string
|
||||
repo: string
|
||||
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}[]}>
|
||||
|
||||
export async function getExistingIssueNumber(
|
||||
|
||||
15
src/main.ts
15
src/main.ts
@@ -91,21 +91,20 @@ export async function run(): Promise<void> {
|
||||
const existingIssueNumber =
|
||||
core.getInput('dedupe_issues') === 'true'
|
||||
? await issue.getExistingIssueNumber(
|
||||
octokit.rest.issues.listForRepo,
|
||||
octokit.issues.listForRepo,
|
||||
github.context.repo
|
||||
)
|
||||
: null
|
||||
|
||||
if (existingIssueNumber !== null) {
|
||||
const {data: createdComment} =
|
||||
await octokit.rest.issues.createComment({
|
||||
...github.context.repo,
|
||||
issue_number: existingIssueNumber,
|
||||
body: option.body
|
||||
})
|
||||
const {data: createdComment} = await octokit.issues.createComment({
|
||||
...github.context.repo,
|
||||
issue_number: existingIssueNumber,
|
||||
body: option.body
|
||||
})
|
||||
core.debug(`comment ${createdComment.url}`)
|
||||
} else {
|
||||
const {data: createdIssue} = await octokit.rest.issues.create({
|
||||
const {data: createdIssue} = await octokit.issues.create({
|
||||
...github.context.repo,
|
||||
...option
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user