From 9c035760082e1f6af0ef7db54c75ae41632dc962 Mon Sep 17 00:00:00 2001 From: Pavel Prichodko <14926950+prichodko@users.noreply.github.com> Date: Thu, 17 Mar 2022 14:48:26 +0100 Subject: [PATCH] Use env variables --- .env.example | 2 ++ import.js | 4 +++- package.json | 3 ++- webhooks.js | 4 +++- yarn.lock | 5 +++++ 5 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..49c1ac3 --- /dev/null +++ b/.env.example @@ -0,0 +1,2 @@ +GITHUB_AUTH_TOKEN= +GITHUB_WEBHOOKS_SECRET= \ No newline at end of file diff --git a/import.js b/import.js index c712f7d..2a40d34 100644 --- a/import.js +++ b/import.js @@ -1,7 +1,9 @@ +require('dotenv').config() + const { Octokit } = require('@octokit/rest') const octokit = new Octokit({ - auth: ``, + auth: process.env.GITHUB_AUTH_TOKEN, }) // https://docs.github.com/en/issues/trying-out-the-new-projects-experience/using-the-api-to-manage-projects#finding-the-node-id-of-an-organization-project diff --git a/package.json b/package.json index 4ef182d..93cb7df 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "dependencies": { "@octokit/core": "^3.6.0", "@octokit/rest": "^18.12.0", - "@octokit/webhooks": "^9.23.0" + "@octokit/webhooks": "^9.23.0", + "dotenv": "^16.0.0" } } diff --git a/webhooks.js b/webhooks.js index 8dee6f8..4f28dc2 100644 --- a/webhooks.js +++ b/webhooks.js @@ -1,7 +1,9 @@ +require('dotenv').config() + const { Webhooks } = require('@octokit/webhooks') const webhooks = new Webhooks({ - secret: 'mysecret', + secret: process.env.GITHUB_WEBHOOKS_SECRET, }) // all events, unnecessary are commented out diff --git a/yarn.lock b/yarn.lock index ca4975e..dd438e1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -146,6 +146,11 @@ deprecation@^2.0.0, deprecation@^2.3.1: resolved "https://registry.yarnpkg.com/deprecation/-/deprecation-2.3.1.tgz#6368cbdb40abf3373b525ac87e4a260c3a700919" integrity sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ== +dotenv@^16.0.0: + version "16.0.0" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.0.tgz#c619001253be89ebb638d027b609c75c26e47411" + integrity sha512-qD9WU0MPM4SWLPJy/r2Be+2WgQj8plChsyrCNQzW/0WjvcJQiKQJ9mH3ZgB3fxbUUxgc/11ZJ0Fi5KiimWGz2Q== + indent-string@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251"