feat(gh-85): take git tokens from environment (#88)

This commit is contained in:
Andrea Lamparelli 2023-12-10 22:05:53 +01:00 committed by GitHub
parent aac73bf7c5
commit 70da575afc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 456 additions and 24 deletions

View file

@ -1,4 +1,5 @@
import * as core from "@actions/core";
import { AuthTokenId } from "@bp/service/configs/configs.types";
import * as fs from "fs";
export const addProcessArgs = (args: string[]) => {
@ -9,6 +10,13 @@ export const resetProcessArgs = () => {
process.argv = ["node", "backporting"];
};
export const resetEnvTokens = () => {
delete process.env[AuthTokenId.GITHUB_TOKEN];
delete process.env[AuthTokenId.GITLAB_TOKEN];
delete process.env[AuthTokenId.CODEBERG_TOKEN];
delete process.env[AuthTokenId.GIT_TOKEN];
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const spyGetInput = (obj: any) => {
const mock = jest.spyOn(core, "getInput");