mirror of
https://github.com/dorny/paths-filter.git
synced 2025-06-08 00:59:04 +00:00
Compare base and ref when token is empty
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
This commit is contained in:
parent
1ec7035ff5
commit
5266f0ac59
2 changed files with 11 additions and 3 deletions
|
@ -8,6 +8,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'
|
||||
|
||||
|
@ -86,7 +87,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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue