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

This commit is contained in:
Andrea Lamparelli 2023-12-06 10:59:11 +01:00
parent aac73bf7c5
commit 9d712aa5a3
No known key found for this signature in database
GPG key ID: 93BA483DB80AC3FB
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");