From 30b0cf2cbd49cf3e8bba47bc49d9caef8435f4e7 Mon Sep 17 00:00:00 2001 From: Greg Walker Date: Fri, 1 Sep 2023 17:05:39 -0500 Subject: [PATCH] the js code does less; take out the parts we don't need --- .github/workflows/addFact.js | 38 ------------------------------------ 1 file changed, 38 deletions(-) diff --git a/.github/workflows/addFact.js b/.github/workflows/addFact.js index 26e31a1..0b79b01 100644 --- a/.github/workflows/addFact.js +++ b/.github/workflows/addFact.js @@ -1,6 +1,5 @@ const fs = require("fs").promises; const path = require("path"); -const { exec } = require("child_process"); const { Octokit } = require("@octokit/rest"); const exists = async (path) => { @@ -25,19 +24,6 @@ const getFact = (rawFact) => { return rawFact; }; -const cmd = (...cmd) => - new Promise((resolve, reject) => { - console.log(...cmd); - exec(...cmd, (err, stdout) => { - if (err) { - reject(new Error(err)); - } else { - console.log(stdout); - resolve(); - } - }); - }); - (async () => { const github = new Octokit({ auth: process.env.GITHUB_TOKEN, @@ -87,28 +73,4 @@ const cmd = (...cmd) => await fs.writeFile(allFactsPath, JSON.stringify(allFacts, null, 2), { encoding: "utf-8", }); - - // const branch = `add-fact/${issueNumber}`; - // await cmd(`git config --local user.email "mgwalker@users.noreply.github.com"`); - // await cmd(`git config --local user.name "automatic update"`); - // await cmd(`git checkout -b ${branch}`); - // await cmd(`git add ${allFactsPath}`); - // await cmd(`git commit -m "automatically-added fact"`); - // await cmd(`git push origin ${branch}`); - - // await github.rest.pulls.create({ - // base: "main", - // body: `This fact is being added automatically from the contents of #${issueNumber}`, - // head: branch, - // owner, - // repo, - // title: `Adding fact for #${issueNumber}`, - // }); - - // await github.rest.issues.update({ - // issue_number: issueNumber, - // owner, - // repo, - // state: "closed", - // }); })();