diff --git a/scripts/src/actions/find-sha-for-plan.ts b/scripts/src/actions/find-sha-for-plan.ts index 5049359..9184425 100644 --- a/scripts/src/actions/find-sha-for-plan.ts +++ b/scripts/src/actions/find-sha-for-plan.ts @@ -6,22 +6,29 @@ async function findShaForPlan(): Promise { const github = await GitHub.getGitHub() if (context.eventName !== 'push') { + console.log( + `This is not a push event ("${context.eventName}"); returning "${context.sha}"` + ) return context.sha } + const q = `repo:${context.repo.owner}/${context.repo.repo} ${context.sha} type:pr is:merged` + console.log(`Running advanced query: ${q}`) const pulls = await github.client.paginate( github.client.search.issuesAndPullRequests, { - q: `repository:${context.repo.owner}/${context.repo.repo} ${context.sha} type:pr is:merged`, + q, advanced_search: 'true' } ) if (pulls.length === 0) { + console.log('Got 0 pull request, returning empty string') return '' } const pull = pulls[0] + console.log(`Processing pull request number ${pull.number}`) const commits = await github.client.paginate( github.client.pulls.listCommits, { @@ -31,9 +38,12 @@ async function findShaForPlan(): Promise { ) if (commits.length === 0) { + console.log('Found 0 commits, returning empty string') return '' } + const commit = commits[commits.length - 1] + console.log(`Returning commit ${commit.sha}`) return commits[commits.length - 1].sha }