fix(auth): Update authentication logic in settings.xml, unit tests (#1)

* fix(auth): Update authentication logic in settings.xml, unit tests

Enhanced the logic for reading authentication information in the settings.xml file to address an issue where attempts to configure a GitHub Action for fetching packages from a repository within the same organization resulted in authentication errors.
Despite the correct configuration, the process failed with a 401 Unauthorized status during dependency download from GitHub's Maven package repository.
The error was pinpointed to a non-resolvable parent POM due to authentication failure, with an incorrect 'parent.relativePath' exacerbating the issue.

To resolve this, I made significant updates to the logic within settings.xml for better handling of authentication information.
Additionally, unit tests have been updated to reflect these changes and ensure robust verification.

The documentation and examples have also been revised to provide clearer guidance on configuring and utilizing this updated process successfully.
This commit is contained in:
Parry 2024-03-01 16:16:24 +08:00 committed by GitHub
parent 9704b39bf2
commit c0786a2b6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 58 additions and 24 deletions

8
dist/setup/index.js vendored
View file

@ -122463,9 +122463,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.generate = exports.createAuthenticationSettings = exports.configureAuthentication = void 0;
const path = __importStar(__nccwpck_require__(71017));
const core = __importStar(__nccwpck_require__(42186));
const io = __importStar(__nccwpck_require__(47351));
const path = __importStar(__nccwpck_require__(71017));
const fs = __importStar(__nccwpck_require__(57147));
const os = __importStar(__nccwpck_require__(22037));
const xmlbuilder2_1 = __nccwpck_require__(70151);
@ -122517,8 +122517,8 @@ function generate(id, username, password, gpgPassphrase) {
server: [
{
id: id,
username: `\${env.${username}}`,
password: `\${env.${password}}`
username: process.env[username],
password: process.env[password]
}
]
}
@ -122527,7 +122527,7 @@ function generate(id, username, password, gpgPassphrase) {
if (gpgPassphrase) {
const gpgServer = {
id: 'gpg.passphrase',
passphrase: `\${env.${gpgPassphrase}}`
passphrase: process.env[gpgPassphrase]
};
xmlObj.settings.servers.server.push(gpgServer);
}