(opts = {})
| 487 | } |
| 488 | |
| 489 | async ci(opts = {}) { |
| 490 | const { |
| 491 | unshallow = false, |
| 492 | userEmail = GIT_USER_EMAIL, |
| 493 | userName = GIT_USER_NAME, |
| 494 | remote = GIT_REMOTE |
| 495 | } = opts; |
| 496 | const { fetchDepth = unshallow ? 0 : undefined } = opts; |
| 497 | |
| 498 | const driver = this.getDriver(); |
| 499 | const commands = await driver.updateGitConfig({ |
| 500 | userName, |
| 501 | userEmail, |
| 502 | remote |
| 503 | }); |
| 504 | for (const command of commands) { |
| 505 | try { |
| 506 | await exec(...command); |
| 507 | } catch (err) { |
| 508 | if ( |
| 509 | JSON.stringify(command.slice(0, 3)) !== |
| 510 | JSON.stringify(['git', 'config', '--unset']) |
| 511 | ) |
| 512 | throw err; |
| 513 | } |
| 514 | } |
| 515 | if (fetchDepth !== undefined) { |
| 516 | if (fetchDepth <= 0) { |
| 517 | if ( |
| 518 | (await exec('git', 'rev-parse', '--is-shallow-repository')) === 'true' |
| 519 | ) { |
| 520 | return await exec('git', 'fetch', '--all', '--tags', '--unshallow'); |
| 521 | } |
| 522 | } else { |
| 523 | return await exec( |
| 524 | 'git', |
| 525 | 'fetch', |
| 526 | '--all', |
| 527 | '--tags', |
| 528 | '--depth', |
| 529 | fetchDepth |
| 530 | ); |
| 531 | } |
| 532 | } |
| 533 | } |
| 534 | |
| 535 | async prCreate(opts = {}) { |
| 536 | const driver = this.getDriver(); |
no test coverage detected