Skip to content

Commit e4063e4

Browse files
committed
Fit parser for libraries
1 parent cf99754 commit e4063e4

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/dependabot/update_metadata.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export interface scoreLookup {
2828

2929
export async function parse (commitMessage: string, branchName: string, mainBranch: string, lookup?: alertLookup, getScore?: scoreLookup): Promise<Array<updatedDependency>> {
3030
const bumpFragment = commitMessage.match(/^Bumps .* from (?<from>\d[^ ]*) to (?<to>\d[^ ]*)\.$/m)
31+
const updateFragment = commitMessage.match(/^Update .* requirement from \S*? ?(?<from>\d[^ ]*) to \S*? ?(?<to>\d[^ ]*)$/m)
3132
const yamlFragment = commitMessage.match(/^-{3}\n(?<dependencies>[\S|\s]*?)\n^\.{3}\n/m)
3233
const lookupFn = lookup ?? (() => Promise.resolve({ alertState: '', ghsaId: '', cvss: 0 }))
3334
const scoreFn = getScore ?? (() => Promise.resolve(0))
@@ -38,8 +39,8 @@ export async function parse (commitMessage: string, branchName: string, mainBran
3839
// Since we are on the `dependabot` branch (9 letters), the 10th letter in the branch name is the delimiter
3940
const delim = branchName[10]
4041
const chunks = branchName.split(delim)
41-
const prev = bumpFragment?.groups?.from ?? ''
42-
const next = bumpFragment?.groups?.to ?? ''
42+
const prev = bumpFragment?.groups?.from ?? (updateFragment?.groups?.from ?? '')
43+
const next = bumpFragment?.groups?.to ?? (updateFragment?.groups?.to ?? '')
4344

4445
if (data['updated-dependencies']) {
4546
return await Promise.all(data['updated-dependencies'].map(async (dependency, index) => {

0 commit comments

Comments
 (0)