mirror of
				https://kkgithub.com/actions/checkout
				synced 2025-11-04 16:21:55 +08:00 
			
		
		
		
	Compare commits
	
		
			7 Commits
		
	
	
		
			v3.2.0
			...
			users/vmjo
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 8e567abb9a | |||
| b2cc39f7b2 | |||
| 27135e314d | |||
| 7b187184d1 | |||
| ac59398561 | |||
| 3ba5ee6fac | |||
| 8856415920 | 
							
								
								
									
										4
									
								
								.github/workflows/codeql-analysis.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/codeql-analysis.yml
									
									
									
									
										vendored
									
									
								
							@ -42,7 +42,7 @@ jobs:
 | 
				
			|||||||
      uses: actions/checkout@v3
 | 
					      uses: actions/checkout@v3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    - name: Initialize CodeQL
 | 
					    - name: Initialize CodeQL
 | 
				
			||||||
      uses: github/codeql-action/init@v1
 | 
					      uses: github/codeql-action/init@v2
 | 
				
			||||||
      with:
 | 
					      with:
 | 
				
			||||||
        languages: ${{ matrix.language }}
 | 
					        languages: ${{ matrix.language }}
 | 
				
			||||||
        # If you wish to specify custom queries, you can do so here or in a config file.
 | 
					        # If you wish to specify custom queries, you can do so here or in a config file.
 | 
				
			||||||
@ -55,4 +55,4 @@ jobs:
 | 
				
			|||||||
    - run: rm -rf dist # We want code scanning to analyze lib instead (individual .js files)
 | 
					    - run: rm -rf dist # We want code scanning to analyze lib instead (individual .js files)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    - name: Perform CodeQL Analysis
 | 
					    - name: Perform CodeQL Analysis
 | 
				
			||||||
      uses: github/codeql-action/analyze@v1
 | 
					      uses: github/codeql-action/analyze@v2
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								.licenses/npm/qs.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.licenses/npm/qs.dep.yml
									
									
									
										generated
									
									
									
								
							@ -1,6 +1,6 @@
 | 
				
			|||||||
---
 | 
					---
 | 
				
			||||||
name: qs
 | 
					name: qs
 | 
				
			||||||
version: 6.10.1
 | 
					version: 6.11.0
 | 
				
			||||||
type: npm
 | 
					type: npm
 | 
				
			||||||
summary: A querystring parser that supports nesting and arrays, with a depth limit
 | 
					summary: A querystring parser that supports nesting and arrays, with a depth limit
 | 
				
			||||||
homepage: https://github.com/ljharb/qs
 | 
					homepage: https://github.com/ljharb/qs
 | 
				
			||||||
 | 
				
			|||||||
@ -155,6 +155,7 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
 | 
				
			|||||||
    repository: my-org/my-tools
 | 
					    repository: my-org/my-tools
 | 
				
			||||||
    path: my-tools
 | 
					    path: my-tools
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					> - If your secondary repository is private you will need to add the option noted in [Checkout multiple repos (private)](#Checkout-multiple-repos-private)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Checkout multiple repos (nested)
 | 
					## Checkout multiple repos (nested)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -168,6 +169,7 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
 | 
				
			|||||||
    repository: my-org/my-tools
 | 
					    repository: my-org/my-tools
 | 
				
			||||||
    path: my-tools
 | 
					    path: my-tools
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					> - If your secondary repository is private you will need to add the option noted in [Checkout multiple repos (private)](#Checkout-multiple-repos-private)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Checkout multiple repos (private)
 | 
					## Checkout multiple repos (private)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										80
									
								
								__test__/git-command-manager.test.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										80
									
								
								__test__/git-command-manager.test.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,80 @@
 | 
				
			|||||||
 | 
					import * as exec from '@actions/exec'
 | 
				
			||||||
 | 
					import * as fshelper from '../lib/fs-helper'
 | 
				
			||||||
 | 
					import * as commandManager from '../lib/git-command-manager'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					let git: commandManager.IGitCommandManager
 | 
				
			||||||
 | 
					let mockExec = jest.fn()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					describe('git-auth-helper tests', () => {
 | 
				
			||||||
 | 
					  beforeAll(async () => {})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  beforeEach(async () => {
 | 
				
			||||||
 | 
					    jest.spyOn(fshelper, 'fileExistsSync').mockImplementation(jest.fn())
 | 
				
			||||||
 | 
					    jest.spyOn(fshelper, 'directoryExistsSync').mockImplementation(jest.fn())
 | 
				
			||||||
 | 
					  })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  afterEach(() => {
 | 
				
			||||||
 | 
					    jest.restoreAllMocks()
 | 
				
			||||||
 | 
					  })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  afterAll(() => {})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  it('branch list matches', async () => {
 | 
				
			||||||
 | 
					    mockExec.mockImplementation((path, args, options) => {
 | 
				
			||||||
 | 
					      console.log(args, options.listeners.stdout)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if (args.includes('version')) {
 | 
				
			||||||
 | 
					        options.listeners.stdout(Buffer.from('2.18'))
 | 
				
			||||||
 | 
					        return 0
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if (args.includes('rev-parse')) {
 | 
				
			||||||
 | 
					        options.listeners.stdline(Buffer.from('refs/heads/foo'))
 | 
				
			||||||
 | 
					        options.listeners.stdline(Buffer.from('refs/heads/bar'))
 | 
				
			||||||
 | 
					        return 0
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      return 1
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    jest.spyOn(exec, 'exec').mockImplementation(mockExec)
 | 
				
			||||||
 | 
					    const workingDirectory = 'test'
 | 
				
			||||||
 | 
					    const lfs = false
 | 
				
			||||||
 | 
					    git = await commandManager.createCommandManager(workingDirectory, lfs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    let branches = await git.branchList(false)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    expect(branches).toHaveLength(2)
 | 
				
			||||||
 | 
					    expect(branches.sort()).toEqual(['foo', 'bar'].sort())
 | 
				
			||||||
 | 
					  })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  it('ambiguous ref name output is captured', async () => {
 | 
				
			||||||
 | 
					    mockExec.mockImplementation((path, args, options) => {
 | 
				
			||||||
 | 
					      console.log(args, options.listeners.stdout)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if (args.includes('version')) {
 | 
				
			||||||
 | 
					        options.listeners.stdout(Buffer.from('2.18'))
 | 
				
			||||||
 | 
					        return 0
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if (args.includes('rev-parse')) {
 | 
				
			||||||
 | 
					        options.listeners.stdline(Buffer.from('refs/heads/foo'))
 | 
				
			||||||
 | 
					        // If refs/tags/v1 and refs/heads/tags/v1 existed on this repository
 | 
				
			||||||
 | 
					        options.listeners.errline(
 | 
				
			||||||
 | 
					          Buffer.from("error: refname 'tags/v1' is ambiguous")
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					        return 0
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      return 1
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    jest.spyOn(exec, 'exec').mockImplementation(mockExec)
 | 
				
			||||||
 | 
					    const workingDirectory = 'test'
 | 
				
			||||||
 | 
					    const lfs = false
 | 
				
			||||||
 | 
					    git = await commandManager.createCommandManager(workingDirectory, lfs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    let branches = await git.branchList(false)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    expect(branches).toHaveLength(1)
 | 
				
			||||||
 | 
					    expect(branches.sort()).toEqual(['foo'].sort())
 | 
				
			||||||
 | 
					  })
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
							
								
								
									
										36625
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										36625
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										69
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										69
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@ -12,7 +12,7 @@
 | 
				
			|||||||
        "@actions/core": "^1.10.0",
 | 
					        "@actions/core": "^1.10.0",
 | 
				
			||||||
        "@actions/exec": "^1.0.1",
 | 
					        "@actions/exec": "^1.0.1",
 | 
				
			||||||
        "@actions/github": "^2.2.0",
 | 
					        "@actions/github": "^2.2.0",
 | 
				
			||||||
        "@actions/io": "^1.1.2",
 | 
					        "@actions/io": "^1.1.3",
 | 
				
			||||||
        "@actions/tool-cache": "^1.1.2",
 | 
					        "@actions/tool-cache": "^1.1.2",
 | 
				
			||||||
        "uuid": "^3.3.3"
 | 
					        "uuid": "^3.3.3"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
@ -22,7 +22,7 @@
 | 
				
			|||||||
        "@types/uuid": "^3.4.6",
 | 
					        "@types/uuid": "^3.4.6",
 | 
				
			||||||
        "@typescript-eslint/eslint-plugin": "^5.45.0",
 | 
					        "@typescript-eslint/eslint-plugin": "^5.45.0",
 | 
				
			||||||
        "@typescript-eslint/parser": "^5.45.0",
 | 
					        "@typescript-eslint/parser": "^5.45.0",
 | 
				
			||||||
        "@zeit/ncc": "^0.20.5",
 | 
					        "@vercel/ncc": "^0.36.1",
 | 
				
			||||||
        "eslint": "^7.32.0",
 | 
					        "eslint": "^7.32.0",
 | 
				
			||||||
        "eslint-plugin-github": "^4.3.2",
 | 
					        "eslint-plugin-github": "^4.3.2",
 | 
				
			||||||
        "eslint-plugin-jest": "^25.7.0",
 | 
					        "eslint-plugin-jest": "^25.7.0",
 | 
				
			||||||
@ -91,9 +91,9 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/@actions/io": {
 | 
					    "node_modules/@actions/io": {
 | 
				
			||||||
      "version": "1.1.2",
 | 
					      "version": "1.1.3",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.2.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.3.tgz",
 | 
				
			||||||
      "integrity": "sha512-d+RwPlMp+2qmBfeLYPLXuSRykDIFEwdTA0MMxzS9kh4kvP1ftrc/9fzy6pX6qAjthdXruHQ6/6kjT/DNo5ALuw=="
 | 
					      "integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q=="
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/@actions/tool-cache": {
 | 
					    "node_modules/@actions/tool-cache": {
 | 
				
			||||||
      "version": "1.1.2",
 | 
					      "version": "1.1.2",
 | 
				
			||||||
@ -4891,11 +4891,10 @@
 | 
				
			|||||||
        "node": ">=10"
 | 
					        "node": ">=10"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/@zeit/ncc": {
 | 
					    "node_modules/@vercel/ncc": {
 | 
				
			||||||
      "version": "0.20.5",
 | 
					      "version": "0.36.1",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@zeit/ncc/-/ncc-0.20.5.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.36.1.tgz",
 | 
				
			||||||
      "integrity": "sha512-XU6uzwvv95DqxciQx+aOLhbyBx/13ky+RK1y88Age9Du3BlA4mMPCy13BGjayOrrumOzlq1XV3SD/BWiZENXlw==",
 | 
					      "integrity": "sha512-S4cL7Taa9yb5qbv+6wLgiKVZ03Qfkc4jGRuiUQMQ8HGBD5pcNRnHeYM33zBvJE4/zJGjJJ8GScB+WmTsn9mORw==",
 | 
				
			||||||
      "deprecated": "@zeit/ncc is no longer maintained. Please use @vercel/ncc instead.",
 | 
					 | 
				
			||||||
      "dev": true,
 | 
					      "dev": true,
 | 
				
			||||||
      "bin": {
 | 
					      "bin": {
 | 
				
			||||||
        "ncc": "dist/ncc/cli.js"
 | 
					        "ncc": "dist/ncc/cli.js"
 | 
				
			||||||
@ -16394,9 +16393,9 @@
 | 
				
			|||||||
      "dev": true
 | 
					      "dev": true
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/json5": {
 | 
					    "node_modules/json5": {
 | 
				
			||||||
      "version": "2.2.1",
 | 
					      "version": "2.2.3",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
 | 
				
			||||||
      "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==",
 | 
					      "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
 | 
				
			||||||
      "dev": true,
 | 
					      "dev": true,
 | 
				
			||||||
      "bin": {
 | 
					      "bin": {
 | 
				
			||||||
        "json5": "lib/cli.js"
 | 
					        "json5": "lib/cli.js"
 | 
				
			||||||
@ -17110,9 +17109,9 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/qs": {
 | 
					    "node_modules/qs": {
 | 
				
			||||||
      "version": "6.10.1",
 | 
					      "version": "6.11.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.1.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
 | 
				
			||||||
      "integrity": "sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==",
 | 
					      "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
 | 
				
			||||||
      "dependencies": {
 | 
					      "dependencies": {
 | 
				
			||||||
        "side-channel": "^1.0.4"
 | 
					        "side-channel": "^1.0.4"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
@ -17843,9 +17842,9 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/tsconfig-paths/node_modules/json5": {
 | 
					    "node_modules/tsconfig-paths/node_modules/json5": {
 | 
				
			||||||
      "version": "1.0.1",
 | 
					      "version": "1.0.2",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz",
 | 
				
			||||||
      "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==",
 | 
					      "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==",
 | 
				
			||||||
      "dev": true,
 | 
					      "dev": true,
 | 
				
			||||||
      "dependencies": {
 | 
					      "dependencies": {
 | 
				
			||||||
        "minimist": "^1.2.0"
 | 
					        "minimist": "^1.2.0"
 | 
				
			||||||
@ -18476,9 +18475,9 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "@actions/io": {
 | 
					    "@actions/io": {
 | 
				
			||||||
      "version": "1.1.2",
 | 
					      "version": "1.1.3",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.2.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.3.tgz",
 | 
				
			||||||
      "integrity": "sha512-d+RwPlMp+2qmBfeLYPLXuSRykDIFEwdTA0MMxzS9kh4kvP1ftrc/9fzy6pX6qAjthdXruHQ6/6kjT/DNo5ALuw=="
 | 
					      "integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q=="
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "@actions/tool-cache": {
 | 
					    "@actions/tool-cache": {
 | 
				
			||||||
      "version": "1.1.2",
 | 
					      "version": "1.1.2",
 | 
				
			||||||
@ -22185,10 +22184,10 @@
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "@zeit/ncc": {
 | 
					    "@vercel/ncc": {
 | 
				
			||||||
      "version": "0.20.5",
 | 
					      "version": "0.36.1",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@zeit/ncc/-/ncc-0.20.5.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.36.1.tgz",
 | 
				
			||||||
      "integrity": "sha512-XU6uzwvv95DqxciQx+aOLhbyBx/13ky+RK1y88Age9Du3BlA4mMPCy13BGjayOrrumOzlq1XV3SD/BWiZENXlw==",
 | 
					      "integrity": "sha512-S4cL7Taa9yb5qbv+6wLgiKVZ03Qfkc4jGRuiUQMQ8HGBD5pcNRnHeYM33zBvJE4/zJGjJJ8GScB+WmTsn9mORw==",
 | 
				
			||||||
      "dev": true
 | 
					      "dev": true
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "abab": {
 | 
					    "abab": {
 | 
				
			||||||
@ -30995,9 +30994,9 @@
 | 
				
			|||||||
      "dev": true
 | 
					      "dev": true
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "json5": {
 | 
					    "json5": {
 | 
				
			||||||
      "version": "2.2.1",
 | 
					      "version": "2.2.3",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
 | 
				
			||||||
      "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==",
 | 
					      "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
 | 
				
			||||||
      "dev": true
 | 
					      "dev": true
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "kleur": {
 | 
					    "kleur": {
 | 
				
			||||||
@ -31553,9 +31552,9 @@
 | 
				
			|||||||
      "dev": true
 | 
					      "dev": true
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "qs": {
 | 
					    "qs": {
 | 
				
			||||||
      "version": "6.10.1",
 | 
					      "version": "6.11.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.1.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
 | 
				
			||||||
      "integrity": "sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==",
 | 
					      "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
 | 
				
			||||||
      "requires": {
 | 
					      "requires": {
 | 
				
			||||||
        "side-channel": "^1.0.4"
 | 
					        "side-channel": "^1.0.4"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
@ -32078,9 +32077,9 @@
 | 
				
			|||||||
      },
 | 
					      },
 | 
				
			||||||
      "dependencies": {
 | 
					      "dependencies": {
 | 
				
			||||||
        "json5": {
 | 
					        "json5": {
 | 
				
			||||||
          "version": "1.0.1",
 | 
					          "version": "1.0.2",
 | 
				
			||||||
          "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
 | 
					          "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz",
 | 
				
			||||||
          "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==",
 | 
					          "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==",
 | 
				
			||||||
          "dev": true,
 | 
					          "dev": true,
 | 
				
			||||||
          "requires": {
 | 
					          "requires": {
 | 
				
			||||||
            "minimist": "^1.2.0"
 | 
					            "minimist": "^1.2.0"
 | 
				
			||||||
 | 
				
			|||||||
@ -31,7 +31,7 @@
 | 
				
			|||||||
    "@actions/core": "^1.10.0",
 | 
					    "@actions/core": "^1.10.0",
 | 
				
			||||||
    "@actions/exec": "^1.0.1",
 | 
					    "@actions/exec": "^1.0.1",
 | 
				
			||||||
    "@actions/github": "^2.2.0",
 | 
					    "@actions/github": "^2.2.0",
 | 
				
			||||||
    "@actions/io": "^1.1.2",
 | 
					    "@actions/io": "^1.1.3",
 | 
				
			||||||
    "@actions/tool-cache": "^1.1.2",
 | 
					    "@actions/tool-cache": "^1.1.2",
 | 
				
			||||||
    "uuid": "^3.3.3"
 | 
					    "uuid": "^3.3.3"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
@ -41,7 +41,7 @@
 | 
				
			|||||||
    "@types/uuid": "^3.4.6",
 | 
					    "@types/uuid": "^3.4.6",
 | 
				
			||||||
    "@typescript-eslint/eslint-plugin": "^5.45.0",
 | 
					    "@typescript-eslint/eslint-plugin": "^5.45.0",
 | 
				
			||||||
    "@typescript-eslint/parser": "^5.45.0",
 | 
					    "@typescript-eslint/parser": "^5.45.0",
 | 
				
			||||||
    "@zeit/ncc": "^0.20.5",
 | 
					    "@vercel/ncc": "^0.36.1",
 | 
				
			||||||
    "eslint": "^7.32.0",
 | 
					    "eslint": "^7.32.0",
 | 
				
			||||||
    "eslint-plugin-github": "^4.3.2",
 | 
					    "eslint-plugin-github": "^4.3.2",
 | 
				
			||||||
    "eslint-plugin-jest": "^25.7.0",
 | 
					    "eslint-plugin-jest": "^25.7.0",
 | 
				
			||||||
 | 
				
			|||||||
@ -94,8 +94,11 @@ class GitCommandManager {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // Note, this implementation uses "rev-parse --symbolic-full-name" because the output from
 | 
					    // Note, this implementation uses "rev-parse --symbolic-full-name" because the output from
 | 
				
			||||||
    // "branch --list" is more difficult when in a detached HEAD state.
 | 
					    // "branch --list" is more difficult when in a detached HEAD state.
 | 
				
			||||||
    // Note, 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.
 | 
					    // 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']
 | 
					    const args = ['rev-parse', '--symbolic-full-name']
 | 
				
			||||||
    if (remote) {
 | 
					    if (remote) {
 | 
				
			||||||
@ -104,20 +107,48 @@ class GitCommandManager {
 | 
				
			|||||||
      args.push('--branches')
 | 
					      args.push('--branches')
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const output = await this.execGit(args)
 | 
					    const stderr: string[] = []
 | 
				
			||||||
 | 
					    const errline: string[] = []
 | 
				
			||||||
 | 
					    const stdout: string[] = []
 | 
				
			||||||
 | 
					    const stdline: string[] = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (let branch of output.stdout.trim().split('\n')) {
 | 
					    const listeners = {
 | 
				
			||||||
 | 
					      stderr: (data: Buffer) => {
 | 
				
			||||||
 | 
					        stderr.push(data.toString())
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      errline: (data: Buffer) => {
 | 
				
			||||||
 | 
					        errline.push(data.toString())
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      stdout: (data: Buffer) => {
 | 
				
			||||||
 | 
					        stdout.push(data.toString())
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      stdline: (data: Buffer) => {
 | 
				
			||||||
 | 
					        stdline.push(data.toString())
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Suppress the output in order to avoid flooding annotations with innocuous errors.
 | 
				
			||||||
 | 
					    await this.execGit(args, false, true, listeners)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    core.debug(`stderr callback is: ${stderr}`)
 | 
				
			||||||
 | 
					    core.debug(`errline callback is: ${errline}`)
 | 
				
			||||||
 | 
					    core.debug(`stdout callback is: ${stdout}`)
 | 
				
			||||||
 | 
					    core.debug(`stdline callback is: ${stdline}`)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (let branch of stdline) {
 | 
				
			||||||
      branch = branch.trim()
 | 
					      branch = branch.trim()
 | 
				
			||||||
      if (branch) {
 | 
					      if (!branch) {
 | 
				
			||||||
 | 
					        continue
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (branch.startsWith('refs/heads/')) {
 | 
					      if (branch.startsWith('refs/heads/')) {
 | 
				
			||||||
          branch = branch.substr('refs/heads/'.length)
 | 
					        branch = branch.substring('refs/heads/'.length)
 | 
				
			||||||
      } else if (branch.startsWith('refs/remotes/')) {
 | 
					      } else if (branch.startsWith('refs/remotes/')) {
 | 
				
			||||||
          branch = branch.substr('refs/remotes/'.length)
 | 
					        branch = branch.substring('refs/remotes/'.length)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      result.push(branch)
 | 
					      result.push(branch)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return result
 | 
					    return result
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@ -395,7 +426,8 @@ class GitCommandManager {
 | 
				
			|||||||
  private async execGit(
 | 
					  private async execGit(
 | 
				
			||||||
    args: string[],
 | 
					    args: string[],
 | 
				
			||||||
    allowAllExitCodes = false,
 | 
					    allowAllExitCodes = false,
 | 
				
			||||||
    silent = false
 | 
					    silent = false,
 | 
				
			||||||
 | 
					    customListeners = {}
 | 
				
			||||||
  ): Promise<GitOutput> {
 | 
					  ): Promise<GitOutput> {
 | 
				
			||||||
    fshelper.directoryExistsSync(this.workingDirectory, true)
 | 
					    fshelper.directoryExistsSync(this.workingDirectory, true)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -409,22 +441,29 @@ class GitCommandManager {
 | 
				
			|||||||
      env[key] = this.gitEnv[key]
 | 
					      env[key] = this.gitEnv[key]
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const stdout: string[] = []
 | 
					    const defaultListener = {
 | 
				
			||||||
 | 
					      stdout: (data: Buffer) => {
 | 
				
			||||||
 | 
					        stdout.push(data.toString())
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const mergedListeners = {...defaultListener, ...customListeners}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const stdout: string[] = []
 | 
				
			||||||
    const options = {
 | 
					    const options = {
 | 
				
			||||||
      cwd: this.workingDirectory,
 | 
					      cwd: this.workingDirectory,
 | 
				
			||||||
      env,
 | 
					      env,
 | 
				
			||||||
      silent,
 | 
					      silent,
 | 
				
			||||||
      ignoreReturnCode: allowAllExitCodes,
 | 
					      ignoreReturnCode: allowAllExitCodes,
 | 
				
			||||||
      listeners: {
 | 
					      listeners: mergedListeners
 | 
				
			||||||
        stdout: (data: Buffer) => {
 | 
					 | 
				
			||||||
          stdout.push(data.toString())
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    result.exitCode = await exec.exec(`"${this.gitPath}"`, args, options)
 | 
					    result.exitCode = await exec.exec(`"${this.gitPath}"`, args, options)
 | 
				
			||||||
    result.stdout = stdout.join('')
 | 
					    result.stdout = stdout.join('')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    core.debug(result.exitCode.toString())
 | 
				
			||||||
 | 
					    core.debug(result.stdout)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return result
 | 
					    return result
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -47,7 +47,7 @@ export function setSshKnownHostsPath(sshKnownHostsPath: string) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Save the sef-safe-directory input so the POST action can retrieve the value.
 | 
					 * Save the set-safe-directory input so the POST action can retrieve the value.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export function setSafeDirectory() {
 | 
					export function setSafeDirectory() {
 | 
				
			||||||
  core.saveState('setSafeDirectory', 'true')
 | 
					  core.saveState('setSafeDirectory', 'true')
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user