Skip to content

Commit

Permalink
fix: error using since_last_remote_commit with the first PR commit (#…
Browse files Browse the repository at this point in the history
…2163)

Co-authored-by: tj-actions[bot] <109116665+tj-actions-bot@users.noreply.github.com>
Co-authored-by: GitHub Action <action@github.com>
  • Loading branch information
3 people committed Jun 23, 2024
1 parent 373db58 commit cc3bbb0
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 40 deletions.
40 changes: 19 additions & 21 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

33 changes: 15 additions & 18 deletions src/commitSha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,32 +380,29 @@ export const getSHAForPullRequestEvent = async ({
'Failed to fetch pull request branch. Please ensure "persist-credentials" is set to "true" when checking out the repository. See: https://github.com/actions/checkout#usage'
)
}
core.debug('Fetching target branch...')
await gitFetch({
cwd: workingDirectory,
args: [
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`,
remoteName,
`+refs/heads/${github.context.payload.pull_request?.base?.ref}:refs/remotes/${remoteName}/${github.context.payload.pull_request?.base?.ref}`
]
})

if (!inputs.sinceLastRemoteCommit) {
core.debug('Fetching target branch...')
await gitFetch({
if (diffSubmodule) {
await gitFetchSubmodules({
cwd: workingDirectory,
args: [
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`,
remoteName,
`+refs/heads/${targetBranch}:refs/remotes/${remoteName}/${targetBranch}`
`--deepen=${inputs.fetchDepth}`
]
})

if (diffSubmodule) {
await gitFetchSubmodules({
cwd: workingDirectory,
args: [
...gitFetchExtraArgs,
'-u',
'--progress',
`--deepen=${inputs.fetchDepth}`
]
})
}
}
} else {
if (diffSubmodule && inputs.fetchAdditionalSubmoduleHistory) {
Expand Down

0 comments on commit cc3bbb0

Please sign in to comment.