This commit is contained in:
Florent Poinsard 2023-12-06 12:25:58 +01:00 committed by GitHub
commit 58c44d4220
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34969 additions and 34761 deletions

69724
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -9,6 +9,7 @@ import {File, ChangeStatus} from './file'
import * as git from './git'
import {backslashEscape, shellEscape} from './list-format/shell-escape'
import {csvEscape} from './list-format/csv-escape'
import {getChanges} from './git'
type ExportFormat = 'none' | 'csv' | 'json' | 'shell' | 'escape'
@ -87,7 +88,10 @@ async function getChangedFiles(token: string, base: string, ref: string, initial
throw new Error(`'token' input parameter is required if action is triggered by 'pull_request_target' event`)
}
core.info('Github token is not available - changes will be detected from PRs merge commit')
return await git.getChangesInLastCommit()
const baseSha = github.context.payload.pull_request?.base.sha
const defaultBranch = github.context.payload.repository?.default_branch
const currentRef = await git.getCurrentRef()
return await git.getChanges(base || baseSha || defaultBranch, currentRef)
} else {
return getChangedFilesFromGit(base, ref, initialFetchDepth)
}