Skip to content

Commit

Permalink
compile ts
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjgrainger committed Mar 31, 2022
1 parent 88f5be7 commit c2800a3
Showing 1 changed file with 89 additions and 89 deletions.
178 changes: 89 additions & 89 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,54 +329,54 @@ exports.getApiBaseUrl = getApiBaseUrl;
/***/ (function(__unusedmodule, exports, __webpack_require__) {

"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.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
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());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(__webpack_require__(470));
const github_1 = __webpack_require__(469);
const create_branch_1 = __webpack_require__(822);
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
const branch = core.getInput('branch');
const sha = core.getInput('sha');
core.debug(`Creating branch ${branch}`);
const isCreated = yield (0, create_branch_1.createBranch)(github_1.getOctokit, github_1.context, branch, sha);
core.setOutput('created', Boolean(isCreated));
}
catch (error) {
core.setFailed(error.message);
}
});
}
run();

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.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
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());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(__webpack_require__(470));
const github_1 = __webpack_require__(469);
const create_branch_1 = __webpack_require__(822);
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
const branch = core.getInput('branch');
const sha = core.getInput('sha');
core.debug(`Creating branch ${branch}`);
const isCreated = yield (0, create_branch_1.createBranch)(github_1.getOctokit, github_1.context, branch, sha);
core.setOutput('created', Boolean(isCreated));
}
catch (error) {
core.setFailed(error.message);
}
});
}
run();


/***/ }),
Expand Down Expand Up @@ -5731,47 +5731,47 @@ exports.createTokenAuth = createTokenAuth;
/***/ (function(__unusedmodule, exports) {

"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());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createBranch = void 0;
function createBranch(getOctokit, context, branch, sha) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const toolkit = getOctokit(githubToken());
// Sometimes branch might come in with refs/heads already
branch = branch.replace('refs/heads/', '');
const ref = `refs/heads/${branch}`;
// throws HttpError if branch already exists.
try {
yield toolkit.rest.repos.getBranch(Object.assign(Object.assign({}, context.repo), { branch }));
}
catch (error) {
if (error.name === 'HttpError' && error.status === 404) {
const resp = yield toolkit.rest.git.createRef(Object.assign({ ref, sha: sha || context.sha }, context.repo));
return ((_a = resp === null || resp === void 0 ? void 0 : resp.data) === null || _a === void 0 ? void 0 : _a.ref) === ref;
}
else {
throw Error(error);
}
}
});
}
exports.createBranch = createBranch;
function githubToken() {
const token = process.env.GITHUB_TOKEN;
if (!token)
throw ReferenceError('No token defined in the environment variables');
return token;
}

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());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createBranch = void 0;
function createBranch(getOctokit, context, branch, sha) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const toolkit = getOctokit(githubToken());
// Sometimes branch might come in with refs/heads already
branch = branch.replace('refs/heads/', '');
const ref = `refs/heads/${branch}`;
// throws HttpError if branch already exists.
try {
yield toolkit.rest.repos.getBranch(Object.assign(Object.assign({}, context.repo), { branch }));
}
catch (error) {
if (error.name === 'HttpError' && error.status === 404) {
const resp = yield toolkit.rest.git.createRef(Object.assign({ ref, sha: sha || context.sha }, context.repo));
return ((_a = resp === null || resp === void 0 ? void 0 : resp.data) === null || _a === void 0 ? void 0 : _a.ref) === ref;
}
else {
throw Error(error);
}
}
});
}
exports.createBranch = createBranch;
function githubToken() {
const token = process.env.GITHUB_TOKEN;
if (!token)
throw ReferenceError('No token defined in the environment variables');
return token;
}


/***/ }),
Expand Down

0 comments on commit c2800a3

Please sign in to comment.