Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[email protected] #7

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
os: [macos-latest, windows-latest, ubuntu-latest]

steps:
- uses: actions/checkout@v4
Expand Down
61 changes: 27 additions & 34 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26147,14 +26147,17 @@ exports["default"] = _default;

/***/ }),

/***/ 867:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
/***/ 2409:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {

"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Run = Run;
const core = __nccwpck_require__(2186);
const exec = __nccwpck_require__(1514);
const path = __nccwpck_require__(1017);
const fs = __nccwpck_require__(3292);

const fs = __nccwpck_require__(7147);
async function Run() {
const registry_url = core.getInput('registry-url', { required: true });
let auth_token = core.getInput('auth-token');
Expand All @@ -26171,12 +26174,9 @@ async function Run() {
await validate_auth_token(registry_url, auth_token);
await save_upm_config(registry_url, auth_token);
}

module.exports = { Run };

async function authenticate(registry_url, username, password) {
core.debug('Authenticating...');
const ascii_auth = `${username}:${password}`.toString('ascii');
const ascii_auth = Buffer.from(`${username}:${password}`).toString('ascii');
const base64_auth = Buffer.from(ascii_auth).toString('base64');
core.setSecret(base64_auth);
const payload = {
Expand Down Expand Up @@ -26205,11 +26205,11 @@ async function authenticate(registry_url, username, password) {
const auth_token = response.token;
core.setSecret(auth_token);
return auth_token;
} else {
}
else {
throw new Error(response.error);
}
}

async function validate_auth_token(registry_url, auth_token) {
core.debug('Validating the auth token...');
let output = '';
Expand All @@ -26233,28 +26233,25 @@ async function validate_auth_token(registry_url, auth_token) {
throw new Error(response.error);
}
}

async function save_upm_config(registry_url, auth_token) {
core.debug('Saving .upmconfig.toml...');
const upm_config_toml_path = get_upm_config_toml_path();
try {
await fs.access(upm_config_toml_path);
} catch (error) {
await fs.writeFile(upm_config_toml_path, '');
await fs.promises.access(upm_config_toml_path);
}
catch (error) {
await fs.promises.writeFile(upm_config_toml_path, '');
}
if (process.platform !== 'win32') {
await fs.chmod(upm_config_toml_path, 0o777);
await fs.promises.chmod(upm_config_toml_path, 0o777);
}
const upm_config_toml = await fs.readFile(upm_config_toml_path, 'utf-8');
const upm_config_toml = await fs.promises.readFile(upm_config_toml_path, 'utf-8');
if (!upm_config_toml.includes(registry_url)) {
const alwaysAuth = core.getInput('always-auth') === 'true';
await fs.appendFile(upm_config_toml_path, `registry_url = "${registry_url}"\nauth_token = "${auth_token}"\nalwaysAuth = ${alwaysAuth}\n`);
await fs.promises.appendFile(upm_config_toml_path, `registry_url = "${registry_url}"\nauth_token = "${auth_token}"\nalwaysAuth = ${alwaysAuth}\n`);
}
}

function get_upm_config_toml_path() {
// macOS and Linux '~/.upmconfig.toml'
// winodows '%USERPROFILE%\.upmconfig.toml'
switch (process.platform) {
case 'win32':
return path.join(process.env.USERPROFILE, '.upmconfig.toml');
Expand All @@ -26263,6 +26260,7 @@ function get_upm_config_toml_path() {
}
}


/***/ }),

/***/ 4978:
Expand Down Expand Up @@ -26345,14 +26343,6 @@ module.exports = require("fs");

/***/ }),

/***/ 3292:
/***/ ((module) => {

"use strict";
module.exports = require("fs/promises");

/***/ }),

/***/ 3685:
/***/ ((module) => {

Expand Down Expand Up @@ -28177,20 +28167,23 @@ module.exports = parseParams
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => {
const core = __nccwpck_require__(2186);
const upm_config = __nccwpck_require__(867);
"use strict";
var exports = __webpack_exports__;

Object.defineProperty(exports, "__esModule", ({ value: true }));
const core = __nccwpck_require__(2186);
const upm_config = __nccwpck_require__(2409);
const main = async () => {
try {
await upm_config.Run();
} catch (error) {
}
catch (error) {
core.setFailed(error);
process.exit(1);
}
}

};
main();

})();
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

Loading