|
1 | | -const action = require('./src/action'); |
2 | | -const config = require('./src/test_config'); |
3 | | -const core = require('@actions/core'); |
4 | | -const { context } = require('@actions/github'); |
| 1 | +const action = require("./src/action"); |
| 2 | +const config = require("./src/test_config"); |
| 3 | +const core = require("@actions/core"); |
| 4 | +const { context } = require("@actions/github"); |
5 | 5 |
|
6 | | -const TEST_MODE = process.argv.includes('test'); |
| 6 | +const TEST_MODE = process.argv.includes("test"); |
7 | 7 |
|
8 | 8 | async function main() { |
9 | 9 | let githubToken, owner, repo, leetcodeCSRFToken, leetcodeSession; |
10 | 10 | let filterDuplicateSecs, destinationFolder; |
11 | 11 | if (TEST_MODE) { |
12 | | - if (!config.GITHUB_TOKEN || !config.GITHUB_REPO || !config.LEETCODE_CSRF_TOKEN || !config.LEETCODE_SESSION) { |
13 | | - throw new Error('Missing required configuration in src/test_config.js needed to run the test'); |
| 12 | + if ( |
| 13 | + !config.GITHUB_TOKEN || |
| 14 | + !config.GITHUB_REPO || |
| 15 | + !config.LEETCODE_CSRF_TOKEN || |
| 16 | + !config.LEETCODE_SESSION |
| 17 | + ) { |
| 18 | + throw new Error( |
| 19 | + "Missing required configuration in src/test_config.js needed to run the test", |
| 20 | + ); |
14 | 21 | } |
15 | 22 | githubToken = config.GITHUB_TOKEN; |
16 | | - [owner, repo] = config.GITHUB_REPO.split('/'); |
| 23 | + [owner, repo] = config.GITHUB_REPO.split("/"); |
17 | 24 | leetcodeCSRFToken = config.LEETCODE_CSRF_TOKEN; |
18 | 25 | leetcodeSession = config.LEETCODE_SESSION; |
19 | 26 | filterDuplicateSecs = config.FILTER_DUPLICATE_SECS; |
20 | 27 | destinationFolder = config.DESTINATION_FOLDER; |
21 | | - verbose = config.VERBOSE.toString(); // Convert to string to match core.getInput('verbose') return type |
| 28 | + verbose = config.VERBOSE.toString(); // Convert to string to match core.getInput('verbose') return type |
22 | 29 | commitHeader = config.COMMIT_HEADER; |
23 | 30 | } else { |
24 | | - githubToken = core.getInput('github-token'); |
| 31 | + githubToken = core.getInput("github-token"); |
25 | 32 | owner = context.repo.owner; |
26 | 33 | repo = context.repo.repo; |
27 | | - leetcodeCSRFToken = core.getInput('leetcode-csrf-token'); |
28 | | - leetcodeSession = core.getInput('leetcode-session'); |
29 | | - filterDuplicateSecs = core.getInput('filter-duplicate-secs'); |
30 | | - destinationFolder = core.getInput('destination-folder'); |
31 | | - verbose = core.getInput('verbose'); |
32 | | - commitHeader = core.getInput('commit-header'); |
| 34 | + leetcodeCSRFToken = core.getInput("leetcode-csrf-token"); |
| 35 | + leetcodeSession = core.getInput("leetcode-session"); |
| 36 | + filterDuplicateSecs = core.getInput("filter-duplicate-secs"); |
| 37 | + destinationFolder = core.getInput("destination-folder"); |
| 38 | + verbose = core.getInput("verbose"); |
| 39 | + commitHeader = core.getInput("commit-header"); |
33 | 40 | } |
34 | 41 |
|
35 | | - await action.sync({ githubToken, owner, repo, leetcodeCSRFToken, leetcodeSession, filterDuplicateSecs, destinationFolder, verbose, commitHeader }); |
| 42 | + await action.sync({ |
| 43 | + githubToken, |
| 44 | + owner, |
| 45 | + repo, |
| 46 | + leetcodeCSRFToken, |
| 47 | + leetcodeSession, |
| 48 | + filterDuplicateSecs, |
| 49 | + destinationFolder, |
| 50 | + verbose, |
| 51 | + commitHeader, |
| 52 | + }); |
36 | 53 | } |
37 | 54 |
|
38 | 55 | main().catch((error) => { |
|
0 commit comments