Fix missing async for function
This commit is contained in:
parent
4e9b4181aa
commit
af869eb4a0
56
dist/index.js
vendored
56
dist/index.js
vendored
@ -67,7 +67,7 @@ var WorkingBaseType;
|
|||||||
})(WorkingBaseType || (exports.WorkingBaseType = WorkingBaseType = {}));
|
})(WorkingBaseType || (exports.WorkingBaseType = WorkingBaseType = {}));
|
||||||
function getWorkingBaseAndType(git) {
|
function getWorkingBaseAndType(git) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const symbolicRefResult = yield git.exec(['symbolic-ref', 'HEAD', '--short'], true);
|
const symbolicRefResult = yield git.exec(['symbolic-ref', 'HEAD', '--short'], { allowAllExitCodes: true });
|
||||||
if (symbolicRefResult.exitCode == 0) {
|
if (symbolicRefResult.exitCode == 0) {
|
||||||
// A ref is checked out
|
// A ref is checked out
|
||||||
return [symbolicRefResult.stdout.trim(), WorkingBaseType.Branch];
|
return [symbolicRefResult.stdout.trim(), WorkingBaseType.Branch];
|
||||||
@ -194,7 +194,7 @@ function createOrUpdateBranch(git, commitMessage, base, branch, branchRemoteName
|
|||||||
else {
|
else {
|
||||||
aopts.push('-A');
|
aopts.push('-A');
|
||||||
}
|
}
|
||||||
yield git.exec(aopts, true);
|
yield git.exec(aopts, { allowAllExitCodes: true });
|
||||||
const popts = ['-m', commitMessage];
|
const popts = ['-m', commitMessage];
|
||||||
if (signoff) {
|
if (signoff) {
|
||||||
popts.push('--signoff');
|
popts.push('--signoff');
|
||||||
@ -517,7 +517,7 @@ function createPullRequest(inputs) {
|
|||||||
// Create signed commits via the GitHub API
|
// Create signed commits via the GitHub API
|
||||||
const stashed = yield git.stashPush(['--include-untracked']);
|
const stashed = yield git.stashPush(['--include-untracked']);
|
||||||
yield git.checkout(inputs.branch);
|
yield git.checkout(inputs.branch);
|
||||||
const pushSignedCommitsResult = yield ghBranch.pushSignedCommits(result.branchCommits, result.baseCommit, repoPath, branchRepository, inputs.branch);
|
const pushSignedCommitsResult = yield ghBranch.pushSignedCommits(git, result.branchCommits, result.baseCommit, repoPath, branchRepository, inputs.branch);
|
||||||
outputs.set('pull-request-head-sha', pushSignedCommitsResult.sha);
|
outputs.set('pull-request-head-sha', pushSignedCommitsResult.sha);
|
||||||
outputs.set('pull-request-commits-verified', pushSignedCommitsResult.verified.toString());
|
outputs.set('pull-request-commits-verified', pushSignedCommitsResult.verified.toString());
|
||||||
yield git.checkout('-');
|
yield git.checkout('-');
|
||||||
@ -704,7 +704,7 @@ class GitCommandManager {
|
|||||||
if (options) {
|
if (options) {
|
||||||
args.push(...options);
|
args.push(...options);
|
||||||
}
|
}
|
||||||
return yield this.exec(args, allowAllExitCodes);
|
return yield this.exec(args, { allowAllExitCodes: allowAllExitCodes });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
commit(options_1) {
|
commit(options_1) {
|
||||||
@ -716,7 +716,7 @@ class GitCommandManager {
|
|||||||
if (options) {
|
if (options) {
|
||||||
args.push(...options);
|
args.push(...options);
|
||||||
}
|
}
|
||||||
return yield this.exec(args, allowAllExitCodes);
|
return yield this.exec(args, { allowAllExitCodes: allowAllExitCodes });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
config(configKey, configValue, globalConfig, add) {
|
config(configKey, configValue, globalConfig, add) {
|
||||||
@ -738,7 +738,7 @@ class GitCommandManager {
|
|||||||
'--get-regexp',
|
'--get-regexp',
|
||||||
configKey,
|
configKey,
|
||||||
configValue
|
configValue
|
||||||
], true);
|
], { allowAllExitCodes: true });
|
||||||
return output.exitCode === 0;
|
return output.exitCode === 0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -835,7 +835,7 @@ class GitCommandManager {
|
|||||||
if (options) {
|
if (options) {
|
||||||
args.push(...options);
|
args.push(...options);
|
||||||
}
|
}
|
||||||
const output = yield this.exec(args, true);
|
const output = yield this.exec(args, { allowAllExitCodes: true });
|
||||||
return output.exitCode === 1;
|
return output.exitCode === 1;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -892,6 +892,13 @@ class GitCommandManager {
|
|||||||
return output.stdout.trim();
|
return output.stdout.trim();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
showFileAtRefBase64(ref, path) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const args = ['show', `${ref}:${path}`];
|
||||||
|
const output = yield this.exec(args, { encoding: 'base64' });
|
||||||
|
return output.stdout.trim();
|
||||||
|
});
|
||||||
|
}
|
||||||
stashPush(options) {
|
stashPush(options) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const args = ['stash', 'push'];
|
const args = ['stash', 'push'];
|
||||||
@ -939,13 +946,13 @@ class GitCommandManager {
|
|||||||
'--unset',
|
'--unset',
|
||||||
configKey,
|
configKey,
|
||||||
configValue
|
configValue
|
||||||
], true);
|
], { allowAllExitCodes: true });
|
||||||
return output.exitCode === 0;
|
return output.exitCode === 0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
tryGetRemoteUrl() {
|
tryGetRemoteUrl() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const output = yield this.exec(['config', '--local', '--get', 'remote.origin.url'], true);
|
const output = yield this.exec(['config', '--local', '--get', 'remote.origin.url'], { allowAllExitCodes: true });
|
||||||
if (output.exitCode !== 0) {
|
if (output.exitCode !== 0) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@ -957,7 +964,8 @@ class GitCommandManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exec(args_1) {
|
exec(args_1) {
|
||||||
return __awaiter(this, arguments, void 0, function* (args, allowAllExitCodes = false) {
|
return __awaiter(this, arguments, void 0, function* (args, opts = {}) {
|
||||||
|
var _a;
|
||||||
const result = new GitOutput();
|
const result = new GitOutput();
|
||||||
const env = {};
|
const env = {};
|
||||||
for (const key of Object.keys(process.env)) {
|
for (const key of Object.keys(process.env)) {
|
||||||
@ -968,13 +976,15 @@ class GitCommandManager {
|
|||||||
const options = {
|
const options = {
|
||||||
cwd: this.workingDirectory,
|
cwd: this.workingDirectory,
|
||||||
env,
|
env,
|
||||||
ignoreReturnCode: allowAllExitCodes,
|
ignoreReturnCode: (_a = opts.allowAllExitCodes) !== null && _a !== void 0 ? _a : false,
|
||||||
listeners: {
|
listeners: {
|
||||||
stdout: (data) => {
|
stdout: (data) => {
|
||||||
stdout.push(data.toString());
|
var _a;
|
||||||
|
stdout.push(data.toString((_a = opts.encoding) !== null && _a !== void 0 ? _a : 'utf8'));
|
||||||
},
|
},
|
||||||
stderr: (data) => {
|
stderr: (data) => {
|
||||||
stderr.push(data.toString());
|
var _a;
|
||||||
|
stderr.push(data.toString((_a = opts.encoding) !== null && _a !== void 0 ? _a : 'utf8'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1400,7 +1410,7 @@ class GitHubHelper {
|
|||||||
return pull;
|
return pull;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
pushSignedCommits(branchCommits, baseCommit, repoPath, branchRepository, branch) {
|
pushSignedCommits(git, branchCommits, baseCommit, repoPath, branchRepository, branch) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let headCommit = {
|
let headCommit = {
|
||||||
sha: baseCommit.sha,
|
sha: baseCommit.sha,
|
||||||
@ -1408,13 +1418,13 @@ class GitHubHelper {
|
|||||||
verified: false
|
verified: false
|
||||||
};
|
};
|
||||||
for (const commit of branchCommits) {
|
for (const commit of branchCommits) {
|
||||||
headCommit = yield this.createCommit(commit, headCommit, repoPath, branchRepository);
|
headCommit = yield this.createCommit(git, commit, headCommit, repoPath, branchRepository);
|
||||||
}
|
}
|
||||||
yield this.createOrUpdateRef(branchRepository, branch, headCommit.sha);
|
yield this.createOrUpdateRef(branchRepository, branch, headCommit.sha);
|
||||||
return headCommit;
|
return headCommit;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
createCommit(commit, parentCommit, repoPath, branchRepository) {
|
createCommit(git, commit, parentCommit, repoPath, branchRepository) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const repository = this.parseRepository(branchRepository);
|
const repository = this.parseRepository(branchRepository);
|
||||||
// In the case of an empty commit, the tree references the parent's tree
|
// In the case of an empty commit, the tree references the parent's tree
|
||||||
@ -1436,7 +1446,9 @@ class GitHubHelper {
|
|||||||
let sha = null;
|
let sha = null;
|
||||||
if (status === 'A' || status === 'M') {
|
if (status === 'A' || status === 'M') {
|
||||||
try {
|
try {
|
||||||
const { data: blob } = yield blobCreationLimit(() => this.octokit.rest.git.createBlob(Object.assign(Object.assign({}, repository), { content: utils.readFileBase64([repoPath, path]), encoding: 'base64' })));
|
const { data: blob } = yield blobCreationLimit(() => __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return this.octokit.rest.git.createBlob(Object.assign(Object.assign({}, repository), { content: yield git.showFileAtRefBase64(commit.sha, path), encoding: 'base64' }));
|
||||||
|
}));
|
||||||
sha = blob.sha;
|
sha = blob.sha;
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
@ -1763,7 +1775,6 @@ exports.randomString = randomString;
|
|||||||
exports.parseDisplayNameEmail = parseDisplayNameEmail;
|
exports.parseDisplayNameEmail = parseDisplayNameEmail;
|
||||||
exports.fileExistsSync = fileExistsSync;
|
exports.fileExistsSync = fileExistsSync;
|
||||||
exports.readFile = readFile;
|
exports.readFile = readFile;
|
||||||
exports.readFileBase64 = readFileBase64;
|
|
||||||
exports.getErrorMessage = getErrorMessage;
|
exports.getErrorMessage = getErrorMessage;
|
||||||
const core = __importStar(__nccwpck_require__(7484));
|
const core = __importStar(__nccwpck_require__(7484));
|
||||||
const fs = __importStar(__nccwpck_require__(9896));
|
const fs = __importStar(__nccwpck_require__(9896));
|
||||||
@ -1853,15 +1864,6 @@ function fileExistsSync(path) {
|
|||||||
function readFile(path) {
|
function readFile(path) {
|
||||||
return fs.readFileSync(path, 'utf-8');
|
return fs.readFileSync(path, 'utf-8');
|
||||||
}
|
}
|
||||||
function readFileBase64(pathParts) {
|
|
||||||
const resolvedPath = path.resolve(...pathParts);
|
|
||||||
if (fs.lstatSync(resolvedPath).isSymbolicLink()) {
|
|
||||||
return fs
|
|
||||||
.readlinkSync(resolvedPath, { encoding: 'buffer' })
|
|
||||||
.toString('base64');
|
|
||||||
}
|
|
||||||
return fs.readFileSync(resolvedPath).toString('base64');
|
|
||||||
}
|
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
function hasErrorCode(error) {
|
function hasErrorCode(error) {
|
||||||
return typeof (error && error.code) === 'string';
|
return typeof (error && error.code) === 'string';
|
||||||
|
|||||||
@ -272,7 +272,7 @@ export class GitHubHelper {
|
|||||||
let sha: string | null = null
|
let sha: string | null = null
|
||||||
if (status === 'A' || status === 'M') {
|
if (status === 'A' || status === 'M') {
|
||||||
try {
|
try {
|
||||||
const {data: blob} = await blobCreationLimit(() =>
|
const {data: blob} = await blobCreationLimit(async () =>
|
||||||
this.octokit.rest.git.createBlob({
|
this.octokit.rest.git.createBlob({
|
||||||
...repository,
|
...repository,
|
||||||
content: await git.showFileAtRefBase64(commit.sha, path),
|
content: await git.showFileAtRefBase64(commit.sha, path),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user