mirror of
				https://github.com/actions/checkout.git
				synced 2025-11-04 07:48:09 +08:00 
			
		
		
		
	Compare commits
	
		
			5 Commits
		
	
	
		
			2bcd7c6585
			...
			jww3-minve
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					425626d259 | ||
| 
						 | 
					64dbc8124d | ||
| 
						 | 
					06abf5564e | ||
| 
						 | 
					db715dc5a4 | ||
| 
						 | 
					8926c30a30 | 
@@ -8,7 +8,7 @@ Only a single commit is fetched by default, for the ref/SHA that triggered the w
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
The auth token is persisted in the local git config. This enables your scripts to run authenticated git commands. The token is removed during post-job cleanup. Set `persist-credentials: false` to opt-out.
 | 
					The auth token is persisted in the local git config. This enables your scripts to run authenticated git commands. The token is removed during post-job cleanup. Set `persist-credentials: false` to opt-out.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
When Git 2.18 or higher is not in your PATH, falls back to the REST API to download the files.
 | 
					When Git 2.28 or higher is not in your PATH, falls back to the REST API to download the files.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# What's new
 | 
					# What's new
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,7 +24,7 @@ describe('git-auth-helper tests', () => {
 | 
				
			|||||||
      console.log(args, options.listeners.stdout)
 | 
					      console.log(args, options.listeners.stdout)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (args.includes('version')) {
 | 
					      if (args.includes('version')) {
 | 
				
			||||||
        options.listeners.stdout(Buffer.from('2.18'))
 | 
					        options.listeners.stdout(Buffer.from('2.28'))
 | 
				
			||||||
        return 0
 | 
					        return 0
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -57,7 +57,7 @@ describe('git-auth-helper tests', () => {
 | 
				
			|||||||
      console.log(args, options.listeners.stdout)
 | 
					      console.log(args, options.listeners.stdout)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (args.includes('version')) {
 | 
					      if (args.includes('version')) {
 | 
				
			||||||
        options.listeners.stdout(Buffer.from('2.18'))
 | 
					        options.listeners.stdout(Buffer.from('2.28'))
 | 
				
			||||||
        return 0
 | 
					        return 0
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -97,7 +97,7 @@ describe('Test fetchDepth and fetchTags options', () => {
 | 
				
			|||||||
      console.log(args, options.listeners.stdout)
 | 
					      console.log(args, options.listeners.stdout)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (args.includes('version')) {
 | 
					      if (args.includes('version')) {
 | 
				
			||||||
        options.listeners.stdout(Buffer.from('2.18'))
 | 
					        options.listeners.stdout(Buffer.from('2.28'))
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return 0
 | 
					      return 0
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										18
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										18
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							@@ -480,7 +480,8 @@ const retryHelper = __importStar(__nccwpck_require__(2155));
 | 
				
			|||||||
const git_version_1 = __nccwpck_require__(3142);
 | 
					const git_version_1 = __nccwpck_require__(3142);
 | 
				
			||||||
// Auth header not supported before 2.9
 | 
					// Auth header not supported before 2.9
 | 
				
			||||||
// Wire protocol v2 not supported before 2.18
 | 
					// Wire protocol v2 not supported before 2.18
 | 
				
			||||||
exports.MinimumGitVersion = new git_version_1.GitVersion('2.18');
 | 
					// sparse-checkout not [well-]supported before 2.28 (see https://github.com/actions/checkout/issues/1386)
 | 
				
			||||||
 | 
					exports.MinimumGitVersion = new git_version_1.GitVersion('2.28');
 | 
				
			||||||
function createCommandManager(workingDirectory, lfs, doSparseCheckout) {
 | 
					function createCommandManager(workingDirectory, lfs, doSparseCheckout) {
 | 
				
			||||||
    return __awaiter(this, void 0, void 0, function* () {
 | 
					    return __awaiter(this, void 0, void 0, function* () {
 | 
				
			||||||
        return yield GitCommandManager.createCommandManager(workingDirectory, lfs, doSparseCheckout);
 | 
					        return yield GitCommandManager.createCommandManager(workingDirectory, lfs, doSparseCheckout);
 | 
				
			||||||
@@ -523,13 +524,7 @@ class GitCommandManager {
 | 
				
			|||||||
    branchList(remote) {
 | 
					    branchList(remote) {
 | 
				
			||||||
        return __awaiter(this, void 0, void 0, function* () {
 | 
					        return __awaiter(this, void 0, void 0, function* () {
 | 
				
			||||||
            const result = [];
 | 
					            const result = [];
 | 
				
			||||||
            // Note, this implementation uses "rev-parse --symbolic-full-name" because the output from
 | 
					            const args = ['rev-parse', '--symbolic'];
 | 
				
			||||||
            // "branch --list" is more difficult when in a detached HEAD state.
 | 
					 | 
				
			||||||
            // TODO(https://github.com/actions/checkout/issues/786): this implementation uses
 | 
					 | 
				
			||||||
            // "rev-parse --symbolic-full-name" because there is a bug
 | 
					 | 
				
			||||||
            // in Git 2.18 that causes "rev-parse --symbolic" to output symbolic full names. When
 | 
					 | 
				
			||||||
            // 2.18 is no longer supported, we can switch back to --symbolic.
 | 
					 | 
				
			||||||
            const args = ['rev-parse', '--symbolic-full-name'];
 | 
					 | 
				
			||||||
            if (remote) {
 | 
					            if (remote) {
 | 
				
			||||||
                args.push('--remotes=origin');
 | 
					                args.push('--remotes=origin');
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -942,13 +937,6 @@ class GitCommandManager {
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            this.doSparseCheckout = doSparseCheckout;
 | 
					            this.doSparseCheckout = doSparseCheckout;
 | 
				
			||||||
            if (this.doSparseCheckout) {
 | 
					 | 
				
			||||||
                // The `git sparse-checkout` command was introduced in Git v2.25.0
 | 
					 | 
				
			||||||
                const minimumGitSparseCheckoutVersion = new git_version_1.GitVersion('2.25');
 | 
					 | 
				
			||||||
                if (!gitVersion.checkMinimum(minimumGitSparseCheckoutVersion)) {
 | 
					 | 
				
			||||||
                    throw new Error(`Minimum Git version required for sparse checkout is ${minimumGitSparseCheckoutVersion}. Your git ('${this.gitPath}') is ${gitVersion}`);
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            // Set the user agent
 | 
					            // Set the user agent
 | 
				
			||||||
            const gitHttpUserAgent = `git/${gitVersion} (github-actions-checkout)`;
 | 
					            const gitHttpUserAgent = `git/${gitVersion} (github-actions-checkout)`;
 | 
				
			||||||
            core.debug(`Set git useragent to: ${gitHttpUserAgent}`);
 | 
					            core.debug(`Set git useragent to: ${gitHttpUserAgent}`);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										4
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@@ -1,12 +1,12 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "name": "checkout",
 | 
					  "name": "checkout",
 | 
				
			||||||
  "version": "4.1.2",
 | 
					  "version": "5.0.0",
 | 
				
			||||||
  "lockfileVersion": 2,
 | 
					  "lockfileVersion": 2,
 | 
				
			||||||
  "requires": true,
 | 
					  "requires": true,
 | 
				
			||||||
  "packages": {
 | 
					  "packages": {
 | 
				
			||||||
    "": {
 | 
					    "": {
 | 
				
			||||||
      "name": "checkout",
 | 
					      "name": "checkout",
 | 
				
			||||||
      "version": "4.1.2",
 | 
					      "version": "5.0.0",
 | 
				
			||||||
      "license": "MIT",
 | 
					      "license": "MIT",
 | 
				
			||||||
      "dependencies": {
 | 
					      "dependencies": {
 | 
				
			||||||
        "@actions/core": "^1.10.0",
 | 
					        "@actions/core": "^1.10.0",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "name": "checkout",
 | 
					  "name": "checkout",
 | 
				
			||||||
  "version": "4.1.2",
 | 
					  "version": "5.0.0",
 | 
				
			||||||
  "description": "checkout action",
 | 
					  "description": "checkout action",
 | 
				
			||||||
  "main": "lib/main.js",
 | 
					  "main": "lib/main.js",
 | 
				
			||||||
  "scripts": {
 | 
					  "scripts": {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,8 @@ import {GitVersion} from './git-version'
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// Auth header not supported before 2.9
 | 
					// Auth header not supported before 2.9
 | 
				
			||||||
// Wire protocol v2 not supported before 2.18
 | 
					// Wire protocol v2 not supported before 2.18
 | 
				
			||||||
export const MinimumGitVersion = new GitVersion('2.18')
 | 
					// sparse-checkout not [well-]supported before 2.28 (see https://github.com/actions/checkout/issues/1386)
 | 
				
			||||||
 | 
					export const MinimumGitVersion = new GitVersion('2.28')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface IGitCommandManager {
 | 
					export interface IGitCommandManager {
 | 
				
			||||||
  branchDelete(remote: boolean, branch: string): Promise<void>
 | 
					  branchDelete(remote: boolean, branch: string): Promise<void>
 | 
				
			||||||
@@ -110,16 +111,7 @@ class GitCommandManager {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  async branchList(remote: boolean): Promise<string[]> {
 | 
					  async branchList(remote: boolean): Promise<string[]> {
 | 
				
			||||||
    const result: string[] = []
 | 
					    const result: string[] = []
 | 
				
			||||||
 | 
					    const args = ['rev-parse', '--symbolic']
 | 
				
			||||||
    // Note, this implementation uses "rev-parse --symbolic-full-name" because the output from
 | 
					 | 
				
			||||||
    // "branch --list" is more difficult when in a detached HEAD state.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // TODO(https://github.com/actions/checkout/issues/786): this implementation uses
 | 
					 | 
				
			||||||
    // "rev-parse --symbolic-full-name" because there is a bug
 | 
					 | 
				
			||||||
    // in Git 2.18 that causes "rev-parse --symbolic" to output symbolic full names. When
 | 
					 | 
				
			||||||
    // 2.18 is no longer supported, we can switch back to --symbolic.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    const args = ['rev-parse', '--symbolic-full-name']
 | 
					 | 
				
			||||||
    if (remote) {
 | 
					    if (remote) {
 | 
				
			||||||
      args.push('--remotes=origin')
 | 
					      args.push('--remotes=origin')
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
@@ -605,15 +597,7 @@ class GitCommandManager {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.doSparseCheckout = doSparseCheckout
 | 
					    this.doSparseCheckout = doSparseCheckout
 | 
				
			||||||
    if (this.doSparseCheckout) {
 | 
					
 | 
				
			||||||
      // The `git sparse-checkout` command was introduced in Git v2.25.0
 | 
					 | 
				
			||||||
      const minimumGitSparseCheckoutVersion = new GitVersion('2.25')
 | 
					 | 
				
			||||||
      if (!gitVersion.checkMinimum(minimumGitSparseCheckoutVersion)) {
 | 
					 | 
				
			||||||
        throw new Error(
 | 
					 | 
				
			||||||
          `Minimum Git version required for sparse checkout is ${minimumGitSparseCheckoutVersion}. Your git ('${this.gitPath}') is ${gitVersion}`
 | 
					 | 
				
			||||||
        )
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    // Set the user agent
 | 
					    // Set the user agent
 | 
				
			||||||
    const gitHttpUserAgent = `git/${gitVersion} (github-actions-checkout)`
 | 
					    const gitHttpUserAgent = `git/${gitVersion} (github-actions-checkout)`
 | 
				
			||||||
    core.debug(`Set git useragent to: ${gitHttpUserAgent}`)
 | 
					    core.debug(`Set git useragent to: ${gitHttpUserAgent}`)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user