set github user and password as environment variable

This commit is contained in:
Slawomir Jaranowski
2020-02-22 14:10:17 +01:00
parent df80e35e53
commit 19102415df
2 changed files with 2 additions and 28 deletions

View File

@ -185,35 +185,15 @@ test('fillServers github', () => {
const xml = new DOMParser().parseFromString("<servers/>");
process.env['INPUT_GITHUBSERVER'] = 'true';
process.env['GITHUB_ACTOR'] = 'githubActor';
process.env['GITHUB_TOKEN'] = 'githubToken';
settings.fillServerForGithub(xml);
const xmlStr = new XMLSerializer().serializeToString(xml);
expect(xmlStr).toBe('<servers><server><id>github</id><username>githubActor</username><password>githubToken</password></server></servers>');
expect(xmlStr).toBe('<servers><server><id>github</id><username>${env.GITHUB_ACTOR}</username><password>${env.GITHUB_TOKEN}</password></server></servers>');
expect(consoleOutput).toEqual([]);
});
test('fillServers github - no GITHUB_* env', () => {
const xml = new DOMParser().parseFromString("<servers/>");
process.env['INPUT_GITHUBSERVER'] = 'true';
settings.fillServerForGithub(xml);
const xmlStr = new XMLSerializer().serializeToString(xml);
expect(xmlStr).toBe('<servers/>');
expect(consoleOutput).toEqual(
expect.arrayContaining([
expect.stringMatching(/::warning::GITHUB_ACTOR or GITHUB_TOKEN environment variable are not set, github server will not be added/)
])
);
});
test('addSonatypeSnapshots activate', () => {
process.env['INPUT_SONATYPESNAPSHOTS'] = "true";