import * as YAML from 'yaml' ; export interface updatedDependency { dependencyName : string ; dependencyType : string ; updateType : string ; } export function parse ( commitMessage ) { const yamlFragment = commitMessage . match ( /^-{3}\n(?<dependencies>[\S|\s]*?)\n^\.{3}\n/m ) ; if ( yamlFragment ?. groups ) { const data = YAML . parse ( yamlFragment . groups . dependencies ) ; if ( data [ 'updated-dependencies' ] ) { return data [ 'updated-dependencies' ] . map ( dependency => { return { dependencyName : dependency [ 'dependency-name' ] , dependencyType : dependency [ 'dependency-type' ] , updateType : dependency [ 'update-type' ] } ; } ) ; } } return [ ] ; }