Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function init() {
logger.info("Initializing GitHub App ...");
var pem = fs.readFileSync(configuration.getOption("app-pemfile"));
auth = createAppAuth({
id: configuration.getOption('app-appid'),
privateKey: pem,
clientId: configuration.getOption('app-clientid'),
clientSecret: configuration.getOption('app-clientsecret'),
request: request.defaults({
baseUrl: configuration.getOption('baseurl')
})
});
logger.debug(auth);
}
const fetch = require('node-fetch');
const { sprintf } = require('sprintf-js');
const { createAppAuth } = require("@octokit/auth-app");
const fs = require('fs');
const path = require('path');
const pathToMarvinPrivateKey = path.join(__dirname, 'marvin.pem');
const privateKey = fs.readFileSync(pathToMarvinPrivateKey, 'utf-8');
const auth = createAppAuth({
id: process.env.MARVIN_APP_ID,
privateKey,
installationId: process.env.MARVIN_ORBS_INSTALLATION_ID,
clientId: process.env.MARVIN_CLIENT_ID,
clientSecret: process.env.MARVIN_CLIENT_SECRET
});
function secondsToHumanReadable(seconds) {
var numhours = Math.floor(((seconds % 31536000) % 86400) / 3600);
var numminutes = Math.floor((((seconds % 31536000) % 86400) % 3600) / 60);
var numseconds = (((seconds % 31536000) % 86400) % 3600) % 60;
let humanReadable = '';
humanReadable += (numhours > 0) ? numhours + " hours " : '';
humanReadable += (numminutes > 0) ? numminutes + " minutes " : '';
humanReadable += (numseconds > 0) ? numseconds + " seconds " : '';