import { WebhookPayload } from "@actions/github/lib/interfaces" ; const REGEX_REPOS_FILES_OVERRIDE = /action-ros-ci-repos-override:[ ]*([\S]+)/g ; const REGEX_REPOS_FILES_SUPPLEMENTAL = /action-ros-ci-repos-supplemental:[ ]*([\S]+)/g ; param content param regex returns function extractCaptures ( content , regex ) { const captures = [ ] ; let matches ; while ( ( matches = regex . exec ( content ) ) !== null ) { const capture = matches . slice ( 1 ) ; if ( capture . length > 0 ) { captures . push ( capture ) ; } } return captures ; } /**
 * Try to extract PR body from context payload.
 */ function extractPrBody ( contextPayload ) { const prPayload = contextPayload . pull_request ; if ( ! prPayload ) { return undefined ; } return prPayload . body ; } param contextPayload returns export function getReposFilesOverride ( contextPayload ) { const prBody = extractPrBody ( contextPayload ) ; if ( ! prBody ) { return [ ] ; } return extractCaptures ( prBody , REGEX_REPOS_FILES_OVERRIDE ) . map ( ( capture ) => { return capture [ 0 ] ; } ) ; } param contextPayload returns export function getReposFilesSupplemental ( contextPayload ) { const prBody = extractPrBody ( contextPayload ) ; if ( ! prBody ) { return [ ] ; } return extractCaptures ( prBody , REGEX_REPOS_FILES_SUPPLEMENTAL ) . map ( ( capture ) => { return capture [ 0 ] ; } ) ; }