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)({
cwd: workingDirectory,
args: [
'--format',
'"%H"',
'--format=%H',
'-n',
'1',
'--date',
@ -275,19 +274,14 @@ const getSHAForPushEvent = (inputs, env, workingDirectory, isShallow, hasSubmodu
if (inputs.since) {
core.debug(`Getting base SHA for '${inputs.since}'...`);
try {
previousSha = yield (0, utils_1.gitLog)({
const allCommitsFrom = yield (0, utils_1.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.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({
cwd: workingDirectory,
args: [
'--format',
'"%H"',
'--format=%H',
'-n',
'1',
'--date',
@ -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}`