angular/.github/actions/deploy-docs-site/lib/credential.mts
Alan Agius 116f55ce30 refactor(docs-infra): use Node.js temp APIs in deploy action
Replaces the 'tmp' package with native 'node:os' and 'node:fs' APIs to create temporary files in the system temp directory.
2026-04-30 16:10:54 -07:00

22 lines
777 B
TypeScript

import {writeFileSync, mkdtempSync} from 'node:fs';
import {join} from 'node:path';
import {tmpdir} from 'node:os';
import {getInput, setSecret} from '@actions/core';
let credentialFilePath: undefined | string;
export function getCredentialFilePath(): string {
if (credentialFilePath === undefined) {
const tmpDir = mkdtempSync(join(tmpdir(), 'credential-'));
const filePath = join(tmpDir, 'credential.json');
writeFileSync(filePath, getInput('serviceKey', {required: true}));
setSecret(filePath);
credentialFilePath = filePath;
}
return credentialFilePath;
}
/** Github access token. Used for querying the active release trains. */
export const githubReleaseTrainReadToken: string = getInput('githubReleaseTrainReadToken', {
required: true,
});