Skip to content

Commit

Permalink
Fixed bug retrieving older commits
Browse files Browse the repository at this point in the history
  • Loading branch information
jackton1 committed May 25, 2023
1 parent 9fdfe4c commit 30e1bb0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 27 deletions.
20 changes: 7 additions & 13 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.

21 changes: 8 additions & 13 deletions src/commitSha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ const getCurrentSHA = async ({
currentSha = await gitLog({
cwd: workingDirectory,
args: [
'--format',
'"%H"',
'--format=%H',
'-n',
'1',
'--date',
Expand Down Expand Up @@ -154,19 +153,15 @@ export const getSHAForPushEvent = async (
if (inputs.since) {
core.debug(`Getting base SHA for '${inputs.since}'...`)
try {
previousSha = await gitLog({
const allCommitsFrom = await gitLog({
cwd: workingDirectory,
args: [
'--format',
'"%H"',
'-n',
'1',
'--date',
'local',
'--since',
inputs.since
]
args: ['--format=%H', '--date', 'local', '--since', inputs.since]
})

if (allCommitsFrom) {
const allCommitsFromArray = allCommitsFrom.split('\n')
previousSha = allCommitsFromArray[allCommitsFromArray.length - 1]
}
} catch (error) {
core.error(
`Invalid since date: ${inputs.since}. ${(error as Error).message}`
Expand Down

0 comments on commit 30e1bb0

Please sign in to comment.