github.com/nektos/act@v0.2.63/pkg/runner/testdata/actions/node12/node_modules/@actions/github/lib/utils.js (about)

     1  "use strict";
     2  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
     3      if (k2 === undefined) k2 = k;
     4      Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
     5  }) : (function(o, m, k, k2) {
     6      if (k2 === undefined) k2 = k;
     7      o[k2] = m[k];
     8  }));
     9  var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    10      Object.defineProperty(o, "default", { enumerable: true, value: v });
    11  }) : function(o, v) {
    12      o["default"] = v;
    13  });
    14  var __importStar = (this && this.__importStar) || function (mod) {
    15      if (mod && mod.__esModule) return mod;
    16      var result = {};
    17      if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    18      __setModuleDefault(result, mod);
    19      return result;
    20  };
    21  Object.defineProperty(exports, "__esModule", { value: true });
    22  exports.getOctokitOptions = exports.GitHub = exports.context = void 0;
    23  const Context = __importStar(require("./context"));
    24  const Utils = __importStar(require("./internal/utils"));
    25  // octokit + plugins
    26  const core_1 = require("@octokit/core");
    27  const plugin_rest_endpoint_methods_1 = require("@octokit/plugin-rest-endpoint-methods");
    28  const plugin_paginate_rest_1 = require("@octokit/plugin-paginate-rest");
    29  exports.context = new Context.Context();
    30  const baseUrl = Utils.getApiBaseUrl();
    31  const defaults = {
    32      baseUrl,
    33      request: {
    34          agent: Utils.getProxyAgent(baseUrl)
    35      }
    36  };
    37  exports.GitHub = core_1.Octokit.plugin(plugin_rest_endpoint_methods_1.restEndpointMethods, plugin_paginate_rest_1.paginateRest).defaults(defaults);
    38  /**
    39   * Convience function to correctly format Octokit Options to pass into the constructor.
    40   *
    41   * @param     token    the repo PAT or GITHUB_TOKEN
    42   * @param     options  other options to set
    43   */
    44  function getOctokitOptions(token, options) {
    45      const opts = Object.assign({}, options || {}); // Shallow clone - don't mutate the object provided by the caller
    46      // Auth
    47      const auth = Utils.getAuthString(token, opts);
    48      if (auth) {
    49          opts.auth = auth;
    50      }
    51      return opts;
    52  }
    53  exports.getOctokitOptions = getOctokitOptions;
    54  //# sourceMappingURL=utils.js.map