UNPKG

@codechecks/client

Version:

Open source platform for code review automation

39 lines 1.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const errors_1 = require("../utils/errors"); class Semaphore { constructor(env) { this.env = env; } isCurrentlyRunning() { return this.env["SEMAPHORE"] === "true"; } getPullRequestID() { return undefined; } getCurrentSha() { const sha = this.env["SEMAPHORE_GIT_SHA"]; if (!sha) { throw errors_1.crash("Couldnt get target SHA"); } return sha; } isFork() { if (!this.env["SEMAPHORE_GIT_BRANCH"]) { return false; } return this.env.SEMAPHORE_GIT_BRANCH.startsWith("pull-request-"); } getProjectSlug() { const slug = this.env["SEMAPHORE_PROJECT_NAME"]; if (!slug) { throw errors_1.crash("Couldnt get repo slug"); } return `${this.env["SEMAPHORE_PROJECT_NAME"]}/${this.env["SEMAPHORE_GIT_DIR"]}`; } supportsSpeculativeBranchSelection() { return true; } } exports.Semaphore = Semaphore; //# sourceMappingURL=Semaphore.js.map