@@ -12,6 +12,7 @@ const patchVersionPattern = /^(v?)(\d+)\.(\d+)\.(\d+)$/
1212
1313const botAuthorLogins = new Set ( [ "renovate[bot]" , "dependabot[bot]" ] )
1414const botAuthorNames = new Set ( [ "renovate bot" , "renovate[bot]" , "dependabot[bot]" , "dependabot" ] )
15+ const ignoredPullRequestLabels = new Set ( [ "test" , "chore" , "refactoring" , "ci" ] )
1516const botEmailFragments = [
1617 "renovate[bot]@users.noreply.github.com" ,
1718 "bot@renovateapp.com" ,
@@ -42,7 +43,7 @@ async function run() {
4243 }
4344
4445 const { commitCount, commits, nextTag, revisionDescription } = releasePreparation
45- const nonDependencyBotCommits = commits . filter ( ( commit ) => ! isDependencyBotCommit ( commit ) )
46+ const nonDependencyBotCommits = await getNonDependencyBotCommits ( octokit , owner , repo , commits )
4647 if ( nonDependencyBotCommits . length > 0 ) {
4748 const commitList = nonDependencyBotCommits
4849 . slice ( 0 , 10 )
@@ -214,6 +215,20 @@ async function listCommits(octokit: Octokit, owner: string, repo: string, branch
214215 } )
215216}
216217
218+ async function getNonDependencyBotCommits ( octokit : Octokit , owner : string , repo : string , commits : ReleaseCommit [ ] ) {
219+ const nonDependencyBotCommits = [ ]
220+
221+ for ( const commit of commits ) {
222+ if ( isDependencyBotCommit ( commit ) || ( await isIgnoredPullRequestCommit ( octokit , owner , repo , commit ) ) ) {
223+ continue
224+ }
225+
226+ nonDependencyBotCommits . push ( commit )
227+ }
228+
229+ return nonDependencyBotCommits
230+ }
231+
217232function isDependencyBotCommit ( commit : ReleaseCommit ) {
218233 const login = commit . author ?. login . toLowerCase ( )
219234 if ( login && botAuthorLogins . has ( login ) ) {
@@ -229,6 +244,18 @@ function isDependencyBotCommit(commit: ReleaseCommit) {
229244 return Boolean ( authorEmail && botEmailFragments . some ( ( fragment ) => authorEmail . includes ( fragment ) ) )
230245}
231246
247+ async function isIgnoredPullRequestCommit ( octokit : Octokit , owner : string , repo : string , commit : ReleaseCommit ) {
248+ const { data : pullRequests } = await octokit . rest . repos . listPullRequestsAssociatedWithCommit ( {
249+ owner,
250+ repo,
251+ [ "commit_sha" ] : commit . sha
252+ } )
253+
254+ return pullRequests . some ( ( pullRequest ) =>
255+ pullRequest . labels . some ( ( label ) => ignoredPullRequestLabels . has ( label . name . toLowerCase ( ) ) )
256+ )
257+ }
258+
232259async function tagExists ( octokit : Octokit , owner : string , repo : string , tag : string ) {
233260 try {
234261 await octokit . rest . git . getRef ( { owner, repo, ref : `tags/${ tag } ` } )
0 commit comments