Browse Source

chore: omit superceded Chromium updates from notes (#19406)

* feat: omit superceded Chromium updates from notes

* chore: simplify changed code
trop[bot] 5 years ago
parent
commit
c55bc8106f
1 changed files with 16 additions and 0 deletions
  1. 16 0
      script/release-notes/notes.js

+ 16 - 0
script/release-notes/notes.js

@@ -581,6 +581,8 @@ const getNotes = async (fromRef, toRef, newVersion) => {
       })
   }
 
+  pool.commits = removeSupercededChromiumUpdates(pool.commits)
+
   const notes = {
     breaking: [],
     docs: [],
@@ -613,6 +615,20 @@ const getNotes = async (fromRef, toRef, newVersion) => {
   return notes
 }
 
+const removeSupercededChromiumUpdates = (commits) => {
+  const chromiumRegex = /^Updated Chromium to \d+\.\d+\.\d+\.\d+/
+  const updates = commits.filter(commit => (commit.note || commit.subject).match(chromiumRegex))
+  const keepers = commits.filter(commit => !updates.includes(commit))
+
+  // keep the newest update.
+  if (updates.length) {
+    updates.sort((a, b) => a.originalPr.number - b.originalPr.number)
+    keepers.push(updates.pop())
+  }
+
+  return keepers
+}
+
 /***
 ****  Render
 ***/