| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b11da11 commit afbaf92
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,7 +5,8 @@ | |||
| 5 | 5 | // | |
| 6 | 6 | // Example: | |
| 7 | 7 | // $ git log upstream/vXX.x...upstream/vX.X.X-proposal \ | |
| 8 | - // --format='{"prURL":"%(trailers:key=PR-URL,valueonly,separator=)","title":"%s","smallSha":"%h"}' \ | ||
| 8 | + // --reverse --format='{"prURL":"%(trailers:key=PR-URL,valueonly,separator=)","title":"%s","smallSha":"%h"}' \ | ||
| 9 | + // | sed 's/,"title":"Revert "\([^"]\+\)""/,"title":"Revert \\"\1\\""/g' \ | ||
| 9 | 10 | // | ./lint-release-proposal-commit-list.mjs "path/to/CHANGELOG.md" "$(git rev-parse upstream/vX.X.X-proposal)" | |
| 10 | 11 | ||
| 11 | 12 | const [,, CHANGELOG_PATH, RELEASE_COMMIT_SHA] = process.argv; | |
@@ -52,20 +53,33 @@ for await (const line of stdinLineByLine) { | |||
| 52 | 53 | assert.notStrictEqual(lineStart, -1, `Cannot find ${smallSha} on the list`); | |
| 53 | 54 | const lineEnd = commitList.indexOf('\n', lineStart + 1); | |
| 54 | 55 | ||
| 55 | - const colonIndex = title.indexOf(':'); | ||
| 56 | - const expectedCommitTitle = `${`**${title.slice(0, colonIndex)}`.replace('**Revert "', '_**Revert**_ "**')}**${title.slice(colonIndex)}`; | ||
| 57 | 56 | try { | |
| 58 | - assert(commitList.lastIndexOf(`/${smallSha})] - ${expectedCommitTitle} (`, lineEnd) > lineStart, `Commit title doesn't match`); | ||
| 57 | + const colonIndex = title.indexOf(':'); | ||
| 58 | + const expectedCommitTitle = `${`**${title.slice(0, colonIndex)}`.replace('**Revert "', '_**Revert**_ "**')}**${title.slice(colonIndex)}`; | ||
| 59 | + try { | ||
| 60 | + assert(commitList.lastIndexOf(`/${smallSha})] - ${expectedCommitTitle} (`, lineEnd) > lineStart, `Changelog entry doesn't match for ${smallSha}`); | ||
| 61 | + } catch (e) { | ||
| 62 | + if (e?.code === 'ERR_ASSERTION') { | ||
| 63 | + e.operator = 'includes'; | ||
| 64 | + e.expected = expectedCommitTitle; | ||
| 65 | + e.actual = commitList.slice(lineStart + 1, lineEnd); | ||
| 66 | + } | ||
| 67 | + throw e; | ||
| 68 | + } | ||
| 69 | + assert.strictEqual(commitList.slice(lineEnd - prURL.length - 2, lineEnd), `(${prURL})`, `when checking ${smallSha} ${title}`); | ||
| 70 | + | ||
| 59 | 71 | } catch (e) { | |
| 60 | - if (e?.code === 'ERR_ASSERTION') { | ||
| 61 | - e.operator = 'includes'; | ||
| 62 | - e.expected = expectedCommitTitle; | ||
| 63 | - e.actual = commitList.slice(lineStart + 1, lineEnd); | ||
| 72 | + if (e?.code !== 'ERR_ASSERTION') { | ||
| 73 | + throw e; | ||
| 64 | 74 | } | |
| 65 | - throw e; | ||
| 75 | + let line = 1; | ||
| 76 | + for (let i = 0; i < lineStart + commitListingStart; i = changelog.indexOf('\n', i + 1)) { | ||
| 77 | + line++; | ||
| 78 | + } | ||
| 79 | + console.error(`::error file=${CHANGELOG_PATH},line=${line},title=Release proposal linter::${e.message}`); | ||
| 80 | + console.error(e); | ||
| 81 | + process.exitCode ||= 1; | ||
| 66 | 82 | } | |
| 67 | - assert.strictEqual(commitList.slice(lineEnd - prURL.length - 2, lineEnd), `(${prURL})`, `when checking ${smallSha} ${title}`); | ||
| 68 | - | ||
| 69 | 83 | expectedNumberOfCommitsLeft--; | |
| 70 | 84 | console.log(prURL); | |
| 71 | 85 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments