From 815605ac2aa79749c0d3622dbe1e3ee51d25665f Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Wed, 10 Mar 2021 20:53:48 -0500 Subject: [PATCH] Make github pull easier for private --- commands/util/exec.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/commands/util/exec.js b/commands/util/exec.js index 0eb9eb16..2f3f5aff 100644 --- a/commands/util/exec.js +++ b/commands/util/exec.js @@ -1,6 +1,7 @@ const Command = require('../../structures/Command'); const { execSync } = require('child_process'); const { stripIndents } = require('common-tags'); +const { XIAO_GITHUB_REPO_USERNAME, XIAO_GITHUB_REPO_NAME, GITHUB_ACCESS_TOKEN } = process.env; module.exports = class ExecCommand extends Command { constructor(client) { @@ -23,6 +24,10 @@ module.exports = class ExecCommand extends Command { } run(msg, { command }) { + if (command === 'git pull') { + const repo = `${XIAO_GITHUB_REPO_USERNAME}/${XIAO_GITHUB_REPO_NAME}`; + command = `git pull https://${GITHUB_ACCESS_TOKEN}@github.com/${repo}.git`; + } const results = this.exec(command); return msg.reply(stripIndents` _${results.err ? 'An error occurred:' : 'Successfully executed.'}_