Fixed bug retrieving older commits

This commit is contained in:
Tonye Jack 2023-05-25 17:16:16 -06:00
parent 9fdfe4cf16
commit 30e1bb07d4
3 changed files with 16 additions and 27 deletions

20
dist/index.js generated vendored
View File

@ -181,8 +181,7 @@ const getCurrentSHA = ({ inputs, workingDirectory }) => __awaiter(void 0, void 0
currentSha = yield (0, utils_1.gitLog)({ currentSha = yield (0, utils_1.gitLog)({
cwd: workingDirectory, cwd: workingDirectory,
args: [ args: [
'--format', '--format=%H',
'"%H"',
'-n', '-n',
'1', '1',
'--date', '--date',
@ -275,19 +274,14 @@ const getSHAForPushEvent = (inputs, env, workingDirectory, isShallow, hasSubmodu
if (inputs.since) { if (inputs.since) {
core.debug(`Getting base SHA for '${inputs.since}'...`); core.debug(`Getting base SHA for '${inputs.since}'...`);
try { try {
previousSha = yield (0, utils_1.gitLog)({ const allCommitsFrom = yield (0, utils_1.gitLog)({
cwd: workingDirectory, cwd: workingDirectory,
args: [ args: ['--format=%H', '--date', 'local', '--since', inputs.since]
'--format',
'"%H"',
'-n',
'1',
'--date',
'local',
'--since',
inputs.since
]
}); });
if (allCommitsFrom) {
const allCommitsFromArray = allCommitsFrom.split('\n');
previousSha = allCommitsFromArray[allCommitsFromArray.length - 1];
}
} }
catch (error) { catch (error) {
core.error(`Invalid since date: ${inputs.since}. ${error.message}`); core.error(`Invalid since date: ${inputs.since}. ${error.message}`);

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -30,8 +30,7 @@ const getCurrentSHA = async ({
currentSha = await gitLog({ currentSha = await gitLog({
cwd: workingDirectory, cwd: workingDirectory,
args: [ args: [
'--format', '--format=%H',
'"%H"',
'-n', '-n',
'1', '1',
'--date', '--date',
@ -154,19 +153,15 @@ export const getSHAForPushEvent = async (
if (inputs.since) { if (inputs.since) {
core.debug(`Getting base SHA for '${inputs.since}'...`) core.debug(`Getting base SHA for '${inputs.since}'...`)
try { try {
previousSha = await gitLog({ const allCommitsFrom = await gitLog({
cwd: workingDirectory, cwd: workingDirectory,
args: [ args: ['--format=%H', '--date', 'local', '--since', inputs.since]
'--format',
'"%H"',
'-n',
'1',
'--date',
'local',
'--since',
inputs.since
]
}) })
if (allCommitsFrom) {
const allCommitsFromArray = allCommitsFrom.split('\n')
previousSha = allCommitsFromArray[allCommitsFromArray.length - 1]
}
} catch (error) { } catch (error) {
core.error( core.error(
`Invalid since date: ${inputs.since}. ${(error as Error).message}` `Invalid since date: ${inputs.since}. ${(error as Error).message}`