From 9ebefe88610d0a318cf5c91a0c304fb0be1ad2a5 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 6 Jan 2021 11:18:56 +0100 Subject: [PATCH] My Message --- Client/httpInterface.js | 2 ++ Client/test.js | 65 ++++++++++++++++++----------------------- 2 files changed, 31 insertions(+), 36 deletions(-) diff --git a/Client/httpInterface.js b/Client/httpInterface.js index 4490059f4..d10e2eba5 100644 --- a/Client/httpInterface.js +++ b/Client/httpInterface.js @@ -540,6 +540,8 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE .commit(commitMessage) .push('origin', 'in-app-documentation') + + respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse) } catch (err) { console.log('[ERROR] httpInterface -> App -> Contribute -> Method call produced an error.') diff --git a/Client/test.js b/Client/test.js index 3e0551d31..36fefed10 100644 --- a/Client/test.js +++ b/Client/test.js @@ -1,58 +1,51 @@ -githubTest() -//gitTest() +//const commitMessage = unescape(requestParameters[3]) +const commitMessage = 'My Message' +contribute() -async function githubTest() { +async function contribute() { + await doGit() + await doGithub() + console.log('Finished') +} + +async function doGit() { + const simpleGit = require('simple-git'); + const options = { + baseDir: process.cwd(), + binary: 'git', + maxConcurrentProcesses: 6, + } + const git = simpleGit(options) + + await git.add('./*') + await git.commit(commitMessage) + await git.push('origin', 'in-app-documentation') +} + +async function doGithub() { const token = "" const { Octokit } = require("@octokit/rest") const octokit = new Octokit({ auth: token, - userAgent: 'Superalgos Beta 8', - //previews: ['jean-grey', 'symmetra'], - //timeZone: 'Europe/London', - //baseUrl: 'https://api.github.com', - /* - log: { - debug: () => { }, - info: () => { }, - warn: console.warn, - error: console.error - }, - request: { - agent: undefined, - fetch: undefined, - timeout: 0 - } - */ + userAgent: 'Superalgos Beta 8' }) const repo = 'Superalgos' - const owner = 'Luis-Fernando-Molina' - const username = 'Luis-Fernando-Molina' + const owner = 'Superalgos' const head = 'Luis-Fernando-Molina:in-app-documentation' const base = 'in-app-documentation' + const title = 'My Contribution to Superalgos' - /* - let user = await octokit.users.getByUsername({ - username, - }); - - let superalgosRepo = await octokit.repos.get({ - owner, - repo, - }); - */ - - let pullRequest = await octokit.pulls.create({ + await octokit.pulls.create({ owner, repo, + title, head, base, }); - - console.log(pullRequest) }