Contribution

- Automatic fork creation
 - Setup of basic liquidity profile
This commit is contained in:
NAmorim committed 2021-11-24 16:31:52 +00:00
1 parent 0659ec6155
commit 866911abfe
3 files changed
+113 -1

No files matched your search

+46
View File
@@ -4,6 +4,7 @@ exports.newGithubServer = function newGithubServer() {
getGithubStars: getGithubStars,
getGithubWatchers: getGithubWatchers,
getGithubForks: getGithubForks,
createGithubFork: createGithubFork,
mergePullRequests: mergePullRequests,
initialize: initialize,
finalize: finalize,
@@ -162,6 +163,51 @@ exports.newGithubServer = function newGithubServer() {
}
}
async function createGithubFork(repository, username, token) {
try {
username = unescape(username)
token = unescape(token)
let error
await doGithub()
async function doGithub() {
try {
//const repo = 'Superalgos'
//const owner = username
const { Octokit } = SA.nodeModules.octokit
const octokit = new Octokit({
auth: token,
userAgent: 'Superalgos ' + SA.version
})
await octokit.repos.createFork({
owner: 'Superalgos',
repo: "Superalgos"
})
} catch (err) {
if (err === undefined) { return }
console.log('[ERROR] Github Server -> createGithubFork -> doGithub -> err.stack = ' + err.stack)
}
}
} catch (err) {
console.log('[ERROR] Github Server -> createGithubFork -> Method call produced an error.')
console.log('[ERROR] Github Server -> createGithubFork -> err.stack = ' + err.stack)
console.log('[ERROR] Github Server -> createGithubFork -> repository = ' + repository)
console.log('[ERROR] Github Server -> createGithubFork -> username = ' + username)
console.log('[ERROR] Github Server -> createGithubFork -> token starts with = ' + token.substring(0, 10) + '...')
console.log('[ERROR] Github Server -> createGithubFork -> token ends with = ' + '...' + token.substring(token.length - 10))
let error = {
result: 'Fail Because',
message: err.message,
stack: err.stack
}
return error
}
}
async function mergeGithubPullRequests(commitMessage, username, token) {
try {
commitMessage = unescape(commitMessage)