Merge pull request #489 from trim21/get-commit-data
Some checks failed
publish / publish (push) Has been cancelled

feat: add method to get commit date from git
This commit is contained in:
CrazyMax
2024-11-13 13:39:55 +01:00
committed by GitHub
2 changed files with 11 additions and 0 deletions

View File

@@ -279,3 +279,10 @@ describe('tag', () => {
});
});
});
describe('getCommitDate', () => {
it('head', async () => {
const date = await Git.commitDate('HEAD');
await expect(date).toBeInstanceOf(Date);
});
});

View File

@@ -163,4 +163,8 @@ export class Git {
return res.stdout.trim();
});
}
public static async commitDate(ref: string): Promise<Date> {
return new Date(await Git.exec(['show', '-s', '--format="%ci"', ref]));
}
}