Skip to content

Commit

Permalink
feat: commits to paginate
Browse files Browse the repository at this point in the history
  • Loading branch information
fuxingloh committed Jan 14, 2021
1 parent c921061 commit 8d10c88
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/matcher/commits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,20 @@ export default async function match(
return []
}

const commits = await client.pulls.listCommits({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
pull_number: number,
per_page: 250
})
const responses = await client.paginate(
client.pulls.listCommits.endpoint.merge({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
pull_number: number,
})
);

// @ts-ignore
const messages: string[] = responses.map(c => c.commit.message)

return matchers
.filter(value => {
return matcherRegexAny(
value.matcher!.commits!,
commits.data.map(c => c.commit.message)
)
return matcherRegexAny(value.matcher!.commits!, messages)
})
.map(value => value.label)
}

0 comments on commit 8d10c88

Please sign in to comment.