MCPcopy Create free account
hub / github.com/ampproject/amphtml / findConfigBitCommits

Function findConfigBitCommits

build-system/tasks/sweep-experiments/index.js:220–251  ·  view source on GitHub ↗
(
  cutoffDateFormatted,
  configJsonPath,
  experiment,
  percentage
)

Source from the content-addressed store, hash-verified

218 * @return {Array<{hash: string, authorDate: string, subject: string}>}
219 */
220const findConfigBitCommits = (
221 cutoffDateFormatted,
222 configJsonPath,
223 experiment,
224 percentage
225) =>
226 getStdoutLines(
227 [
228 'git log',
229 `--until=${cutoffDateFormatted}`,
230 // Look for entries that contain exact percentage string, like:
231 // "my-launched-experiment": 1
232 `-S '"${experiment}": ${percentage},'`,
233 // %h: hash
234 // %aI: authorDate
235 // %s: subject
236 ' --format="%h %aI %s"',
237 configJsonPath,
238 ].join(' ')
239 ).map((line) => {
240 const tokens = line.split(' ');
241 // PR numbers in subject lines create spammy references when committed,
242 // remove them early on.
243 if (/^\(#[0-9]+\)$/.test(tokens[tokens.length - 1])) {
244 tokens.pop();
245 }
246 return {
247 hash: /** @type {string} */ (tokens.shift()),
248 authorDate: /** @type {string} */ (tokens.shift()),
249 subject: tokens.join(' '),
250 };
251 });
252
253const issueUrlToNumberRe = new RegExp(
254 [

Callers 1

collectWorkFunction · 0.85

Calls 3

getStdoutLinesFunction · 0.85
testMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected