Compare commits
15 Commits
v3.4.0
...
vmjoseph/s
Author | SHA1 | Date | |
---|---|---|---|
af5130cb88 | |||
8e555ec39e | |||
b99f9d0aba | |||
a9f581070e | |||
d2e9d8b595 | |||
25424e8595 | |||
bac1bcfa81 | |||
1f9aeb9f74 | |||
9679ac6b68 | |||
f1764260c3 | |||
9684017cd6 | |||
5788ebd085 | |||
ad19603e6b | |||
2c24b08d98 | |||
9634409d1e |
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@v2
|
uses: github/codeql-action/init@v1
|
||||||
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@v2
|
uses: github/codeql-action/analyze@v1
|
||||||
|
6
.licenses/npm/@actions/io.dep.yml
generated
6
.licenses/npm/@actions/io.dep.yml
generated
@ -1,15 +1,13 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/io"
|
name: "@actions/io"
|
||||||
version: 1.1.3
|
version: 1.0.1
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions io lib
|
summary: Actions io lib
|
||||||
homepage: https://github.com/actions/toolkit/tree/main/packages/io
|
homepage: https://github.com/actions/toolkit/tree/master/packages/io
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE.md
|
- sources: LICENSE.md
|
||||||
text: |-
|
text: |-
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright 2019 GitHub
|
Copyright 2019 GitHub
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
2
.licenses/npm/qs.dep.yml
generated
2
.licenses/npm/qs.dep.yml
generated
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: qs
|
name: qs
|
||||||
version: 6.11.0
|
version: 6.10.1
|
||||||
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
|
||||||
|
18
CHANGELOG.md
18
CHANGELOG.md
@ -1,23 +1,5 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## v3.4.0
|
|
||||||
- [Upgrade codeql actions to v2](https://github.com/actions/checkout/pull/1209)
|
|
||||||
- [Upgrade dependencies](https://github.com/actions/checkout/pull/1210)
|
|
||||||
- [Upgrade @actions/io](https://github.com/actions/checkout/pull/1225)
|
|
||||||
|
|
||||||
## v3.3.0
|
|
||||||
- [Implement branch list using callbacks from exec function](https://github.com/actions/checkout/pull/1045)
|
|
||||||
- [Add in explicit reference to private checkout options](https://github.com/actions/checkout/pull/1050)
|
|
||||||
- [Fix comment typos (that got added in #770)](https://github.com/actions/checkout/pull/1057)
|
|
||||||
|
|
||||||
## v3.2.0
|
|
||||||
- [Add GitHub Action to perform release](https://github.com/actions/checkout/pull/942)
|
|
||||||
- [Fix status badge](https://github.com/actions/checkout/pull/967)
|
|
||||||
- [Replace datadog/squid with ubuntu/squid Docker image](https://github.com/actions/checkout/pull/1002)
|
|
||||||
- [Wrap pipeline commands for submoduleForeach in quotes](https://github.com/actions/checkout/pull/964)
|
|
||||||
- [Update @actions/io to 1.1.2](https://github.com/actions/checkout/pull/1029)
|
|
||||||
- [Upgrading version to 3.2.0](https://github.com/actions/checkout/pull/1039)
|
|
||||||
|
|
||||||
## v3.1.0
|
## v3.1.0
|
||||||
- [Use @actions/core `saveState` and `getState`](https://github.com/actions/checkout/pull/939)
|
- [Use @actions/core `saveState` and `getState`](https://github.com/actions/checkout/pull/939)
|
||||||
- [Add `github-server-url` input](https://github.com/actions/checkout/pull/922)
|
- [Add `github-server-url` input](https://github.com/actions/checkout/pull/922)
|
||||||
|
@ -155,7 +155,6 @@ 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)
|
||||||
|
|
||||||
@ -169,7 +168,6 @@ 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)
|
||||||
|
|
||||||
|
@ -1,80 +0,0 @@
|
|||||||
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())
|
|
||||||
})
|
|
||||||
})
|
|
36441
dist/index.js
vendored
36441
dist/index.js
vendored
File diff suppressed because one or more lines are too long
22537
package-lock.json
generated
22537
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "checkout",
|
"name": "checkout",
|
||||||
"version": "3.2.0",
|
"version": "3.1.0",
|
||||||
"description": "checkout action",
|
"description": "checkout action",
|
||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -31,20 +31,20 @@
|
|||||||
"@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.3",
|
"@actions/io": "^1.0.1",
|
||||||
"@actions/tool-cache": "^1.1.2",
|
"@actions/tool-cache": "^1.1.2",
|
||||||
|
"stream": "0.0.2",
|
||||||
"uuid": "^3.3.3"
|
"uuid": "^3.3.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^27.0.2",
|
"@types/jest": "^27.0.2",
|
||||||
"@types/node": "^12.7.12",
|
"@types/node": "^12.7.12",
|
||||||
"@types/uuid": "^3.4.6",
|
"@types/uuid": "^3.4.6",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.45.0",
|
"@typescript-eslint/parser": "^5.1.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.2.2",
|
||||||
"jest": "^27.3.0",
|
"jest": "^27.3.0",
|
||||||
"jest-circus": "^27.3.0",
|
"jest-circus": "^27.3.0",
|
||||||
"js-yaml": "^3.13.1",
|
"js-yaml": "^3.13.1",
|
||||||
|
@ -7,6 +7,7 @@ import * as refHelper from './ref-helper'
|
|||||||
import * as regexpHelper from './regexp-helper'
|
import * as regexpHelper from './regexp-helper'
|
||||||
import * as retryHelper from './retry-helper'
|
import * as retryHelper from './retry-helper'
|
||||||
import {GitVersion} from './git-version'
|
import {GitVersion} from './git-version'
|
||||||
|
import stream, {Writable} from 'stream'
|
||||||
|
|
||||||
// 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
|
||||||
@ -91,14 +92,12 @@ class GitCommandManager {
|
|||||||
|
|
||||||
async branchList(remote: boolean): Promise<string[]> {
|
async branchList(remote: boolean): Promise<string[]> {
|
||||||
const result: string[] = []
|
const result: string[] = []
|
||||||
|
const stderr: string[] = []
|
||||||
|
|
||||||
// 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
|
||||||
// TODO(https://github.com/actions/checkout/issues/786): this implementation uses
|
// in Git 2.18 that causes "rev-parse --symbolic" to output symbolic full names.
|
||||||
// "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) {
|
||||||
@ -107,49 +106,29 @@ class GitCommandManager {
|
|||||||
args.push('--branches')
|
args.push('--branches')
|
||||||
}
|
}
|
||||||
|
|
||||||
const stderr: string[] = []
|
|
||||||
const errline: string[] = []
|
|
||||||
const stdout: string[] = []
|
|
||||||
const stdline: string[] = []
|
|
||||||
|
|
||||||
const listeners = {
|
const listeners = {
|
||||||
stderr: (data: Buffer) => {
|
stderr: (data: Buffer) => {
|
||||||
stderr.push(data.toString())
|
stderr.push(data.toString())
|
||||||
},
|
},
|
||||||
errline: (data: Buffer) => {
|
errline: (line: string) => {
|
||||||
errline.push(data.toString())
|
stderr.push(line)
|
||||||
},
|
|
||||||
stdout: (data: Buffer) => {
|
|
||||||
stdout.push(data.toString())
|
|
||||||
},
|
|
||||||
stdline: (data: Buffer) => {
|
|
||||||
stdline.push(data.toString())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const output = await this.execGit(args, false, false, listeners)
|
||||||
|
|
||||||
// Suppress the output in order to avoid flooding annotations with innocuous errors.
|
for (let branch of output.stdout.trim().split('\n')) {
|
||||||
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/')) {
|
||||||
}
|
branch = branch.substr('refs/heads/'.length)
|
||||||
|
} else if (branch.startsWith('refs/remotes/')) {
|
||||||
|
branch = branch.substr('refs/remotes/'.length)
|
||||||
|
}
|
||||||
|
|
||||||
if (branch.startsWith('refs/heads/')) {
|
result.push(branch)
|
||||||
branch = branch.substring('refs/heads/'.length)
|
|
||||||
} else if (branch.startsWith('refs/remotes/')) {
|
|
||||||
branch = branch.substring('refs/remotes/'.length)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result.push(branch)
|
|
||||||
}
|
}
|
||||||
|
core.info(stderr.join('\n'))
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,30 +419,45 @@ class GitCommandManager {
|
|||||||
for (const key of Object.keys(this.gitEnv)) {
|
for (const key of Object.keys(this.gitEnv)) {
|
||||||
env[key] = this.gitEnv[key]
|
env[key] = this.gitEnv[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultListener = {
|
const defaultListener = {
|
||||||
stdout: (data: Buffer) => {
|
stdout: (data: Buffer) => {
|
||||||
stdout.push(data.toString())
|
stdout.push(data.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// const listeners = Object.keys(customListeners) < 0 ? customListeners : {stdout: (data: Buffer) => {
|
||||||
const mergedListeners = {...defaultListener, ...customListeners}
|
// stdout.push(data.toString())
|
||||||
|
// }}
|
||||||
|
const listenersD = {...customListeners, ...defaultListener}
|
||||||
const stdout: string[] = []
|
const stdout: string[] = []
|
||||||
|
// let temp = ''
|
||||||
|
// let temp2 = ''
|
||||||
const options = {
|
const options = {
|
||||||
cwd: this.workingDirectory,
|
cwd: this.workingDirectory,
|
||||||
env,
|
env,
|
||||||
silent,
|
silent,
|
||||||
ignoreReturnCode: allowAllExitCodes,
|
ignoreReturnCode: allowAllExitCodes,
|
||||||
listeners: mergedListeners
|
listeners: listenersD
|
||||||
|
// ,
|
||||||
|
// errStream: new stream.Writable({
|
||||||
|
// write(chunk, _, next) {
|
||||||
|
// temp += chunk.toString()
|
||||||
|
// next()
|
||||||
|
// }
|
||||||
|
// }),
|
||||||
|
|
||||||
|
// outStream: new stream.Writable({
|
||||||
|
// write(chunk, _, next) {
|
||||||
|
// temp2 += chunk.toString()
|
||||||
|
// next()
|
||||||
|
// }
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
|
|
||||||
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.info(temp.length.toString())
|
||||||
core.debug(result.exitCode.toString())
|
// core.info(temp2.length.toString())
|
||||||
core.debug(result.stdout)
|
core.info(result.stdout)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ export function setSshKnownHostsPath(sshKnownHostsPath: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the set-safe-directory input so the POST action can retrieve the value.
|
* Save the sef-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