mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
Replaces the 'tmp' package with native 'node:os' and 'node:fs' APIs to create temporary files in the system temp directory.
22 lines
777 B
TypeScript
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,
|
|
});
|