Adding remote reader and tests
parent
d988a725e4
commit
8c09e24d75
|
|
@ -3452,21 +3452,41 @@ exports.ActionYamlReader = ActionYamlReader;
|
|||
/***/ }),
|
||||
|
||||
/***/ 24271:
|
||||
/***/ ((__unused_webpack_module, exports) => {
|
||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.GitRepoReader = void 0;
|
||||
const console_1 = __webpack_require__(57082);
|
||||
const system_1 = __importDefault(__webpack_require__(62177));
|
||||
const fs_1 = __importDefault(__webpack_require__(35747));
|
||||
class GitRepoReader {
|
||||
static GetSha() {
|
||||
return '';
|
||||
}
|
||||
static GetRemote() {
|
||||
return '';
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return (yield system_1.default.run(`git remote -v`)).split(' ')[1].split('https://github.com/')[1].split('.git')[0];
|
||||
});
|
||||
}
|
||||
static GetBranch() {
|
||||
return '';
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
console_1.assert(fs_1.default.existsSync(`.git`));
|
||||
return (yield system_1.default.run(`git branch`)).split('*')[1].split(`\n`)[0].replace(/ /g, ``);
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.GitRepoReader = GitRepoReader;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,8 @@
|
|||
import { GitRepoReader } from './git-repo';
|
||||
|
||||
describe(`git repo tests`, () => {
|
||||
it(`Branch value parsed from CLI to not contain illegal characters`, async () => {
|
||||
expect(await GitRepoReader.GetBranch()).not.toContain(`\n`);
|
||||
expect(await GitRepoReader.GetBranch()).not.toContain(` `);
|
||||
});
|
||||
});
|
||||
|
|
@ -1,11 +1,16 @@
|
|||
import { assert } from 'console';
|
||||
import System from '../system';
|
||||
import fs from 'fs';
|
||||
|
||||
export class GitRepoReader {
|
||||
static GetSha() {
|
||||
return '';
|
||||
}
|
||||
static GetRemote() {
|
||||
return '';
|
||||
public static async GetRemote() {
|
||||
return (await System.run(`git remote -v`)).split(' ')[1].split('https://github.com/')[1].split('.git')[0];
|
||||
}
|
||||
static GetBranch() {
|
||||
return '';
|
||||
public static async GetBranch() {
|
||||
assert(fs.existsSync(`.git`));
|
||||
return (await System.run(`git branch`)).split('*')[1].split(`\n`)[0].replace(/ /g, ``);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue