Skip to content

Commit

Permalink
move threshold to options
Browse files Browse the repository at this point in the history
  • Loading branch information
tnyo43 committed Mar 5, 2024
1 parent 7dc5dbb commit 80e7ea9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
7 changes: 4 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const uniqueStringArray = (texts: string[]): string[] => {
*/
export async function run(): Promise<void> {
try {
const { token, prNumber } = getOption()
const { token, prNumber, threshold } = getOption()

const octokit = getOctokit(token)
const owner = context.repo.owner
Expand All @@ -50,7 +50,6 @@ export async function run(): Promise<void> {
const hasMessageSent = comments.some(comment =>
comment.body?.includes('It seems the discussion is dragging on.')
)
const threshold = Number(core.getInput('threshold', { required: true }))
const commentCount = comments.length + reviewComments.length
if (commentCount < threshold) {
return
Expand Down
6 changes: 5 additions & 1 deletion src/option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { context } from '@actions/github'
type Option = {
token: string
prNumber: number
threshold: number
}

function getPrNumber(): number {
Expand All @@ -24,8 +25,11 @@ export function getOption(): Option {
setFailed('pr number is not set properly')
}

const threshold = Number(getInput('threshold', { required: true }))

return {
token,
prNumber
prNumber,
threshold
}
}

0 comments on commit 80e7ea9

Please sign in to comment.