Skip to content

Commit 92f4de3

Browse files
committed
✨ use process.env. instead of @action/core in test and local
1 parent c9644d3 commit 92f4de3

File tree

4 files changed

+4
-9
lines changed

4 files changed

+4
-9
lines changed

packages/action/__tests__/generateContributionSnake.spec.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as fs from "fs";
22
import * as path from "path";
3-
import * as core from "@actions/core";
43
import { generateContributionSnake } from "../generateContributionSnake";
54
import { parseOutputsOption } from "../outputsOptions";
65
import { config } from "dotenv";
@@ -34,7 +33,7 @@ it(
3433
const outputs = parseOutputsOption(entries);
3534

3635
const results = await generateContributionSnake("platane", outputs, {
37-
githubToken: core.getInput("github_token"),
36+
githubToken: process.env.GITHUB_TOKEN!,
3837
});
3938

4039
expect(results[0]).toBeDefined();

packages/demo/webpack.config.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import path from "path";
22
import HtmlWebpackPlugin from "html-webpack-plugin";
33
import webpack from "webpack";
4-
import * as core from "@actions/core";
54
import { getGithubUserContribution } from "@snk/github-user-contribution";
65
import { config } from "dotenv";
76
import type { Configuration as WebpackConfiguration } from "webpack";
@@ -17,8 +16,7 @@ const webpackDevServerConfiguration: WebpackDevServerConfiguration = {
1716
const userName: string = req.params.userName;
1817
res.send(
1918
await getGithubUserContribution(userName, {
20-
githubToken:
21-
process.env.GITHUB_TOKEN ?? core.getInput("github_token"),
19+
githubToken: process.env.GITHUB_TOKEN!,
2220
})
2321
);
2422
});

packages/github-user-contribution-service/api/github-user-contribution/[userName].ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as core from "@actions/core";
21
import { getGithubUserContribution } from "@snk/github-user-contribution";
32
import { VercelRequest, VercelResponse } from "@vercel/node";
43
import nodeFetch from "node-fetch";
@@ -13,7 +12,7 @@ export default async (req: VercelRequest, res: VercelResponse) => {
1312
res.statusCode = 200;
1413
res.json(
1514
await getGithubUserContribution(userName as string, {
16-
githubToken: process.env.GITHUB_TOKEN ?? core.getInput("github_token"),
15+
githubToken: process.env.GITHUB_TOKEN!,
1716
})
1817
);
1918
} catch (err) {

packages/github-user-contribution/__tests__/getGithubUserContribution.spec.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import * as core from "@actions/core";
21
import { getGithubUserContribution } from "..";
32
import { config } from "dotenv";
43
config({ path: __dirname + "/../../../.env" });
54

65
describe("getGithubUserContribution", () => {
76
const promise = getGithubUserContribution("platane", {
8-
githubToken: process.env.GITHUB_TOKEN ?? core.getInput("github_token"),
7+
githubToken: process.env.GITHUB_TOKEN!,
98
});
109

1110
it("should resolve", async () => {

0 commit comments

Comments
 (0)