Trim token (#25)

This commit is contained in:
CrazyMax 2019-11-19 00:33:27 +01:00
parent 51a6208d4a
commit ba06a833cc
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
2 changed files with 4 additions and 4 deletions

View File

@ -42,11 +42,11 @@ function run() {
let remote_url = String('https://'); let remote_url = String('https://');
if (process.env['GITHUB_PAT']) { if (process.env['GITHUB_PAT']) {
core.info(`✅ Use GITHUB_PAT`); core.info(`✅ Use GITHUB_PAT`);
remote_url = remote_url.concat(process.env['GITHUB_PAT']); remote_url = remote_url.concat(process.env['GITHUB_PAT'].trim());
} }
else if (process.env['GITHUB_TOKEN']) { else if (process.env['GITHUB_TOKEN']) {
core.info(`✅ Use GITHUB_TOKEN`); core.info(`✅ Use GITHUB_TOKEN`);
remote_url = remote_url.concat('x-access-token:', process.env['GITHUB_TOKEN']); remote_url = remote_url.concat('x-access-token:', process.env['GITHUB_TOKEN'].trim());
} }
else { else {
core.setFailed('❌️ You have to provide a GITHUB_TOKEN or GITHUB_PAT'); core.setFailed('❌️ You have to provide a GITHUB_TOKEN or GITHUB_PAT');

View File

@ -26,10 +26,10 @@ async function run() {
let remote_url = String('https://'); let remote_url = String('https://');
if (process.env['GITHUB_PAT']) { if (process.env['GITHUB_PAT']) {
core.info(`✅ Use GITHUB_PAT`); core.info(`✅ Use GITHUB_PAT`);
remote_url = remote_url.concat(process.env['GITHUB_PAT']); remote_url = remote_url.concat(process.env['GITHUB_PAT'].trim());
} else if (process.env['GITHUB_TOKEN']) { } else if (process.env['GITHUB_TOKEN']) {
core.info(`✅ Use GITHUB_TOKEN`); core.info(`✅ Use GITHUB_TOKEN`);
remote_url = remote_url.concat('x-access-token:', process.env['GITHUB_TOKEN']); remote_url = remote_url.concat('x-access-token:', process.env['GITHUB_TOKEN'].trim());
} else { } else {
core.setFailed('❌️ You have to provide a GITHUB_TOKEN or GITHUB_PAT'); core.setFailed('❌️ You have to provide a GITHUB_TOKEN or GITHUB_PAT');
return; return;