Skip to content

Commit

Permalink
fix: error getting diff for submodules (#1473)
Browse files Browse the repository at this point in the history
Co-authored-by: GitHub Action <[email protected]>
  • Loading branch information
jackton1 and actions-user authored Aug 23, 2023
1 parent 52dbf3e commit 17f3fec
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 19 deletions.
29 changes: 20 additions & 9 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.

31 changes: 29 additions & 2 deletions src/changedFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as path from 'path'
import {DiffResult} from './commitSha'
import {Inputs} from './inputs'
import {
canDiffCommits,
getAllChangedFiles,
getDirnameMaxDepth,
getDirNamesIncludeFilesPattern,
Expand Down Expand Up @@ -54,11 +55,24 @@ export const getRenamedFiles = async ({
)

if (submoduleShaResult.currentSha && submoduleShaResult.previousSha) {
let diff = '...'

if (
!(await canDiffCommits({
cwd: submoduleWorkingDirectory,
sha1: submoduleShaResult.previousSha,
sha2: submoduleShaResult.currentSha,
diff
}))
) {
diff = '..'
}

const submoduleRenamedFiles = await gitRenamedFiles({
cwd: submoduleWorkingDirectory,
sha1: submoduleShaResult.previousSha,
sha2: submoduleShaResult.currentSha,
diff: diffResult.diff,
diff,
oldNewSeparator: inputs.oldNewSeparator,
isSubmodule: true,
parentDir: submodulePath
Expand Down Expand Up @@ -133,11 +147,24 @@ export const getAllDiffFiles = async ({
)

if (submoduleShaResult.currentSha && submoduleShaResult.previousSha) {
let diff = '...'

if (
!(await canDiffCommits({
cwd: submoduleWorkingDirectory,
sha1: submoduleShaResult.previousSha,
sha2: submoduleShaResult.currentSha,
diff
}))
) {
diff = '..'
}

const submoduleFiles = await getAllChangedFiles({
cwd: submoduleWorkingDirectory,
sha1: submoduleShaResult.previousSha,
sha2: submoduleShaResult.currentSha,
diff: diffResult.diff,
diff,
isSubmodule: true,
parentDir: submodulePath,
outputRenamedFilesAsDeletedAndAdded
Expand Down
7 changes: 0 additions & 7 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,19 +311,12 @@ export async function run(): Promise<void> {
'baseSha',
'since',
'until',
'path',
'quotePath',
'diffRelative',
'sinceLastRemoteCommit',
'recoverDeletedFiles',
'recoverDeletedFilesToDestination',
'recoverFiles',
'recoverFilesSeparator',
'recoverFilesIgnore',
'recoverFilesIgnoreSeparator',
'includeAllOldNewRenamedFiles',
'oldNewSeparator',
'oldNewFilesSeparator',
'skipInitialFetch'
]

Expand Down

0 comments on commit 17f3fec

Please sign in to comment.