Compare commits
9 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ac59398561 | ||
![]() |
3ba5ee6fac | ||
![]() |
8856415920 | ||
![]() |
755da8c3cf | ||
![]() |
26d48e8ea1 | ||
![]() |
bf085276ce | ||
![]() |
5c3ccc22eb | ||
![]() |
1f9a0c22da | ||
![]() |
8230315d06 |
13 changed files with 19373 additions and 3782 deletions
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
|
@ -142,7 +142,7 @@ jobs:
|
||||||
options: --dns 127.0.0.1
|
options: --dns 127.0.0.1
|
||||||
services:
|
services:
|
||||||
squid-proxy:
|
squid-proxy:
|
||||||
image: datadog/squid:latest
|
image: ubuntu/squid:latest
|
||||||
ports:
|
ports:
|
||||||
- 3128:3128
|
- 3128:3128
|
||||||
env:
|
env:
|
||||||
|
|
30
.github/workflows/update-main-version.yml
vendored
Normal file
30
.github/workflows/update-main-version.yml
vendored
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
name: Update Main Version
|
||||||
|
run-name: Move ${{ github.event.inputs.main_version }} to ${{ github.event.inputs.target }}
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
target:
|
||||||
|
description: The tag or reference to use
|
||||||
|
required: true
|
||||||
|
main_version:
|
||||||
|
type: choice
|
||||||
|
description: The main version to update
|
||||||
|
options:
|
||||||
|
- v3
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
tag:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Git config
|
||||||
|
run: |
|
||||||
|
git config user.name github-actions
|
||||||
|
git config user.email github-actions@github.com
|
||||||
|
- name: Tag new target
|
||||||
|
run: git tag -f ${{ github.event.inputs.main_version }} ${{ github.event.inputs.target }}
|
||||||
|
- name: Push new tag
|
||||||
|
run: git push origin ${{ github.event.inputs.main_version }} --force
|
6
.licenses/npm/@actions/io.dep.yml
generated
6
.licenses/npm/@actions/io.dep.yml
generated
|
@ -1,13 +1,15 @@
|
||||||
---
|
---
|
||||||
name: "@actions/io"
|
name: "@actions/io"
|
||||||
version: 1.0.1
|
version: 1.1.2
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions io lib
|
summary: Actions io lib
|
||||||
homepage: https://github.com/actions/toolkit/tree/master/packages/io
|
homepage: https://github.com/actions/toolkit/tree/main/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.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
|
||||||
|
|
28
CONTRIBUTING.md
Normal file
28
CONTRIBUTING.md
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
# Contributing
|
||||||
|
|
||||||
|
## Submitting a pull request
|
||||||
|
|
||||||
|
1. Fork and clone the repository
|
||||||
|
1. Configure and install the dependencies: `npm install`
|
||||||
|
1. Create a new branch: `git checkout -b my-branch-name`
|
||||||
|
1. Make your change, add tests, and make sure the tests still pass: `npm run test`
|
||||||
|
1. Make sure your code is correctly formatted: `npm run format`
|
||||||
|
1. Update `dist/index.js` using `npm run build`. This creates a single javascript file that is used as an entrypoint for the action
|
||||||
|
1. Push to your fork and submit a pull request
|
||||||
|
1. Pat yourself on the back and wait for your pull request to be reviewed and merged
|
||||||
|
|
||||||
|
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
|
||||||
|
|
||||||
|
- Write tests.
|
||||||
|
- Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
|
||||||
|
|
||||||
|
## Resources
|
||||||
|
|
||||||
|
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
|
||||||
|
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/)
|
||||||
|
- [GitHub Help](https://help.github.com)
|
||||||
|
- [Writing good commit messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
|
||||||
|
|
||||||
|
Thanks! :heart: :heart: :heart:
|
||||||
|
|
||||||
|
GitHub Actions Team :octocat:
|
|
@ -1,6 +1,4 @@
|
||||||
<p align="center">
|
[](https://github.com/actions/checkout/actions/workflows/test.yml)
|
||||||
<a href="https://github.com/actions/checkout"><img alt="GitHub Actions status" src="https://github.com/actions/checkout/workflows/test-local/badge.svg"></a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
# Checkout V3
|
# Checkout V3
|
||||||
|
|
||||||
|
@ -157,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)
|
||||||
|
|
||||||
|
@ -170,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())
|
||||||
|
})
|
||||||
|
})
|
302
dist/index.js
vendored
302
dist/index.js
vendored
|
@ -98,6 +98,25 @@ module.exports = Octokit;
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
@ -108,11 +127,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const childProcess = __webpack_require__(129);
|
exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0;
|
||||||
const path = __webpack_require__(622);
|
const assert_1 = __webpack_require__(357);
|
||||||
|
const childProcess = __importStar(__webpack_require__(129));
|
||||||
|
const path = __importStar(__webpack_require__(622));
|
||||||
const util_1 = __webpack_require__(669);
|
const util_1 = __webpack_require__(669);
|
||||||
const ioUtil = __webpack_require__(672);
|
const ioUtil = __importStar(__webpack_require__(672));
|
||||||
const exec = util_1.promisify(childProcess.exec);
|
const exec = util_1.promisify(childProcess.exec);
|
||||||
|
const execFile = util_1.promisify(childProcess.execFile);
|
||||||
/**
|
/**
|
||||||
* Copies a file or folder.
|
* Copies a file or folder.
|
||||||
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
||||||
|
@ -123,14 +145,14 @@ const exec = util_1.promisify(childProcess.exec);
|
||||||
*/
|
*/
|
||||||
function cp(source, dest, options = {}) {
|
function cp(source, dest, options = {}) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const { force, recursive } = readCopyOptions(options);
|
const { force, recursive, copySourceDirectory } = readCopyOptions(options);
|
||||||
const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null;
|
const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null;
|
||||||
// Dest is an existing file, but not forcing
|
// Dest is an existing file, but not forcing
|
||||||
if (destStat && destStat.isFile() && !force) {
|
if (destStat && destStat.isFile() && !force) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// If dest is an existing directory, should copy inside.
|
// If dest is an existing directory, should copy inside.
|
||||||
const newDest = destStat && destStat.isDirectory()
|
const newDest = destStat && destStat.isDirectory() && copySourceDirectory
|
||||||
? path.join(dest, path.basename(source))
|
? path.join(dest, path.basename(source))
|
||||||
: dest;
|
: dest;
|
||||||
if (!(yield ioUtil.exists(source))) {
|
if (!(yield ioUtil.exists(source))) {
|
||||||
|
@ -195,12 +217,22 @@ function rmRF(inputPath) {
|
||||||
if (ioUtil.IS_WINDOWS) {
|
if (ioUtil.IS_WINDOWS) {
|
||||||
// Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
|
// Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
|
||||||
// program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
|
// program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
|
||||||
|
// Check for invalid characters
|
||||||
|
// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
|
||||||
|
if (/[*"<>|]/.test(inputPath)) {
|
||||||
|
throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows');
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
|
const cmdPath = ioUtil.getCmdPath();
|
||||||
if (yield ioUtil.isDirectory(inputPath, true)) {
|
if (yield ioUtil.isDirectory(inputPath, true)) {
|
||||||
yield exec(`rd /s /q "${inputPath}"`);
|
yield exec(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, {
|
||||||
|
env: { inputPath }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
yield exec(`del /f /a "${inputPath}"`);
|
yield exec(`${cmdPath} /s /c "del /f /a "%inputPath%""`, {
|
||||||
|
env: { inputPath }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
@ -233,7 +265,7 @@ function rmRF(inputPath) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isDir) {
|
if (isDir) {
|
||||||
yield exec(`rm -rf "${inputPath}"`);
|
yield execFile(`rm`, [`-rf`, `${inputPath}`]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
yield ioUtil.unlink(inputPath);
|
yield ioUtil.unlink(inputPath);
|
||||||
|
@ -251,7 +283,8 @@ exports.rmRF = rmRF;
|
||||||
*/
|
*/
|
||||||
function mkdirP(fsPath) {
|
function mkdirP(fsPath) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
yield ioUtil.mkdirP(fsPath);
|
assert_1.ok(fsPath, 'a path argument must be provided');
|
||||||
|
yield ioUtil.mkdir(fsPath, { recursive: true });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.mkdirP = mkdirP;
|
exports.mkdirP = mkdirP;
|
||||||
|
@ -279,12 +312,30 @@ function which(tool, check) {
|
||||||
throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`);
|
throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
const matches = yield findInPath(tool);
|
||||||
|
if (matches && matches.length > 0) {
|
||||||
|
return matches[0];
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.which = which;
|
||||||
|
/**
|
||||||
|
* Returns a list of all occurrences of the given tool on the system path.
|
||||||
|
*
|
||||||
|
* @returns Promise<string[]> the paths of the tool
|
||||||
|
*/
|
||||||
|
function findInPath(tool) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (!tool) {
|
||||||
|
throw new Error("parameter 'tool' is required");
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
// build the list of extensions to try
|
// build the list of extensions to try
|
||||||
const extensions = [];
|
const extensions = [];
|
||||||
if (ioUtil.IS_WINDOWS && process.env.PATHEXT) {
|
if (ioUtil.IS_WINDOWS && process.env['PATHEXT']) {
|
||||||
for (const extension of process.env.PATHEXT.split(path.delimiter)) {
|
for (const extension of process.env['PATHEXT'].split(path.delimiter)) {
|
||||||
if (extension) {
|
if (extension) {
|
||||||
extensions.push(extension);
|
extensions.push(extension);
|
||||||
}
|
}
|
||||||
|
@ -294,13 +345,13 @@ function which(tool, check) {
|
||||||
if (ioUtil.isRooted(tool)) {
|
if (ioUtil.isRooted(tool)) {
|
||||||
const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions);
|
const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions);
|
||||||
if (filePath) {
|
if (filePath) {
|
||||||
return filePath;
|
return [filePath];
|
||||||
}
|
}
|
||||||
return '';
|
return [];
|
||||||
}
|
}
|
||||||
// if any path separators, return empty
|
// if any path separators, return empty
|
||||||
if (tool.includes('/') || (ioUtil.IS_WINDOWS && tool.includes('\\'))) {
|
if (tool.includes(path.sep)) {
|
||||||
return '';
|
return [];
|
||||||
}
|
}
|
||||||
// build the list of directories
|
// build the list of directories
|
||||||
//
|
//
|
||||||
|
@ -316,25 +367,25 @@ function which(tool, check) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// return the first match
|
// find all matches
|
||||||
|
const matches = [];
|
||||||
for (const directory of directories) {
|
for (const directory of directories) {
|
||||||
const filePath = yield ioUtil.tryGetExecutablePath(directory + path.sep + tool, extensions);
|
const filePath = yield ioUtil.tryGetExecutablePath(path.join(directory, tool), extensions);
|
||||||
if (filePath) {
|
if (filePath) {
|
||||||
return filePath;
|
matches.push(filePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return '';
|
return matches;
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
throw new Error(`which failed with message ${err.message}`);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.which = which;
|
exports.findInPath = findInPath;
|
||||||
function readCopyOptions(options) {
|
function readCopyOptions(options) {
|
||||||
const force = options.force == null ? true : options.force;
|
const force = options.force == null ? true : options.force;
|
||||||
const recursive = Boolean(options.recursive);
|
const recursive = Boolean(options.recursive);
|
||||||
return { force, recursive };
|
const copySourceDirectory = options.copySourceDirectory == null
|
||||||
|
? true
|
||||||
|
: Boolean(options.copySourceDirectory);
|
||||||
|
return { force, recursive, copySourceDirectory };
|
||||||
}
|
}
|
||||||
function cpDirRecursive(sourceDir, destDir, currentDepth, force) {
|
function cpDirRecursive(sourceDir, destDir, currentDepth, force) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
@ -4032,7 +4083,7 @@ function setSshKnownHostsPath(sshKnownHostsPath) {
|
||||||
}
|
}
|
||||||
exports.setSshKnownHostsPath = setSshKnownHostsPath;
|
exports.setSshKnownHostsPath = setSshKnownHostsPath;
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
function setSafeDirectory() {
|
function setSafeDirectory() {
|
||||||
core.saveState('setSafeDirectory', 'true');
|
core.saveState('setSafeDirectory', 'true');
|
||||||
|
@ -7121,7 +7172,9 @@ class GitAuthHelper {
|
||||||
// Configure a placeholder value. This approach avoids the credential being captured
|
// Configure a placeholder value. This approach avoids the credential being captured
|
||||||
// by process creation audit events, which are commonly logged. For more information,
|
// by process creation audit events, which are commonly logged. For more information,
|
||||||
// refer to https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/manage/component-updates/command-line-process-auditing
|
// refer to https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/manage/component-updates/command-line-process-auditing
|
||||||
const output = yield this.git.submoduleForeach(`git config --local '${this.tokenConfigKey}' '${this.tokenPlaceholderConfigValue}' && git config --local --show-origin --name-only --get-regexp remote.origin.url`, this.settings.nestedSubmodules);
|
const output = yield this.git.submoduleForeach(
|
||||||
|
// wrap the pipeline in quotes to make sure it's handled properly by submoduleForeach, rather than just the first part of the pipeline
|
||||||
|
`sh -c "git config --local '${this.tokenConfigKey}' '${this.tokenPlaceholderConfigValue}' && git config --local --show-origin --name-only --get-regexp remote.origin.url"`, this.settings.nestedSubmodules);
|
||||||
// Replace the placeholder
|
// Replace the placeholder
|
||||||
const configPaths = output.match(/(?<=(^|\n)file:)[^\t]+(?=\tremote\.origin\.url)/g) || [];
|
const configPaths = output.match(/(?<=(^|\n)file:)[^\t]+(?=\tremote\.origin\.url)/g) || [];
|
||||||
for (const configPath of configPaths) {
|
for (const configPath of configPaths) {
|
||||||
|
@ -7288,7 +7341,9 @@ class GitAuthHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const pattern = regexpHelper.escape(configKey);
|
const pattern = regexpHelper.escape(configKey);
|
||||||
yield this.git.submoduleForeach(`git config --local --name-only --get-regexp '${pattern}' && git config --local --unset-all '${configKey}' || :`, true);
|
yield this.git.submoduleForeach(
|
||||||
|
// wrap the pipeline in quotes to make sure it's handled properly by submoduleForeach, rather than just the first part of the pipeline
|
||||||
|
`sh -c "git config --local --name-only --get-regexp '${pattern}' && git config --local --unset-all '${configKey}' || :"`, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7386,8 +7441,10 @@ class GitCommandManager {
|
||||||
const result = [];
|
const result = [];
|
||||||
// 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) {
|
||||||
args.push('--remotes=origin');
|
args.push('--remotes=origin');
|
||||||
|
@ -7395,19 +7452,43 @@ class GitCommandManager {
|
||||||
else {
|
else {
|
||||||
args.push('--branches');
|
args.push('--branches');
|
||||||
}
|
}
|
||||||
const output = yield this.execGit(args);
|
const stderr = [];
|
||||||
for (let branch of output.stdout.trim().split('\n')) {
|
const errline = [];
|
||||||
|
const stdout = [];
|
||||||
|
const stdline = [];
|
||||||
|
const listeners = {
|
||||||
|
stderr: (data) => {
|
||||||
|
stderr.push(data.toString());
|
||||||
|
},
|
||||||
|
errline: (data) => {
|
||||||
|
errline.push(data.toString());
|
||||||
|
},
|
||||||
|
stdout: (data) => {
|
||||||
|
stdout.push(data.toString());
|
||||||
|
},
|
||||||
|
stdline: (data) => {
|
||||||
|
stdline.push(data.toString());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// Suppress the output in order to avoid flooding annotations with innocuous errors.
|
||||||
|
yield 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;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -7657,7 +7738,7 @@ class GitCommandManager {
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
execGit(args, allowAllExitCodes = false, silent = false) {
|
execGit(args, allowAllExitCodes = false, silent = false, customListeners = {}) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
fshelper.directoryExistsSync(this.workingDirectory, true);
|
fshelper.directoryExistsSync(this.workingDirectory, true);
|
||||||
const result = new GitOutput();
|
const result = new GitOutput();
|
||||||
|
@ -7668,20 +7749,24 @@ 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 = {
|
||||||
|
stdout: (data) => {
|
||||||
|
stdout.push(data.toString());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const mergedListeners = Object.assign(Object.assign({}, defaultListener), customListeners);
|
||||||
const stdout = [];
|
const stdout = [];
|
||||||
const options = {
|
const options = {
|
||||||
cwd: this.workingDirectory,
|
cwd: this.workingDirectory,
|
||||||
env,
|
env,
|
||||||
silent,
|
silent,
|
||||||
ignoreReturnCode: allowAllExitCodes,
|
ignoreReturnCode: allowAllExitCodes,
|
||||||
listeners: {
|
listeners: mergedListeners
|
||||||
stdout: (data) => {
|
|
||||||
stdout.push(data.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
result.exitCode = yield exec.exec(`"${this.gitPath}"`, args, options);
|
result.exitCode = yield 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;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -13892,6 +13977,7 @@ var encode = function encode(str, defaultEncoder, charset, kind, format) {
|
||||||
|
|
||||||
i += 1;
|
i += 1;
|
||||||
c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
|
c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
|
||||||
|
/* eslint operator-linebreak: [2, "before"] */
|
||||||
out += hexTable[0xF0 | (c >> 18)]
|
out += hexTable[0xF0 | (c >> 18)]
|
||||||
+ hexTable[0x80 | ((c >> 12) & 0x3F)]
|
+ hexTable[0x80 | ((c >> 12) & 0x3F)]
|
||||||
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
|
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
|
||||||
|
@ -16393,6 +16479,25 @@ module.exports = require("util");
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
@ -16404,9 +16509,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||||
};
|
};
|
||||||
var _a;
|
var _a;
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const assert_1 = __webpack_require__(357);
|
exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rename = exports.readlink = exports.readdir = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0;
|
||||||
const fs = __webpack_require__(747);
|
const fs = __importStar(__webpack_require__(747));
|
||||||
const path = __webpack_require__(622);
|
const path = __importStar(__webpack_require__(622));
|
||||||
_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
|
_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
|
||||||
exports.IS_WINDOWS = process.platform === 'win32';
|
exports.IS_WINDOWS = process.platform === 'win32';
|
||||||
function exists(fsPath) {
|
function exists(fsPath) {
|
||||||
|
@ -16447,49 +16552,6 @@ function isRooted(p) {
|
||||||
return p.startsWith('/');
|
return p.startsWith('/');
|
||||||
}
|
}
|
||||||
exports.isRooted = isRooted;
|
exports.isRooted = isRooted;
|
||||||
/**
|
|
||||||
* Recursively create a directory at `fsPath`.
|
|
||||||
*
|
|
||||||
* This implementation is optimistic, meaning it attempts to create the full
|
|
||||||
* path first, and backs up the path stack from there.
|
|
||||||
*
|
|
||||||
* @param fsPath The path to create
|
|
||||||
* @param maxDepth The maximum recursion depth
|
|
||||||
* @param depth The current recursion depth
|
|
||||||
*/
|
|
||||||
function mkdirP(fsPath, maxDepth = 1000, depth = 1) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
assert_1.ok(fsPath, 'a path argument must be provided');
|
|
||||||
fsPath = path.resolve(fsPath);
|
|
||||||
if (depth >= maxDepth)
|
|
||||||
return exports.mkdir(fsPath);
|
|
||||||
try {
|
|
||||||
yield exports.mkdir(fsPath);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
switch (err.code) {
|
|
||||||
case 'ENOENT': {
|
|
||||||
yield mkdirP(path.dirname(fsPath), maxDepth, depth + 1);
|
|
||||||
yield exports.mkdir(fsPath);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
let stats;
|
|
||||||
try {
|
|
||||||
stats = yield exports.stat(fsPath);
|
|
||||||
}
|
|
||||||
catch (err2) {
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
if (!stats.isDirectory())
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.mkdirP = mkdirP;
|
|
||||||
/**
|
/**
|
||||||
* Best effort attempt to determine whether a file exists and is executable.
|
* Best effort attempt to determine whether a file exists and is executable.
|
||||||
* @param filePath file path to check
|
* @param filePath file path to check
|
||||||
|
@ -16586,6 +16648,12 @@ function isUnixExecutable(stats) {
|
||||||
((stats.mode & 8) > 0 && stats.gid === process.getgid()) ||
|
((stats.mode & 8) > 0 && stats.gid === process.getgid()) ||
|
||||||
((stats.mode & 64) > 0 && stats.uid === process.getuid()));
|
((stats.mode & 64) > 0 && stats.uid === process.getuid()));
|
||||||
}
|
}
|
||||||
|
// Get the path of cmd.exe in windows
|
||||||
|
function getCmdPath() {
|
||||||
|
var _a;
|
||||||
|
return (_a = process.env['COMSPEC']) !== null && _a !== void 0 ? _a : `cmd.exe`;
|
||||||
|
}
|
||||||
|
exports.getCmdPath = getCmdPath;
|
||||||
//# sourceMappingURL=io-util.js.map
|
//# sourceMappingURL=io-util.js.map
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
@ -17535,7 +17603,7 @@ var parseObject = function (chain, val, options, valuesParsed) {
|
||||||
) {
|
) {
|
||||||
obj = [];
|
obj = [];
|
||||||
obj[index] = leaf;
|
obj[index] = leaf;
|
||||||
} else {
|
} else if (cleanRoot !== '__proto__') {
|
||||||
obj[cleanRoot] = leaf;
|
obj[cleanRoot] = leaf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34667,6 +34735,7 @@ var arrayPrefixGenerators = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var isArray = Array.isArray;
|
var isArray = Array.isArray;
|
||||||
|
var split = String.prototype.split;
|
||||||
var push = Array.prototype.push;
|
var push = Array.prototype.push;
|
||||||
var pushToArray = function (arr, valueOrArray) {
|
var pushToArray = function (arr, valueOrArray) {
|
||||||
push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
|
push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
|
||||||
|
@ -34703,10 +34772,13 @@ var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
|
||||||
|| typeof v === 'bigint';
|
|| typeof v === 'bigint';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var sentinel = {};
|
||||||
|
|
||||||
var stringify = function stringify(
|
var stringify = function stringify(
|
||||||
object,
|
object,
|
||||||
prefix,
|
prefix,
|
||||||
generateArrayPrefix,
|
generateArrayPrefix,
|
||||||
|
commaRoundTrip,
|
||||||
strictNullHandling,
|
strictNullHandling,
|
||||||
skipNulls,
|
skipNulls,
|
||||||
encoder,
|
encoder,
|
||||||
|
@ -34722,8 +34794,23 @@ var stringify = function stringify(
|
||||||
) {
|
) {
|
||||||
var obj = object;
|
var obj = object;
|
||||||
|
|
||||||
if (sideChannel.has(object)) {
|
var tmpSc = sideChannel;
|
||||||
|
var step = 0;
|
||||||
|
var findFlag = false;
|
||||||
|
while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {
|
||||||
|
// Where object last appeared in the ref tree
|
||||||
|
var pos = tmpSc.get(object);
|
||||||
|
step += 1;
|
||||||
|
if (typeof pos !== 'undefined') {
|
||||||
|
if (pos === step) {
|
||||||
throw new RangeError('Cyclic object value');
|
throw new RangeError('Cyclic object value');
|
||||||
|
} else {
|
||||||
|
findFlag = true; // Break while
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (typeof tmpSc.get(sentinel) === 'undefined') {
|
||||||
|
step = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof filter === 'function') {
|
if (typeof filter === 'function') {
|
||||||
|
@ -34750,6 +34837,14 @@ var stringify = function stringify(
|
||||||
if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
|
if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
|
||||||
if (encoder) {
|
if (encoder) {
|
||||||
var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format);
|
var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format);
|
||||||
|
if (generateArrayPrefix === 'comma' && encodeValuesOnly) {
|
||||||
|
var valuesArray = split.call(String(obj), ',');
|
||||||
|
var valuesJoined = '';
|
||||||
|
for (var i = 0; i < valuesArray.length; ++i) {
|
||||||
|
valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults.encoder, charset, 'value', format));
|
||||||
|
}
|
||||||
|
return [formatter(keyValue) + (commaRoundTrip && isArray(obj) && valuesArray.length === 1 ? '[]' : '') + '=' + valuesJoined];
|
||||||
|
}
|
||||||
return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
|
return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
|
||||||
}
|
}
|
||||||
return [formatter(prefix) + '=' + formatter(String(obj))];
|
return [formatter(prefix) + '=' + formatter(String(obj))];
|
||||||
|
@ -34764,7 +34859,7 @@ var stringify = function stringify(
|
||||||
var objKeys;
|
var objKeys;
|
||||||
if (generateArrayPrefix === 'comma' && isArray(obj)) {
|
if (generateArrayPrefix === 'comma' && isArray(obj)) {
|
||||||
// we need to join elements in
|
// we need to join elements in
|
||||||
objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : undefined }];
|
objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
|
||||||
} else if (isArray(filter)) {
|
} else if (isArray(filter)) {
|
||||||
objKeys = filter;
|
objKeys = filter;
|
||||||
} else {
|
} else {
|
||||||
|
@ -34772,24 +34867,28 @@ var stringify = function stringify(
|
||||||
objKeys = sort ? keys.sort(sort) : keys;
|
objKeys = sort ? keys.sort(sort) : keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < objKeys.length; ++i) {
|
var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? prefix + '[]' : prefix;
|
||||||
var key = objKeys[i];
|
|
||||||
var value = typeof key === 'object' && key.value !== undefined ? key.value : obj[key];
|
for (var j = 0; j < objKeys.length; ++j) {
|
||||||
|
var key = objKeys[j];
|
||||||
|
var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key];
|
||||||
|
|
||||||
if (skipNulls && value === null) {
|
if (skipNulls && value === null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var keyPrefix = isArray(obj)
|
var keyPrefix = isArray(obj)
|
||||||
? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(prefix, key) : prefix
|
? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, key) : adjustedPrefix
|
||||||
: prefix + (allowDots ? '.' + key : '[' + key + ']');
|
: adjustedPrefix + (allowDots ? '.' + key : '[' + key + ']');
|
||||||
|
|
||||||
sideChannel.set(object, true);
|
sideChannel.set(object, step);
|
||||||
var valueSideChannel = getSideChannel();
|
var valueSideChannel = getSideChannel();
|
||||||
|
valueSideChannel.set(sentinel, sideChannel);
|
||||||
pushToArray(values, stringify(
|
pushToArray(values, stringify(
|
||||||
value,
|
value,
|
||||||
keyPrefix,
|
keyPrefix,
|
||||||
generateArrayPrefix,
|
generateArrayPrefix,
|
||||||
|
commaRoundTrip,
|
||||||
strictNullHandling,
|
strictNullHandling,
|
||||||
skipNulls,
|
skipNulls,
|
||||||
encoder,
|
encoder,
|
||||||
|
@ -34813,7 +34912,7 @@ var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
|
||||||
return defaults;
|
return defaults;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.encoder !== null && opts.encoder !== undefined && typeof opts.encoder !== 'function') {
|
if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
|
||||||
throw new TypeError('Encoder has to be a function.');
|
throw new TypeError('Encoder has to be a function.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34886,6 +34985,10 @@ module.exports = function (object, opts) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
|
var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
|
||||||
|
if (opts && 'commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
|
||||||
|
throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
|
||||||
|
}
|
||||||
|
var commaRoundTrip = generateArrayPrefix === 'comma' && opts && opts.commaRoundTrip;
|
||||||
|
|
||||||
if (!objKeys) {
|
if (!objKeys) {
|
||||||
objKeys = Object.keys(obj);
|
objKeys = Object.keys(obj);
|
||||||
|
@ -34906,6 +35009,7 @@ module.exports = function (object, opts) {
|
||||||
obj[key],
|
obj[key],
|
||||||
key,
|
key,
|
||||||
generateArrayPrefix,
|
generateArrayPrefix,
|
||||||
|
commaRoundTrip,
|
||||||
options.strictNullHandling,
|
options.strictNullHandling,
|
||||||
options.skipNulls,
|
options.skipNulls,
|
||||||
options.encode ? options.encoder : null,
|
options.encode ? options.encoder : null,
|
||||||
|
|
22505
package-lock.json
generated
22505
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "checkout",
|
"name": "checkout",
|
||||||
"version": "3.1.0",
|
"version": "3.2.0",
|
||||||
"description": "checkout action",
|
"description": "checkout action",
|
||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -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.0.1",
|
"@actions/io": "^1.1.2",
|
||||||
"@actions/tool-cache": "^1.1.2",
|
"@actions/tool-cache": "^1.1.2",
|
||||||
"uuid": "^3.3.3"
|
"uuid": "^3.3.3"
|
||||||
},
|
},
|
||||||
|
@ -39,11 +39,12 @@
|
||||||
"@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/parser": "^5.1.0",
|
"@typescript-eslint/eslint-plugin": "^5.45.0",
|
||||||
|
"@typescript-eslint/parser": "^5.45.0",
|
||||||
"@zeit/ncc": "^0.20.5",
|
"@zeit/ncc": "^0.20.5",
|
||||||
"eslint": "^7.32.0",
|
"eslint": "^7.32.0",
|
||||||
"eslint-plugin-github": "^4.3.2",
|
"eslint-plugin-github": "^4.3.2",
|
||||||
"eslint-plugin-jest": "^25.2.2",
|
"eslint-plugin-jest": "^25.7.0",
|
||||||
"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",
|
||||||
|
|
|
@ -157,7 +157,8 @@ class GitAuthHelper {
|
||||||
// by process creation audit events, which are commonly logged. For more information,
|
// by process creation audit events, which are commonly logged. For more information,
|
||||||
// refer to https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/manage/component-updates/command-line-process-auditing
|
// refer to https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/manage/component-updates/command-line-process-auditing
|
||||||
const output = await this.git.submoduleForeach(
|
const output = await this.git.submoduleForeach(
|
||||||
`git config --local '${this.tokenConfigKey}' '${this.tokenPlaceholderConfigValue}' && git config --local --show-origin --name-only --get-regexp remote.origin.url`,
|
// wrap the pipeline in quotes to make sure it's handled properly by submoduleForeach, rather than just the first part of the pipeline
|
||||||
|
`sh -c "git config --local '${this.tokenConfigKey}' '${this.tokenPlaceholderConfigValue}' && git config --local --show-origin --name-only --get-regexp remote.origin.url"`,
|
||||||
this.settings.nestedSubmodules
|
this.settings.nestedSubmodules
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -365,7 +366,8 @@ class GitAuthHelper {
|
||||||
|
|
||||||
const pattern = regexpHelper.escape(configKey)
|
const pattern = regexpHelper.escape(configKey)
|
||||||
await this.git.submoduleForeach(
|
await this.git.submoduleForeach(
|
||||||
`git config --local --name-only --get-regexp '${pattern}' && git config --local --unset-all '${configKey}' || :`,
|
// wrap the pipeline in quotes to make sure it's handled properly by submoduleForeach, rather than just the first part of the pipeline
|
||||||
|
`sh -c "git config --local --name-only --get-regexp '${pattern}' && git config --local --unset-all '${configKey}' || :"`,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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')
|
||||||
|
|
Loading…
Add table
Reference in a new issue