mirror of
				https://github.com/actions/checkout.git
				synced 2025-11-04 13:29:15 +08:00 
			
		
		
		
	Convert checkout to a regular action (#70)
This commit is contained in:
		
							
								
								
									
										45
									
								
								__test__/git-version.test.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								__test__/git-version.test.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
import {GitVersion} from '../lib/git-version'
 | 
			
		||||
 | 
			
		||||
describe('git-version tests', () => {
 | 
			
		||||
  it('basics', async () => {
 | 
			
		||||
    let version = new GitVersion('')
 | 
			
		||||
    expect(version.isValid()).toBeFalsy()
 | 
			
		||||
 | 
			
		||||
    version = new GitVersion('asdf')
 | 
			
		||||
    expect(version.isValid()).toBeFalsy()
 | 
			
		||||
 | 
			
		||||
    version = new GitVersion('1.2')
 | 
			
		||||
    expect(version.isValid()).toBeTruthy()
 | 
			
		||||
    expect(version.toString()).toBe('1.2')
 | 
			
		||||
 | 
			
		||||
    version = new GitVersion('1.2.3')
 | 
			
		||||
    expect(version.isValid()).toBeTruthy()
 | 
			
		||||
    expect(version.toString()).toBe('1.2.3')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('check minimum', async () => {
 | 
			
		||||
    let version = new GitVersion('4.5')
 | 
			
		||||
    expect(version.checkMinimum(new GitVersion('3.6'))).toBeTruthy()
 | 
			
		||||
    expect(version.checkMinimum(new GitVersion('3.6.7'))).toBeTruthy()
 | 
			
		||||
    expect(version.checkMinimum(new GitVersion('4.4'))).toBeTruthy()
 | 
			
		||||
    expect(version.checkMinimum(new GitVersion('4.5'))).toBeTruthy()
 | 
			
		||||
    expect(version.checkMinimum(new GitVersion('4.5.0'))).toBeTruthy()
 | 
			
		||||
    expect(version.checkMinimum(new GitVersion('4.6'))).toBeFalsy()
 | 
			
		||||
    expect(version.checkMinimum(new GitVersion('4.6.0'))).toBeFalsy()
 | 
			
		||||
    expect(version.checkMinimum(new GitVersion('5.1'))).toBeFalsy()
 | 
			
		||||
    expect(version.checkMinimum(new GitVersion('5.1.2'))).toBeFalsy()
 | 
			
		||||
 | 
			
		||||
    version = new GitVersion('4.5.6')
 | 
			
		||||
    expect(version.checkMinimum(new GitVersion('3.6'))).toBeTruthy()
 | 
			
		||||
    expect(version.checkMinimum(new GitVersion('3.6.7'))).toBeTruthy()
 | 
			
		||||
    expect(version.checkMinimum(new GitVersion('4.4'))).toBeTruthy()
 | 
			
		||||
    expect(version.checkMinimum(new GitVersion('4.5'))).toBeTruthy()
 | 
			
		||||
    expect(version.checkMinimum(new GitVersion('4.5.5'))).toBeTruthy()
 | 
			
		||||
    expect(version.checkMinimum(new GitVersion('4.5.6'))).toBeTruthy()
 | 
			
		||||
    expect(version.checkMinimum(new GitVersion('4.5.7'))).toBeFalsy()
 | 
			
		||||
    expect(version.checkMinimum(new GitVersion('4.6'))).toBeFalsy()
 | 
			
		||||
    expect(version.checkMinimum(new GitVersion('4.6.0'))).toBeFalsy()
 | 
			
		||||
    expect(version.checkMinimum(new GitVersion('5.1'))).toBeFalsy()
 | 
			
		||||
    expect(version.checkMinimum(new GitVersion('5.1.2'))).toBeFalsy()
 | 
			
		||||
  })
 | 
			
		||||
})
 | 
			
		||||
							
								
								
									
										120
									
								
								__test__/input-helper.test.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										120
									
								
								__test__/input-helper.test.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,120 @@
 | 
			
		||||
import * as assert from 'assert'
 | 
			
		||||
import * as path from 'path'
 | 
			
		||||
import {ISourceSettings} from '../lib/git-source-provider'
 | 
			
		||||
 | 
			
		||||
const originalGitHubWorkspace = process.env['GITHUB_WORKSPACE']
 | 
			
		||||
const gitHubWorkspace = path.resolve('/checkout-tests/workspace')
 | 
			
		||||
 | 
			
		||||
// Late bind
 | 
			
		||||
let inputHelper: any
 | 
			
		||||
 | 
			
		||||
// Mock @actions/core
 | 
			
		||||
let inputs = {} as any
 | 
			
		||||
const mockCore = jest.genMockFromModule('@actions/core') as any
 | 
			
		||||
mockCore.getInput = (name: string) => {
 | 
			
		||||
  return inputs[name]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Mock @actions/github
 | 
			
		||||
const mockGitHub = jest.genMockFromModule('@actions/github') as any
 | 
			
		||||
mockGitHub.context = {
 | 
			
		||||
  repo: {
 | 
			
		||||
    owner: 'some-owner',
 | 
			
		||||
    repo: 'some-repo'
 | 
			
		||||
  },
 | 
			
		||||
  ref: 'refs/heads/some-ref',
 | 
			
		||||
  sha: '1234567890123456789012345678901234567890'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Mock ./fs-helper
 | 
			
		||||
const mockFSHelper = jest.genMockFromModule('../lib/fs-helper') as any
 | 
			
		||||
mockFSHelper.directoryExistsSync = (path: string) => path == gitHubWorkspace
 | 
			
		||||
 | 
			
		||||
describe('input-helper tests', () => {
 | 
			
		||||
  beforeAll(() => {
 | 
			
		||||
    // GitHub workspace
 | 
			
		||||
    process.env['GITHUB_WORKSPACE'] = gitHubWorkspace
 | 
			
		||||
 | 
			
		||||
    // Mocks
 | 
			
		||||
    jest.setMock('@actions/core', mockCore)
 | 
			
		||||
    jest.setMock('@actions/github', mockGitHub)
 | 
			
		||||
    jest.setMock('../lib/fs-helper', mockFSHelper)
 | 
			
		||||
 | 
			
		||||
    // Now import
 | 
			
		||||
    inputHelper = require('../lib/input-helper')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  beforeEach(() => {
 | 
			
		||||
    // Reset inputs
 | 
			
		||||
    inputs = {}
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  afterAll(() => {
 | 
			
		||||
    // Reset GitHub workspace
 | 
			
		||||
    delete process.env['GITHUB_WORKSPACE']
 | 
			
		||||
    if (originalGitHubWorkspace) {
 | 
			
		||||
      process.env['GITHUB_WORKSPACE'] = originalGitHubWorkspace
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Reset modules
 | 
			
		||||
    jest.resetModules()
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('sets defaults', () => {
 | 
			
		||||
    const settings: ISourceSettings = inputHelper.getInputs()
 | 
			
		||||
    expect(settings).toBeTruthy()
 | 
			
		||||
    expect(settings.accessToken).toBeFalsy()
 | 
			
		||||
    expect(settings.clean).toBe(true)
 | 
			
		||||
    expect(settings.commit).toBeTruthy()
 | 
			
		||||
    expect(settings.commit).toBe('1234567890123456789012345678901234567890')
 | 
			
		||||
    expect(settings.fetchDepth).toBe(1)
 | 
			
		||||
    expect(settings.lfs).toBe(false)
 | 
			
		||||
    expect(settings.ref).toBe('refs/heads/some-ref')
 | 
			
		||||
    expect(settings.repositoryName).toBe('some-repo')
 | 
			
		||||
    expect(settings.repositoryOwner).toBe('some-owner')
 | 
			
		||||
    expect(settings.repositoryPath).toBe(gitHubWorkspace)
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('requires qualified repo', () => {
 | 
			
		||||
    inputs.repository = 'some-unqualified-repo'
 | 
			
		||||
    assert.throws(() => {
 | 
			
		||||
      inputHelper.getInputs()
 | 
			
		||||
    }, /Invalid repository 'some-unqualified-repo'/)
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('roots path', () => {
 | 
			
		||||
    inputs.path = 'some-directory/some-subdirectory'
 | 
			
		||||
    const settings: ISourceSettings = inputHelper.getInputs()
 | 
			
		||||
    expect(settings.repositoryPath).toBe(
 | 
			
		||||
      path.join(gitHubWorkspace, 'some-directory', 'some-subdirectory')
 | 
			
		||||
    )
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('sets correct default ref/sha for other repo', () => {
 | 
			
		||||
    inputs.repository = 'some-owner/some-other-repo'
 | 
			
		||||
    const settings: ISourceSettings = inputHelper.getInputs()
 | 
			
		||||
    expect(settings.ref).toBe('refs/heads/master')
 | 
			
		||||
    expect(settings.commit).toBeFalsy()
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('sets ref to empty when explicit sha', () => {
 | 
			
		||||
    inputs.ref = '1111111111222222222233333333334444444444'
 | 
			
		||||
    const settings: ISourceSettings = inputHelper.getInputs()
 | 
			
		||||
    expect(settings.ref).toBeFalsy()
 | 
			
		||||
    expect(settings.commit).toBe('1111111111222222222233333333334444444444')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('sets sha to empty when explicit ref', () => {
 | 
			
		||||
    inputs.ref = 'refs/heads/some-other-ref'
 | 
			
		||||
    const settings: ISourceSettings = inputHelper.getInputs()
 | 
			
		||||
    expect(settings.ref).toBe('refs/heads/some-other-ref')
 | 
			
		||||
    expect(settings.commit).toBeFalsy()
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('gives good error message for submodules input', () => {
 | 
			
		||||
    inputs.submodules = 'true'
 | 
			
		||||
    assert.throws(() => {
 | 
			
		||||
      inputHelper.getInputs()
 | 
			
		||||
    }, /The input 'submodules' is not supported/)
 | 
			
		||||
  })
 | 
			
		||||
})
 | 
			
		||||
							
								
								
									
										10
									
								
								__test__/modify-work-tree.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										10
									
								
								__test__/modify-work-tree.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
if [ ! -f "./basic/basic-file.txt" ]; then
 | 
			
		||||
    echo "Expected basic file does not exist"
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
echo hello >> ./basic/basic-file.txt
 | 
			
		||||
echo hello >> ./basic/new-file.txt
 | 
			
		||||
git -C ./basic status
 | 
			
		||||
							
								
								
									
										168
									
								
								__test__/ref-helper.test.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										168
									
								
								__test__/ref-helper.test.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,168 @@
 | 
			
		||||
import * as assert from 'assert'
 | 
			
		||||
import * as refHelper from '../lib/ref-helper'
 | 
			
		||||
import {IGitCommandManager} from '../lib/git-command-manager'
 | 
			
		||||
 | 
			
		||||
const commit = '1234567890123456789012345678901234567890'
 | 
			
		||||
let git: IGitCommandManager
 | 
			
		||||
 | 
			
		||||
describe('ref-helper tests', () => {
 | 
			
		||||
  beforeEach(() => {
 | 
			
		||||
    git = ({} as unknown) as IGitCommandManager
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('getCheckoutInfo requires git', async () => {
 | 
			
		||||
    const git = (null as unknown) as IGitCommandManager
 | 
			
		||||
    try {
 | 
			
		||||
      await refHelper.getCheckoutInfo(git, 'refs/heads/my/branch', commit)
 | 
			
		||||
      throw new Error('Should not reach here')
 | 
			
		||||
    } catch (err) {
 | 
			
		||||
      expect(err.message).toBe('Arg git cannot be empty')
 | 
			
		||||
    }
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('getCheckoutInfo requires ref or commit', async () => {
 | 
			
		||||
    try {
 | 
			
		||||
      await refHelper.getCheckoutInfo(git, '', '')
 | 
			
		||||
      throw new Error('Should not reach here')
 | 
			
		||||
    } catch (err) {
 | 
			
		||||
      expect(err.message).toBe('Args ref and commit cannot both be empty')
 | 
			
		||||
    }
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('getCheckoutInfo sha only', async () => {
 | 
			
		||||
    const checkoutInfo = await refHelper.getCheckoutInfo(git, '', commit)
 | 
			
		||||
    expect(checkoutInfo.ref).toBe(commit)
 | 
			
		||||
    expect(checkoutInfo.startPoint).toBeFalsy()
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('getCheckoutInfo refs/heads/', async () => {
 | 
			
		||||
    const checkoutInfo = await refHelper.getCheckoutInfo(
 | 
			
		||||
      git,
 | 
			
		||||
      'refs/heads/my/branch',
 | 
			
		||||
      commit
 | 
			
		||||
    )
 | 
			
		||||
    expect(checkoutInfo.ref).toBe('my/branch')
 | 
			
		||||
    expect(checkoutInfo.startPoint).toBe('refs/remotes/origin/my/branch')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('getCheckoutInfo refs/pull/', async () => {
 | 
			
		||||
    const checkoutInfo = await refHelper.getCheckoutInfo(
 | 
			
		||||
      git,
 | 
			
		||||
      'refs/pull/123/merge',
 | 
			
		||||
      commit
 | 
			
		||||
    )
 | 
			
		||||
    expect(checkoutInfo.ref).toBe('refs/remotes/pull/123/merge')
 | 
			
		||||
    expect(checkoutInfo.startPoint).toBeFalsy()
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('getCheckoutInfo refs/tags/', async () => {
 | 
			
		||||
    const checkoutInfo = await refHelper.getCheckoutInfo(
 | 
			
		||||
      git,
 | 
			
		||||
      'refs/tags/my-tag',
 | 
			
		||||
      commit
 | 
			
		||||
    )
 | 
			
		||||
    expect(checkoutInfo.ref).toBe('refs/tags/my-tag')
 | 
			
		||||
    expect(checkoutInfo.startPoint).toBeFalsy()
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('getCheckoutInfo unqualified branch only', async () => {
 | 
			
		||||
    git.branchExists = jest.fn(async (remote: boolean, pattern: string) => {
 | 
			
		||||
      return true
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    const checkoutInfo = await refHelper.getCheckoutInfo(git, 'my/branch', '')
 | 
			
		||||
 | 
			
		||||
    expect(checkoutInfo.ref).toBe('my/branch')
 | 
			
		||||
    expect(checkoutInfo.startPoint).toBe('refs/remotes/origin/my/branch')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('getCheckoutInfo unqualified tag only', async () => {
 | 
			
		||||
    git.branchExists = jest.fn(async (remote: boolean, pattern: string) => {
 | 
			
		||||
      return false
 | 
			
		||||
    })
 | 
			
		||||
    git.tagExists = jest.fn(async (pattern: string) => {
 | 
			
		||||
      return true
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    const checkoutInfo = await refHelper.getCheckoutInfo(git, 'my-tag', '')
 | 
			
		||||
 | 
			
		||||
    expect(checkoutInfo.ref).toBe('refs/tags/my-tag')
 | 
			
		||||
    expect(checkoutInfo.startPoint).toBeFalsy()
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('getCheckoutInfo unqualified ref only, not a branch or tag', async () => {
 | 
			
		||||
    git.branchExists = jest.fn(async (remote: boolean, pattern: string) => {
 | 
			
		||||
      return false
 | 
			
		||||
    })
 | 
			
		||||
    git.tagExists = jest.fn(async (pattern: string) => {
 | 
			
		||||
      return false
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    try {
 | 
			
		||||
      await refHelper.getCheckoutInfo(git, 'my-ref', '')
 | 
			
		||||
      throw new Error('Should not reach here')
 | 
			
		||||
    } catch (err) {
 | 
			
		||||
      expect(err.message).toBe(
 | 
			
		||||
        "A branch or tag with the name 'my-ref' could not be found"
 | 
			
		||||
      )
 | 
			
		||||
    }
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('getRefSpec requires ref or commit', async () => {
 | 
			
		||||
    assert.throws(
 | 
			
		||||
      () => refHelper.getRefSpec('', ''),
 | 
			
		||||
      /Args ref and commit cannot both be empty/
 | 
			
		||||
    )
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('getRefSpec sha + refs/heads/', async () => {
 | 
			
		||||
    const refSpec = refHelper.getRefSpec('refs/heads/my/branch', commit)
 | 
			
		||||
    expect(refSpec.length).toBe(1)
 | 
			
		||||
    expect(refSpec[0]).toBe(`+${commit}:refs/remotes/origin/my/branch`)
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('getRefSpec sha + refs/pull/', async () => {
 | 
			
		||||
    const refSpec = refHelper.getRefSpec('refs/pull/123/merge', commit)
 | 
			
		||||
    expect(refSpec.length).toBe(1)
 | 
			
		||||
    expect(refSpec[0]).toBe(`+${commit}:refs/remotes/pull/123/merge`)
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('getRefSpec sha + refs/tags/', async () => {
 | 
			
		||||
    const refSpec = refHelper.getRefSpec('refs/tags/my-tag', commit)
 | 
			
		||||
    expect(refSpec.length).toBe(1)
 | 
			
		||||
    expect(refSpec[0]).toBe(`+${commit}:refs/tags/my-tag`)
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('getRefSpec sha only', async () => {
 | 
			
		||||
    const refSpec = refHelper.getRefSpec('', commit)
 | 
			
		||||
    expect(refSpec.length).toBe(1)
 | 
			
		||||
    expect(refSpec[0]).toBe(commit)
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('getRefSpec unqualified ref only', async () => {
 | 
			
		||||
    const refSpec = refHelper.getRefSpec('my-ref', '')
 | 
			
		||||
    expect(refSpec.length).toBe(2)
 | 
			
		||||
    expect(refSpec[0]).toBe('+refs/heads/my-ref*:refs/remotes/origin/my-ref*')
 | 
			
		||||
    expect(refSpec[1]).toBe('+refs/tags/my-ref*:refs/tags/my-ref*')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('getRefSpec refs/heads/ only', async () => {
 | 
			
		||||
    const refSpec = refHelper.getRefSpec('refs/heads/my/branch', '')
 | 
			
		||||
    expect(refSpec.length).toBe(1)
 | 
			
		||||
    expect(refSpec[0]).toBe(
 | 
			
		||||
      '+refs/heads/my/branch:refs/remotes/origin/my/branch'
 | 
			
		||||
    )
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('getRefSpec refs/pull/ only', async () => {
 | 
			
		||||
    const refSpec = refHelper.getRefSpec('refs/pull/123/merge', '')
 | 
			
		||||
    expect(refSpec.length).toBe(1)
 | 
			
		||||
    expect(refSpec[0]).toBe('+refs/pull/123/merge:refs/remotes/pull/123/merge')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('getRefSpec refs/tags/ only', async () => {
 | 
			
		||||
    const refSpec = refHelper.getRefSpec('refs/tags/my-tag', '')
 | 
			
		||||
    expect(refSpec.length).toBe(1)
 | 
			
		||||
    expect(refSpec[0]).toBe('+refs/tags/my-tag:refs/tags/my-tag')
 | 
			
		||||
  })
 | 
			
		||||
})
 | 
			
		||||
							
								
								
									
										10
									
								
								__test__/verify-basic.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										10
									
								
								__test__/verify-basic.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
if [ ! -f "./basic/basic-file.txt" ]; then
 | 
			
		||||
    echo "Expected basic file does not exist"
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Verify auth token
 | 
			
		||||
cd basic
 | 
			
		||||
git fetch
 | 
			
		||||
							
								
								
									
										13
									
								
								__test__/verify-clean.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										13
									
								
								__test__/verify-clean.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
if [[ "$(git -C ./basic status --porcelain)" != "" ]]; then
 | 
			
		||||
    echo ----------------------------------------
 | 
			
		||||
    echo git status
 | 
			
		||||
    echo ----------------------------------------
 | 
			
		||||
    git status
 | 
			
		||||
    echo ----------------------------------------
 | 
			
		||||
    echo git diff
 | 
			
		||||
    echo ----------------------------------------
 | 
			
		||||
    git diff
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
							
								
								
									
										11
									
								
								__test__/verify-lfs.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										11
									
								
								__test__/verify-lfs.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
if [ ! -f "./lfs/regular-file.txt" ]; then
 | 
			
		||||
    echo "Expected regular file does not exist"
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ ! -f "./lfs/lfs-file.bin" ]; then
 | 
			
		||||
    echo "Expected lfs file does not exist"
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
							
								
								
									
										17
									
								
								__test__/verify-no-unstaged-changes.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										17
									
								
								__test__/verify-no-unstaged-changes.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
if [[ "$(git status --porcelain)" != "" ]]; then
 | 
			
		||||
    echo ----------------------------------------
 | 
			
		||||
    echo git status
 | 
			
		||||
    echo ----------------------------------------
 | 
			
		||||
    git status
 | 
			
		||||
    echo ----------------------------------------
 | 
			
		||||
    echo git diff
 | 
			
		||||
    echo ----------------------------------------
 | 
			
		||||
    git diff
 | 
			
		||||
    echo ----------------------------------------
 | 
			
		||||
    echo Troubleshooting
 | 
			
		||||
    echo ----------------------------------------
 | 
			
		||||
    echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && npm ci && npm run all"
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
							
								
								
									
										11
									
								
								__test__/verify-side-by-side.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										11
									
								
								__test__/verify-side-by-side.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
if [ ! -f "./side-by-side-1/side-by-side-test-file-1.txt" ]; then
 | 
			
		||||
    echo "Expected file 1 does not exist"
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ ! -f "./side-by-side-2/side-by-side-test-file-2.txt" ]; then
 | 
			
		||||
    echo "Expected file 2 does not exist"
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
							
								
								
									
										11
									
								
								__test__/verify-submodules-not-checked-out.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										11
									
								
								__test__/verify-submodules-not-checked-out.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
if [ ! -f "./submodules-not-checked-out/regular-file.txt" ]; then
 | 
			
		||||
    echo "Expected regular file does not exist"
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ -f "./submodules-not-checked-out/submodule-level-1/submodule-file.txt" ]; then
 | 
			
		||||
    echo "Unexpected submodule file exists"
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
		Reference in New Issue
	
	Block a user