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:
Naoki Oketani
2025-05-01 22:50:55 +09:00
committed by GitHub
7 changed files with 29327 additions and 7028 deletions

View File

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

File diff suppressed because one or more lines are too long

957
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -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": {

View File

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

View File

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

View File

@@ -7,7 +7,7 @@ export async function createComment(
prNumber: number,
body: string
): Promise<void> {
octokit.rest.issues.createComment({
octokit.issues.createComment({
owner,
repo,
issue_number: prNumber,