Skip to content

Commit 64bd9b8

Browse files
authored
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`
1 parent 0908fa1 commit 64bd9b8

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/dependabot/update_metadata.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export interface scoreLookup {
2929

3030
export async function parse (commitMessage: string, body: string, branchName: string, mainBranch: string, lookup?: alertLookup, getScore?: scoreLookup): Promise<Array<updatedDependency>> {
3131
const bumpFragment = commitMessage.match(/^Bumps .* from (?<from>v?\d[^ ]*) to (?<to>v?\d[^ ]*)\.$/m)
32-
const updateFragment = commitMessage.match(/^Update .* requirement from \S*? ?(?<from>v?\d[^ ]*) to \S*? ?(?<to>v?\d[^ ]*)$/m)
32+
const updateFragment = commitMessage.match(/^Update .* requirement from \S*? ?(?<from>v?\d\S*) to \S*? ?(?<to>v?\d\S*)$/m)
3333
const yamlFragment = commitMessage.match(/^-{3}\n(?<dependencies>[\S|\s]*?)\n^\.{3}\n/m)
3434
const newMaintainer = !!body.match(/Maintainer changes/m)
3535
const lookupFn = lookup ?? (() => Promise.resolve({ alertState: '', ghsaId: '', cvss: 0 }))

src/main.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ test('it sets the updated dependency as an output for subsequent actions when th
208208
test('it sets the updated dependency as an output for subsequent actions when given a commit message for library', async () => {
209209
const mockCommitMessage =
210210
'Update rubocop requirement from ~> 1.30.1 to ~> 1.31.0\n' +
211+
'\n' +
211212
'Updates the requirements on [rubocop](https://github.com/rubocop/rubocop) to permit the latest version.\n' +
212213
'- [Release notes](https://github.com/rubocop/rubocop/releases)\n' +
213214
'- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)\n' +

0 commit comments

Comments
 (0)