actually rebuild

This commit is contained in:
Dario Dorando 2023-09-06 15:38:58 +03:00
parent 619bfb4fa4
commit 678e777973
2 changed files with 22 additions and 10 deletions

28
dist/index.js vendored
View file

@ -500,6 +500,11 @@ function createPullRequest(inputs) {
} }
} }
catch (error) { catch (error) {
if (error instanceof Error) {
core.error(error);
if (error.stack)
core.error(error.stack);
}
core.setFailed(utils.getErrorMessage(error)); core.setFailed(utils.getErrorMessage(error));
} }
finally { finally {
@ -713,8 +718,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.GitCommandManager = void 0; exports.GitCommandManager = void 0;
const exec = __importStar(__nccwpck_require__(1514)); const exec = __importStar(__nccwpck_require__(1514));
const io = __importStar(__nccwpck_require__(7436)); const io = __importStar(__nccwpck_require__(7436));
const utils = __importStar(__nccwpck_require__(918));
const path = __importStar(__nccwpck_require__(1017));
const tagsRefSpec = '+refs/tags/*:refs/tags/*'; const tagsRefSpec = '+refs/tags/*:refs/tags/*';
class GitCommandManager { class GitCommandManager {
constructor(workingDirectory, gitPath) { constructor(workingDirectory, gitPath) {
@ -798,7 +801,7 @@ class GitCommandManager {
args.push('--no-tags'); args.push('--no-tags');
} }
args.push('--progress', '--no-recurse-submodules'); args.push('--progress', '--no-recurse-submodules');
if (utils.fileExistsSync(path.join(this.workingDirectory, '.git', 'shallow'))) { if (yield this.isShallow()) {
args.push('--unshallow'); args.push('--unshallow');
} }
if (options) { if (options) {
@ -843,6 +846,12 @@ class GitCommandManager {
getWorkingDirectory() { getWorkingDirectory() {
return this.workingDirectory; return this.workingDirectory;
} }
isShallow() {
return __awaiter(this, void 0, void 0, function* () {
const result = yield this.exec(['rev-parse', '--is-shallow-repository']);
return result.stdout.trim() === 'true';
});
}
hasDiff(options) { hasDiff(options) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const args = ['diff', '--quiet']; const args = ['diff', '--quiet'];
@ -1238,6 +1247,11 @@ function run() {
yield (0, create_pull_request_1.createPullRequest)(inputs); yield (0, create_pull_request_1.createPullRequest)(inputs);
} }
catch (error) { catch (error) {
if (error instanceof Error) {
core.error(error);
if (error.stack)
core.error(error.stack);
}
core.setFailed(utils.getErrorMessage(error)); core.setFailed(utils.getErrorMessage(error));
} }
}); });
@ -1411,10 +1425,11 @@ function fileExistsSync(path) {
if (!path) { if (!path) {
throw new Error("Arg 'path' must not be empty"); throw new Error("Arg 'path' must not be empty");
} }
const fd = fs.openSync(path, 'r'); core.info(path);
core.info(fs.realpathSync(path));
let stats; let stats;
try { try {
stats = fs.fstatSync(fd); stats = fs.statSync(fs.realpathSync(path));
} }
catch (error) { catch (error) {
if (hasErrorCode(error) && error.code === 'ENOENT') { if (hasErrorCode(error) && error.code === 'ENOENT') {
@ -1422,9 +1437,6 @@ function fileExistsSync(path) {
} }
throw new Error(`Encountered an error when checking whether path '${path}' exists: ${getErrorMessage(error)}`); throw new Error(`Encountered an error when checking whether path '${path}' exists: ${getErrorMessage(error)}`);
} }
finally {
fs.closeSync(fd);
}
if (!stats.isDirectory()) { if (!stats.isDirectory()) {
return true; return true;
} }

View file

@ -161,8 +161,8 @@ export class GitCommandManager {
} }
async isShallow(): Promise<boolean> { async isShallow(): Promise<boolean> {
const result = await this.revParse('', ['--is-shallow-repository']) const result = await this.exec(['rev-parse', '--is-shallow-repository'])
return result === 'true' return result.stdout.trim() === 'true'
} }
async hasDiff(options?: string[]): Promise<boolean> { async hasDiff(options?: string[]): Promise<boolean> {