mirror of
https://github.com/dependabot/fetch-metadata.git
synced 2026-03-12 18:07:12 -04:00
Fix library parser to trim trailing LF (#380)
* Fix test fixture for update requirement pattern * Fix to parse update fragment with considering "\n" * `npm run build`
This commit is contained in:
2
dist/index.js
generated
vendored
2
dist/index.js
generated
vendored
@@ -10090,7 +10090,7 @@ function parse(commitMessage, body, branchName, mainBranch, lookup, getScore) {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const bumpFragment = commitMessage.match(/^Bumps .* from (?<from>v?\d[^ ]*) to (?<to>v?\d[^ ]*)\.$/m);
|
||||
const updateFragment = commitMessage.match(/^Update .* requirement from \S*? ?(?<from>v?\d[^ ]*) to \S*? ?(?<to>v?\d[^ ]*)$/m);
|
||||
const updateFragment = commitMessage.match(/^Update .* requirement from \S*? ?(?<from>v?\d\S*) to \S*? ?(?<to>v?\d\S*)$/m);
|
||||
const yamlFragment = commitMessage.match(/^-{3}\n(?<dependencies>[\S|\s]*?)\n^\.{3}\n/m);
|
||||
const newMaintainer = !!body.match(/Maintainer changes/m);
|
||||
const lookupFn = lookup !== null && lookup !== void 0 ? lookup : (() => Promise.resolve({ alertState: '', ghsaId: '', cvss: 0 }));
|
||||
|
||||
@@ -29,7 +29,7 @@ export interface scoreLookup {
|
||||
|
||||
export async function parse (commitMessage: string, body: string, branchName: string, mainBranch: string, lookup?: alertLookup, getScore?: scoreLookup): Promise<Array<updatedDependency>> {
|
||||
const bumpFragment = commitMessage.match(/^Bumps .* from (?<from>v?\d[^ ]*) to (?<to>v?\d[^ ]*)\.$/m)
|
||||
const updateFragment = commitMessage.match(/^Update .* requirement from \S*? ?(?<from>v?\d[^ ]*) to \S*? ?(?<to>v?\d[^ ]*)$/m)
|
||||
const updateFragment = commitMessage.match(/^Update .* requirement from \S*? ?(?<from>v?\d\S*) to \S*? ?(?<to>v?\d\S*)$/m)
|
||||
const yamlFragment = commitMessage.match(/^-{3}\n(?<dependencies>[\S|\s]*?)\n^\.{3}\n/m)
|
||||
const newMaintainer = !!body.match(/Maintainer changes/m)
|
||||
const lookupFn = lookup ?? (() => Promise.resolve({ alertState: '', ghsaId: '', cvss: 0 }))
|
||||
|
||||
@@ -208,6 +208,7 @@ test('it sets the updated dependency as an output for subsequent actions when th
|
||||
test('it sets the updated dependency as an output for subsequent actions when given a commit message for library', async () => {
|
||||
const mockCommitMessage =
|
||||
'Update rubocop requirement from ~> 1.30.1 to ~> 1.31.0\n' +
|
||||
'\n' +
|
||||
'Updates the requirements on [rubocop](https://github.com/rubocop/rubocop) to permit the latest version.\n' +
|
||||
'- [Release notes](https://github.com/rubocop/rubocop/releases)\n' +
|
||||
'- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)\n' +
|
||||
|
||||
Reference in New Issue
Block a user