@futurelastic/colab-handbook 1.14.1-rc.1 → 1.14.1-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/tools/lib/shipguard.js +17 -1
package/package.json
CHANGED
package/tools/lib/shipguard.js
CHANGED
|
@@ -36,12 +36,28 @@ const squash = require('./squash.js');
|
|
|
36
36
|
const branchNameLib = require('./branch-name.js');
|
|
37
37
|
const { branchIssueNumbers } = branchNameLib;
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
// The parenthesised keyword form `(issue N)` / `(issues N, M)` / `(issues N and M)` (#611). Some
|
|
40
|
+
// adopters write it instead of `#N` so that every commit does not cross-link into the issue's
|
|
41
|
+
// timeline; a group branch on such a repo had its second claimed issue refused as uncorroborated
|
|
42
|
+
// although four of its seven commits ended `(issue <that number>)`. The `issue` keyword is the
|
|
43
|
+
// whole point — a BARE number (`(42)`, `v1.2 (3 files)`) stays uncounted, so the #87 co-tenant
|
|
44
|
+
// guard is exactly as strong as before: a commit naming an issue this way names it as surely as
|
|
45
|
+
// `#N` does. Deliberately the parenthesised shape only, which is what was measured; a prose
|
|
46
|
+
// "see issue 12" is not a reference convention anyone was found writing.
|
|
47
|
+
const ISSUE_KEYWORD_GROUP = /\(\s*issues?\s+(#?\d+(?:\s*(?:,|&|\band\b)\s*#?\d+)*)\s*\)/gi;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Every issue a commit subject or body on the branch names, de-duplicated: each `#N`, plus each
|
|
51
|
+
* number inside an `(issue N)` / `(issues N, M)` group (#611).
|
|
52
|
+
*/
|
|
40
53
|
function commitIssueNumbers(commits) {
|
|
41
54
|
const out = new Set();
|
|
42
55
|
for (const c of Array.isArray(commits) ? commits : []) {
|
|
43
56
|
const text = `${(c && c.subject) || ''}\n${(c && c.body) || ''}`;
|
|
44
57
|
for (const m of text.matchAll(/#(\d+)\b/g)) out.add(Number(m[1]));
|
|
58
|
+
for (const m of text.matchAll(ISSUE_KEYWORD_GROUP)) {
|
|
59
|
+
for (const d of m[1].matchAll(/\d+/g)) out.add(Number(d[0]));
|
|
60
|
+
}
|
|
45
61
|
}
|
|
46
62
|
return [...out];
|
|
47
63
|
}
|