git: use GitHub API for remoteSha if token provided

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2023-06-12 07:51:32 +02:00
parent acd3c9df19
commit b2a51dd6b4
5 changed files with 63 additions and 3 deletions

View File

@@ -66,9 +66,12 @@ describe('isInsideWorkTree', () => {
});
describe('remoteSha', () => {
it('returns git remote sha', async () => {
it('returns sha using git ls-remote', async () => {
expect(await Git.remoteSha('https://github.com/docker/buildx.git', 'refs/pull/648/head')).toEqual('f11797113e5a9b86bd976329c5dbb8a8bfdfadfa');
});
it('returns sha using github api', async () => {
expect(await Git.remoteSha('https://github.com/docker/buildx.git', 'refs/pull/648/head', process.env.GITHUB_TOKEN)).toEqual('f11797113e5a9b86bd976329c5dbb8a8bfdfadfa');
});
});
describe('remoteURL', () => {