Skip to content

Commit

Permalink
✨ use process.env. instead of @action/core in test and local
Browse files Browse the repository at this point in the history
  • Loading branch information
Platane committed Oct 17, 2023
1 parent c9644d3 commit 92f4de3
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
3 changes: 1 addition & 2 deletions packages/action/__tests__/generateContributionSnake.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as fs from "fs";
import * as path from "path";
import * as core from "@actions/core";
import { generateContributionSnake } from "../generateContributionSnake";
import { parseOutputsOption } from "../outputsOptions";
import { config } from "dotenv";
Expand Down Expand Up @@ -34,7 +33,7 @@ it(
const outputs = parseOutputsOption(entries);

const results = await generateContributionSnake("platane", outputs, {
githubToken: core.getInput("github_token"),
githubToken: process.env.GITHUB_TOKEN!,
});

expect(results[0]).toBeDefined();
Expand Down
4 changes: 1 addition & 3 deletions packages/demo/webpack.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import path from "path";
import HtmlWebpackPlugin from "html-webpack-plugin";
import webpack from "webpack";
import * as core from "@actions/core";
import { getGithubUserContribution } from "@snk/github-user-contribution";
import { config } from "dotenv";
import type { Configuration as WebpackConfiguration } from "webpack";
Expand All @@ -17,8 +16,7 @@ const webpackDevServerConfiguration: WebpackDevServerConfiguration = {
const userName: string = req.params.userName;
res.send(
await getGithubUserContribution(userName, {
githubToken:
process.env.GITHUB_TOKEN ?? core.getInput("github_token"),
githubToken: process.env.GITHUB_TOKEN!,
})
);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as core from "@actions/core";
import { getGithubUserContribution } from "@snk/github-user-contribution";
import { VercelRequest, VercelResponse } from "@vercel/node";
import nodeFetch from "node-fetch";
Expand All @@ -13,7 +12,7 @@ export default async (req: VercelRequest, res: VercelResponse) => {
res.statusCode = 200;
res.json(
await getGithubUserContribution(userName as string, {
githubToken: process.env.GITHUB_TOKEN ?? core.getInput("github_token"),
githubToken: process.env.GITHUB_TOKEN!,
})
);
} catch (err) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import * as core from "@actions/core";
import { getGithubUserContribution } from "..";
import { config } from "dotenv";
config({ path: __dirname + "/../../../.env" });

describe("getGithubUserContribution", () => {
const promise = getGithubUserContribution("platane", {
githubToken: process.env.GITHUB_TOKEN ?? core.getInput("github_token"),
githubToken: process.env.GITHUB_TOKEN!,
});

it("should resolve", async () => {
Expand Down

0 comments on commit 92f4de3

Please sign in to comment.