import { Context } from "probot" ; import run from "./run" ; import match from "./helpers/match" ; export default async function update ( context ) { const { github } = context ; const repo = context . repo ( ) ; const origin = context . issue ( ) ; const labels = "dependent" ; const state = "open" ; const per_page = 100 ; const issues = await github . paginate ( github . issues . listForRepo , { ... repo , labels , state , per_page , } , ( res ) => res . data ) ; for ( const issue of issues ) { if ( ! issue . pull_request ) continue ; const { data } = await github . pulls . get ( { ... repo , pull_number : issue . number , } ) ; const deps = await match ( { body : data . body , pull_number : data . number , } ) ; if ( deps . includes ( origin . issue_number ) ) { await run ( github , repo , data . head . sha , deps ) ; } } }