github.com/jfrog/frogbot@v1.1.1-0.20231221090046-821a26f50338/action/node_modules/@actions/github/lib/internal/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 (k !== "default" && 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.getApiBaseUrl = exports.getProxyAgent = exports.getAuthString = void 0;
    23  const httpClient = __importStar(require("@actions/http-client"));
    24  function getAuthString(token, options) {
    25      if (!token && !options.auth) {
    26          throw new Error('Parameter token or opts.auth is required');
    27      }
    28      else if (token && options.auth) {
    29          throw new Error('Parameters token and opts.auth may not both be specified');
    30      }
    31      return typeof options.auth === 'string' ? options.auth : `token ${token}`;
    32  }
    33  exports.getAuthString = getAuthString;
    34  function getProxyAgent(destinationUrl) {
    35      const hc = new httpClient.HttpClient();
    36      return hc.getAgent(destinationUrl);
    37  }
    38  exports.getProxyAgent = getProxyAgent;
    39  function getApiBaseUrl() {
    40      return process.env['GITHUB_API_URL'] || 'https://api.github.com';
    41  }
    42  exports.getApiBaseUrl = getApiBaseUrl;
    43  //# sourceMappingURL=utils.js.map