diff --git a/src/plugins/issues.labeled.new_default_repository.ts b/src/plugins/issues.labeled.new_default_repository.ts index 2af0257..64a23d2 100644 --- a/src/plugins/issues.labeled.new_default_repository.ts +++ b/src/plugins/issues.labeled.new_default_repository.ts @@ -1,8 +1,9 @@ -import { IssuePullPayload, PayloadIsIssue } from '../types' +import { IssuePullPayload, PayloadIsPull } from '../types' import { GitHubBot } from '../github.bot' import { extractOwnerRepo } from '../utils/extractOwnerRepo' import { senderIsBot } from '../utils/filter' +import { RepositoryName } from '../const' const label = 'New default repository' const postedComment = ` @@ -22,8 +23,8 @@ export default async ( ): Promise => { if ( senderIsBot(payload) || - !PayloadIsIssue(payload) || - payload.repository.name !== 'default' || + !PayloadIsPull(payload) || + extractOwnerRepo(payload).repo !== RepositoryName.DEFAULT || payload.action !== 'labeled' || payload.label?.name !== label ) { @@ -32,7 +33,7 @@ export default async ( await bot.github.octokit.rest.issues.createComment({ ...extractOwnerRepo(payload), - issue_number: payload.issue.number, + issue_number: payload.pull_request.number, body: postedComment, }) }