Use env variables

This commit is contained in:
Pavel Prichodko 2022-03-17 14:48:26 +01:00
parent c55196dc32
commit 9c03576008
No known key found for this signature in database
GPG Key ID: 8E4C82D464215E83
5 changed files with 15 additions and 3 deletions

2
.env.example Normal file
View File

@ -0,0 +1,2 @@
GITHUB_AUTH_TOKEN=
GITHUB_WEBHOOKS_SECRET=

View File

@ -1,7 +1,9 @@
require('dotenv').config()
const { Octokit } = require('@octokit/rest')
const octokit = new Octokit({
auth: `<AUTH_TOKEN>`,
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

View File

@ -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"
}
}

View File

@ -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

View File

@ -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"