Skip to content

Commit d2d3826

Browse files
committed
chore: enable dotenv github token
This PR enables setting the GitHub token via a .env file. This allows setting a permanent GitHub token for downloading releases without rate limit. Signed-off-by: Maxim Stykow <maxim.stykow@tngtech.com>
1 parent 3774117 commit d2d3826

9 files changed

+14
-12
lines changed

src/e2e-tests/.env.sample .env.sample

+3
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@
33
//
44
// SPDX-License-Identifier: Apache-2.0
55

6+
# GitHub token to use when downloading releases.
7+
GITHUB_TOKEN=gho_XRfooZ3yOKCGqGzrvpIJr2WF3YktDI2tAaSK
8+
69
# Number of workers Playwright will use to run tests. Can also be set to, e.g., "50%" of the number of CPU cores.
710
WORKERS=1

commitlint.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const config: UserConfig = {
88
extends: ['@commitlint/config-conventional'],
99
rules: {
1010
'body-leading-blank': [2, 'always'],
11-
'body-max-line-length': [2, 'always', 120],
11+
'body-max-line-length': [2, 'always', 600],
1212
'footer-leading-blank': [2, 'always'],
1313
},
1414
};

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@
144144
"postinstall": "yarn install-deps && husky && yarn update-commit-hash",
145145
"pre-commit": "lint-staged",
146146
"install-deps": "run-script-os",
147-
"install-deps:darwin:x64": "yarn node tools/downloadOpossumFile.mjs mac-intel",
148-
"install-deps:darwin:arm64": "yarn node tools/downloadOpossumFile.mjs mac-arm64",
149-
"install-deps:linux": "yarn node tools/downloadOpossumFile.mjs linux",
150-
"install-deps:win32": "yarn node tools/downloadOpossumFile.mjs windows.exe"
147+
"install-deps:darwin:x64": "yarn node --env-file-if-exists=.env tools/downloadOpossumFile.mjs mac-intel",
148+
"install-deps:darwin:arm64": "yarn node --env-file-if-exists=.env tools/downloadOpossumFile.mjs mac-arm64",
149+
"install-deps:linux": "yarn node --env-file-if-exists=.env tools/downloadOpossumFile.mjs linux",
150+
"install-deps:win32": "yarn node --env-file-if-exists=.env tools/downloadOpossumFile.mjs windows.exe"
151151
},
152152
"main": "build/ElectronBackend/app.js",
153153
"build": {

src/e2e-tests/playwright.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { PlaywrightTestConfig } from '@playwright/test';
66
import dotenv from 'dotenv';
77
import path from 'path';
88

9-
dotenv.config({ path: path.resolve(__dirname, '.env') });
9+
dotenv.config({ path: path.resolve(process.cwd(), '.env') });
1010

1111
const CI_SINGLE_TEST_TIMEOUT = 60000;
1212
const GLOBAL_TIMEOUT = 3000000;

tools/downloadOpossumFile.mjs

100644100755
+5-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// SPDX-License-Identifier: Apache-2.0
55
import fs from 'fs';
66
import { dirname } from 'path';
7-
import { env } from 'process';
87
import { pipeline } from 'stream';
98

109
const EXECUTE_PERMISSIONS = 0o755;
@@ -14,7 +13,7 @@ async function downloadOpossumFile() {
1413

1514
if (!osSuffix) {
1615
console.error(
17-
'Please specify one of the following options: mac, linux, windows.exe',
16+
'Please specify one of the following options: mac-intel, mac-arm64, linux, windows.exe',
1817
);
1918
process.exit(1);
2019
}
@@ -29,19 +28,19 @@ async function downloadOpossumFile() {
2928
fs.rmSync(destinationPath);
3029
}
3130

32-
const githubToken = env.GITHUB_TOKEN;
31+
const githubToken = process.env.GITHUB_TOKEN;
3332

3433
if (!githubToken) {
3534
console.warn(
36-
'No GitHub token is provided. The download will be rate-limited.',
35+
'No GitHub token is provided. The opossum-file download will be rate-limited.',
3736
);
3837
}
3938

40-
const requestParams = !env.GITHUB_TOKEN
39+
const requestParams = !githubToken
4140
? undefined
4241
: {
4342
headers: {
44-
Authorization: `Bearer ${env.GITHUB_TOKEN}`,
43+
Authorization: `Bearer ${githubToken}`,
4544
},
4645
};
4746

tools/generateNotices.mjs

100644100755
File mode changed.

tools/get_app_version_for_windows.bat

100644100755
File mode changed.

tools/runScriptArch.mjs

100644100755
File mode changed.

tools/start_windows.bat

100644100755
File mode changed.

0 commit comments

Comments
 (0)