Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
chore(ci): Better error handling in detectChanges.mjs
  • Loading branch information
Tobbe committed Dec 27, 2023
commit eaa417738fa292e27c41eb9440d58ef1afa40e57
13 changes: 12 additions & 1 deletion .github/actions/detect-changes/detectChanges.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down