Skip to content

Commit

Permalink
distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
Legion2 committed Sep 27, 2024
1 parent 6c8833c commit 0f66588
Show file tree
Hide file tree
Showing 2 changed files with 150 additions and 2 deletions.
150 changes: 149 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3006,6 +3006,151 @@ function copyFile(srcFile, destFile, force) {
}
//# sourceMappingURL=io.js.map

/***/ }),

/***/ 20:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {

"use strict";

var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// pkg/dist-src/index.js
var dist_src_exports = {};
__export(dist_src_exports, {
createActionAuth: () => createActionAuth
});
module.exports = __toCommonJS(dist_src_exports);
var import_auth_token = __nccwpck_require__(6434);
var createActionAuth = function createActionAuth2() {
if (!process.env.GITHUB_ACTION) {
throw new Error(
"[@octokit/auth-action] `GITHUB_ACTION` environment variable is not set. @octokit/auth-action is meant to be used in GitHub Actions only."
);
}
const definitions = [
process.env.GITHUB_TOKEN,
process.env.INPUT_GITHUB_TOKEN,
process.env.INPUT_TOKEN
].filter(Boolean);
if (definitions.length === 0) {
throw new Error(
"[@octokit/auth-action] `GITHUB_TOKEN` variable is not set. It must be set on either `env:` or `with:`. See https://github.com/octokit/auth-action.js#createactionauth"
);
}
if (definitions.length > 1) {
throw new Error(
"[@octokit/auth-action] The token variable is specified more than once. Use either `with.token`, `with.GITHUB_TOKEN`, or `env.GITHUB_TOKEN`. See https://github.com/octokit/auth-action.js#createactionauth"
);
}
const token = definitions.pop();
return (0, import_auth_token.createTokenAuth)(token);
};
// Annotate the CommonJS export names for ESM import in node:
0 && (0);


/***/ }),

/***/ 6434:
/***/ ((module) => {

"use strict";

var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// pkg/dist-src/index.js
var dist_src_exports = {};
__export(dist_src_exports, {
createTokenAuth: () => createTokenAuth
});
module.exports = __toCommonJS(dist_src_exports);

// pkg/dist-src/auth.js
var REGEX_IS_INSTALLATION_LEGACY = /^v1\./;
var REGEX_IS_INSTALLATION = /^ghs_/;
var REGEX_IS_USER_TO_SERVER = /^ghu_/;
async function auth(token) {
const isApp = token.split(/\./).length === 3;
const isInstallation = REGEX_IS_INSTALLATION_LEGACY.test(token) || REGEX_IS_INSTALLATION.test(token);
const isUserToServer = REGEX_IS_USER_TO_SERVER.test(token);
const tokenType = isApp ? "app" : isInstallation ? "installation" : isUserToServer ? "user-to-server" : "oauth";
return {
type: "token",
token,
tokenType
};
}

// pkg/dist-src/with-authorization-prefix.js
function withAuthorizationPrefix(token) {
if (token.split(/\./).length === 3) {
return `bearer ${token}`;
}
return `token ${token}`;
}

// pkg/dist-src/hook.js
async function hook(token, request, route, parameters) {
const endpoint = request.endpoint.merge(
route,
parameters
);
endpoint.headers.authorization = withAuthorizationPrefix(token);
return request(endpoint);
}

// pkg/dist-src/index.js
var createTokenAuth = function createTokenAuth2(token) {
if (!token) {
throw new Error("[@octokit/auth-token] No token passed to createTokenAuth");
}
if (typeof token !== "string") {
throw new Error(
"[@octokit/auth-token] Token passed to createTokenAuth is not a string"
);
}
token = token.replace(/^(token|bearer) +/i, "");
return Object.assign(auth.bind(null, token), {
hook: hook.bind(null, token)
});
};
// Annotate the CommonJS export names for ESM import in node:
0 && (0);


/***/ }),

/***/ 334:
Expand Down Expand Up @@ -13870,6 +14015,7 @@ const path_1 = __nccwpck_require__(1017);
const rest_1 = __nccwpck_require__(5375);
const exec_1 = __nccwpck_require__(1514);
const semver_1 = __nccwpck_require__(1383);
const auth_action_1 = __nccwpck_require__(20);
function getBasenameInArchive(archive) {
return __awaiter(this, void 0, void 0, function* () {
let filesList = '';
Expand Down Expand Up @@ -14020,7 +14166,9 @@ function invalidSwaggerUiConfig(configMode, secondMode) {
exports.invalidSwaggerUiConfig = invalidSwaggerUiConfig;
function getSwaggerUIRelease({ swaggerUIVersion }) {
return __awaiter(this, void 0, void 0, function* () {
const octokit = new rest_1.Octokit();
const octokit = new rest_1.Octokit({
authStrategy: auth_action_1.createActionAuth
});
const foundReleases = yield octokit.paginate(octokit.rest.repos.listReleases, {
owner: 'swagger-api',
repo: 'swagger-ui'
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

0 comments on commit 0f66588

Please sign in to comment.