index.js 586 B

12345678910111213141516171819202122232425
  1. "use strict";
  2. const log = require("npmlog");
  3. const { GitLabClient } = require("./lib/GitLabClient");
  4. module.exports.createGitLabClient = createGitLabClient;
  5. function OcktokitAdapter(client) {
  6. return { repos: { createRelease: client.createRelease.bind(client) } };
  7. }
  8. function createGitLabClient() {
  9. const { GL_API_URL, GL_TOKEN } = process.env;
  10. log.silly("Creating a GitLab client...");
  11. if (!GL_TOKEN) {
  12. throw new Error("A GL_TOKEN environment variable is required.");
  13. }
  14. const client = new GitLabClient(GL_API_URL, GL_TOKEN);
  15. return OcktokitAdapter(client);
  16. }