diff --git a/.github/actions/detect-changes/detectChanges.mjs b/.github/actions/detect-changes/detectChanges.mjs index 5f89a4e24242..c3028c57a937 100644 --- a/.github/actions/detect-changes/detectChanges.mjs +++ b/.github/actions/detect-changes/detectChanges.mjs @@ -50,7 +50,7 @@ async function getChangedFiles(page = 1) { }) const json = await resp.json() - const files = json.map((file) => file.filename) || [] + const files = json?.map((file) => file.filename) || [] changedFiles = changedFiles.concat(files) @@ -78,6 +78,17 @@ async function main() { const changedFiles = await getChangedFiles() console.log(`${changedFiles.length} changed files`) + if (changedFiles.length === 0) { + console.log( + 'No changed files found. Something must have gone wrong. Fall back to ' + + 'running all tests.' + ) + core.setOutput('onlydocs', false) + core.setOutput('rsc', true) + core.setOutput('ssr', true) + return + } + if (!hasCodeChanges(changedFiles)) { console.log('No code changes detected, only docs') core.setOutput('onlydocs', true)