mirror of
https://github.com/docker/actions-toolkit.git
synced 2024-11-22 19:06:09 +08:00
Merge pull request #489 from trim21/get-commit-data
feat: add method to get commit date from git
This commit is contained in:
commit
8672cc70f4
@ -279,3 +279,10 @@ describe('tag', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('getCommitDate', () => {
|
||||||
|
it('head', async () => {
|
||||||
|
const date = await Git.commitDate('HEAD');
|
||||||
|
await expect(date).toBeInstanceOf(Date);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@ -163,4 +163,8 @@ export class Git {
|
|||||||
return res.stdout.trim();
|
return res.stdout.trim();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static async commitDate(ref: string): Promise<Date> {
|
||||||
|
return new Date(await Git.exec(['show', '-s', '--format="%ci"', ref]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user