Use username password or token for bitbucket server

The bitbucket server publish action allows setting the token like other platforms, if the integration has a username and password configured though, not the token but the credentials are used

In config.ts the docs claim token takes precedence which only holds true if username & password are not set

Signed-off-by: Robert Schuh <github@eneticum.de>
This commit is contained in:
Robert Schuh
2022-09-03 02:24:40 +02:00
parent 1eb9092b1d
commit 6e06c1d1ab
@@ -139,8 +139,7 @@ export function getBitbucketServerRequestOptions(
if (config.token) {
headers.Authorization = `Bearer ${config.token}`;
}
if (config.username && config.password) {
} else if (config.username && config.password) {
const buffer = Buffer.from(`${config.username}:${config.password}`, 'utf8');
headers.Authorization = `Basic ${buffer.toString('base64')}`;
}