@@ -6,13 +6,15 @@ import {IGitHelper, createGitHelper} from '../src/git-helper'
66import { getExecOutput } from '@actions/exec'
77import { env , cwd } from 'process'
88import { createCommandManager } from '../src/git-command-manager'
9+ import { IGitSourceSettings } from 'github-checkout/lib/git-source-settings'
910
1011let srcTmpPath : string | undefined
12+ let sourceSettings : IGitSourceSettings
1113
1214async function createTmpRepo ( ) : Promise < IGitHelper > {
1315 srcTmpPath = await makeTempPath ( )
14-
15- const gitHelper = await createGitHelper ( srcTmpPath , false )
16+ const settings = { ... sourceSettings , repositoryPath : srcTmpPath }
17+ const gitHelper = await createGitHelper ( settings )
1618 await gitHelper . init ( )
1719
1820 await getExecOutput ( `touch ${ srcTmpPath } /composer.json` )
@@ -33,8 +35,27 @@ async function destroyTmpRepo() {
3335let gitHelper : IGitHelper
3436
3537beforeEach ( async ( ) => {
38+ sourceSettings = {
39+ repositoryPath : '' ,
40+ repositoryOwner : '' ,
41+ repositoryName : '' ,
42+ ref : '' ,
43+ commit : '' ,
44+ clean : true ,
45+ fetchDepth : 1 ,
46+ lfs : false ,
47+ submodules : false ,
48+ nestedSubmodules : false ,
49+ authToken : env . PHP_PREFIXER_GH_TOKEN || '' ,
50+ sshKey : '' ,
51+ sshKnownHosts : '' ,
52+ sshStrict : true ,
53+ persistCredentials : true
54+ }
55+
3656 const inputHelper = new InputHelper ( )
37- gitHelper = await createGitHelper ( inputHelper . baseDirPath , false )
57+ sourceSettings . repositoryPath = inputHelper . baseDirPath
58+ gitHelper = await createGitHelper ( sourceSettings )
3859
3960 env . GITHUB_REPOSITORY = 'lorem/ipsum'
4061} )
@@ -135,7 +156,8 @@ test('last matching tag no tag', async () => {
135156
136157test ( 'push' , async ( ) => {
137158 const srcTmpPath = await makeTempPath ( )
138- const gitHelper = await createGitHelper ( srcTmpPath , false )
159+ const settings = { ...sourceSettings , repositoryPath : srcTmpPath }
160+ const gitHelper = await createGitHelper ( settings )
139161 await gitHelper . init ( )
140162 await getExecOutput ( `touch ${ srcTmpPath } /composer.json` )
141163 await gitHelper . commitAll ( )
@@ -147,14 +169,16 @@ test('push', async () => {
147169 const targetTmpPath = await makeTempPath ( )
148170 await getExecOutput ( `git clone ${ upstreamTmpPath } ${ targetTmpPath } ` )
149171
150- const targetIGitHelper = await createGitHelper ( targetTmpPath , false )
172+ const targetSettings = { ...sourceSettings , repositoryPath : targetTmpPath }
173+ const targetIGitHelper = await createGitHelper ( targetSettings )
151174 const licenseFile = `${ targetTmpPath } /license.txt`
152175 await getExecOutput ( `touch ${ licenseFile } ` )
153176 await targetIGitHelper . commitAll ( )
154177 await targetIGitHelper . tag ( '1.2.4' )
155178 await targetIGitHelper . push ( 'origin' , 'master' )
156179
157- const upstreamIGitHelper = await createGitHelper ( upstreamTmpPath , false )
180+ const upstreamSettings = { ...sourceSettings , repositoryPath : upstreamTmpPath }
181+ const upstreamIGitHelper = await createGitHelper ( upstreamSettings )
158182 const result1 = await upstreamIGitHelper . tagExists ( '1.2.3' )
159183 expect ( result1 ) . toBeTruthy ( )
160184 const result2 = await upstreamIGitHelper . tagExists ( '1.2.4' )
@@ -187,7 +211,8 @@ test('tag exists', async () => {
187211
188212test ( 'has changes' , async ( ) => {
189213 const srcTmpPath = await makeTempPath ( )
190- const gitHelper = await createGitHelper ( srcTmpPath , false )
214+ const settings = { ...sourceSettings , repositoryPath : srcTmpPath }
215+ const gitHelper = await createGitHelper ( settings )
191216 await gitHelper . init ( )
192217
193218 await fs . promises . mkdir ( `${ srcTmpPath } /vendor` )
@@ -219,7 +244,10 @@ test('remote add', async () => {
219244
220245 if ( srcTmpPath ) {
221246 const commandManager = await createCommandManager ( srcTmpPath , false )
222- await commandManager . config ( 'remote.origin.url' , 'git@github.com:PHP-Prefixer/php-prefixer-build-action.git' )
247+ await commandManager . config (
248+ 'remote.origin.url' ,
249+ 'git@github.com:PHP-Prefixer/php-prefixer-build-action.git'
250+ )
223251 await tmpIGitHelper . remoteAdd ( true , 'prefixed-origin-3' )
224252 const result3 = await tmpIGitHelper . remoteExists ( 'prefixed-origin-3' )
225253 expect ( result3 ) . toBeTruthy ( )
0 commit comments