From 44d8c70b5e36c0ea36bc8155244d2f36e1f48da8 Mon Sep 17 00:00:00 2001 From: Andy Steed Date: Thu, 3 May 2018 11:54:32 -0700 Subject: [PATCH] Added check against known trivial revisions via `.trivial` file when determining stabilization candidates --- .trivial | 0 bin/show-stablization-candidates.js | 17 +++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 .trivial diff --git a/.trivial b/.trivial new file mode 100644 index 000000000..e69de29bb diff --git a/bin/show-stablization-candidates.js b/bin/show-stablization-candidates.js index b996eda7d..0cf4b609f 100644 --- a/bin/show-stablization-candidates.js +++ b/bin/show-stablization-candidates.js @@ -16,6 +16,7 @@ const $ = require("shelljs") const META_STATUS = "meta:status" const TRIVIAL_CHANGE_MATCHERS = ["\\[.*trivial.*\\]","\\[.*ci skip.*\\]"] +const TRIVIAL_REVISIONS = getTrivialRevisions(); const LOG_ENABLED = (process.argv.indexOf("--debug") > -1) function logDebug(message) { @@ -76,11 +77,19 @@ function getGitState(schema) { } } +// Return an array of git revision ids parsed from `/.trivial` +function getTrivialRevisions() { + const trivialFile = ".trivial" + const trivialContent = fs.existsSync(trivialFile) ? fs.readFileSync(trivialFile, 'utf8') : "" + return trivialContent.split("\n").filter(s => s.length > 0) // an empty file can end up with a single empty string +} + // Helper method to determine whether a commit message contains non-trivial change qualifiers -function signifiesTrivialChange(message) { +function signifiesTrivialChange(message, revision) { let regex = new RegExp(TRIVIAL_CHANGE_MATCHERS.join('|')) - let isTrivial = regex.test(message) - return isTrivial + let revTrivial = TRIVIAL_REVISIONS.find(id => revision.startsWith(id)) !== undefined + let msgTrivial = regex.test(message) + return revTrivial || msgTrivial } // Create a detailed list of intermediate revisions to a given schema between @@ -100,7 +109,7 @@ function getSchemaChangesSinceRevision(schema, revision) { desc: rev_desc, msg: rev_msg, date: rev_date, - trivial: signifiesTrivialChange(rev_msg) + trivial: signifiesTrivialChange(rev_msg, rev_id) }) } return commits