Skip to content

Commit

Permalink
Check user/pass separately
Browse files Browse the repository at this point in the history
  • Loading branch information
afarchy committed Dec 11, 2024
1 parent 3cbd29f commit ee41df1
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/activate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,26 @@ async function Activate(): Promise<void> {
const pro = license.toLowerCase().startsWith('pro');
let username = core.getInput('username', { required: pro }).trim();
let password = core.getInput('password', { required: pro }).trim();
const serial = core.getInput('serial', { required: pro });

if (!username && !password) {
if (!username) {
const encodedUsername = env['UNITY_USERNAME'];
const encodedPassword = env['UNITY_PASSWORD'];
if (!encodedUsername) {
throw Error('Username is required for Unity License Activation!');
}

username = Buffer.from(encodedUsername, 'base64').toString('utf-8');
}

if (encodedUsername && encodedPassword) {
username = Buffer.from(encodedUsername, 'base64').toString('utf-8');
password = Buffer.from(encodedPassword, 'base64').toString('utf-8');
} else {
throw Error('Username and Password are required for Unity License Activation!');
if (!password) {
const encodedPassword = env['UNITY_PASSWORD'];
if (!encodedPassword) {
throw Error('Password is required for Unity License Activation!');
}

password = Buffer.from(encodedPassword, 'base64').toString('utf-8');
}

const serial = core.getInput('serial', { required: pro });
await licenseClient.ActivateLicense(username, password, serial);
}
activeLicenses = await licenseClient.ShowEntitlements();
Expand Down

0 comments on commit ee41df1

Please sign in to comment.