Skip to content

Commit 95bfe45

Browse files
Merge pull request #55 from TheDragonCode/build/app-juhpb8z
Application compiled successfully
2 parents 9588b72 + 3623a7e commit 95bfe45

1 file changed

Lines changed: 46 additions & 6 deletions

File tree

dist/index.js

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34388,7 +34388,7 @@ const previewUpdater = async () => {
3438834388
// Inputs
3438934389
const { token, configPath } = (0, inputs_1.parse)();
3439034390
// Load Config
34391-
const config = (0, config_1.readConfig)({
34391+
const config = await (0, config_1.readConfig)({
3439234392
directory: (0, filesystem_1.cwd)(),
3439334393
repository: {
3439434394
owner: github_1.context.repo.owner,
@@ -34532,20 +34532,42 @@ var __importStar = (this && this.__importStar) || (function () {
3453234532
};
3453334533
})();
3453434534
Object.defineProperty(exports, "__esModule", ({ value: true }));
34535-
exports.readConfig = void 0;
34535+
exports.readRemoteConfig = exports.readConfig = void 0;
3453634536
const config_1 = __nccwpck_require__(7899);
3453734537
const yaml = __importStar(__nccwpck_require__(4281));
3453834538
const filesystem_1 = __nccwpck_require__(9742);
3453934539
const merge_1 = __nccwpck_require__(2221);
34540-
const readConfig = (config, userConfigPath) => {
34540+
const core_1 = __nccwpck_require__(7484);
34541+
const url = __importStar(__nccwpck_require__(3136));
34542+
const readConfig = async (config, userConfigPath) => {
3454134543
const content = (0, filesystem_1.readFile)(config, userConfigPath);
34544+
const remoteConfig = await (0, exports.readRemoteConfig)(config.repository?.owner, userConfigPath);
3454234545
if (content === "") {
34543-
return (0, merge_1.merge)(config_1.defaultConfig, config);
34546+
return (0, merge_1.merge)(config_1.defaultConfig, remoteConfig, config);
3454434547
}
3454534548
const userConfig = yaml.load(content);
34546-
return (0, merge_1.merge)(config_1.defaultConfig, userConfig, config);
34549+
return (0, merge_1.merge)(config_1.defaultConfig, remoteConfig, userConfig, config);
3454734550
};
3454834551
exports.readConfig = readConfig;
34552+
const readRemoteConfig = async (owner, filename) => {
34553+
try {
34554+
if (owner === undefined) {
34555+
return {};
34556+
}
34557+
const url = `https://raw.githubusercontent.com/${owner}/.github/refs/heads/main/${filename}`;
34558+
const data = await (0, filesystem_1.readRemoteFile)(url);
34559+
if (data === "") {
34560+
return {};
34561+
}
34562+
return yaml.load(data);
34563+
}
34564+
catch (error) {
34565+
// @ts-expect-error
34566+
(0, core_1.info)(`Failed to fetch remote config from ${url}: ${error.message}`);
34567+
return {};
34568+
}
34569+
};
34570+
exports.readRemoteConfig = readRemoteConfig;
3454934571

3455034572

3455134573
/***/ }),
@@ -34589,8 +34611,9 @@ var __importStar = (this && this.__importStar) || (function () {
3458934611
};
3459034612
})();
3459134613
Object.defineProperty(exports, "__esModule", ({ value: true }));
34592-
exports.writeFile = exports.readFile = exports.fileExists = exports.cwd = void 0;
34614+
exports.writeFile = exports.readFile = exports.readRemoteFile = exports.fileExists = exports.cwd = void 0;
3459334615
const fs = __importStar(__nccwpck_require__(3024));
34616+
const core_1 = __nccwpck_require__(7484);
3459434617
const cwd = () => {
3459534618
const path = process.env.GITHUB_WORKSPACE;
3459634619
if (path === undefined) {
@@ -34602,6 +34625,15 @@ exports.cwd = cwd;
3460234625
const filePath = (config, filename) => `${config.directory}/${filename}`;
3460334626
const fileExists = (config, filename) => fs.existsSync(filePath(config, filename));
3460434627
exports.fileExists = fileExists;
34628+
const readRemoteFile = async (url) => {
34629+
const response = await fetch(url);
34630+
if (!response.ok) {
34631+
(0, core_1.info)(`Failed to fetch ${url} with status code ${response.status}`);
34632+
return "";
34633+
}
34634+
return response.text();
34635+
};
34636+
exports.readRemoteFile = readRemoteFile;
3460534637
const readFile = (config, filename) => {
3460634638
if (!fs.existsSync(filePath(config, filename))) {
3460734639
return "";
@@ -35217,6 +35249,14 @@ module.exports = require("node:stream");
3521735249

3521835250
/***/ }),
3521935251

35252+
/***/ 3136:
35253+
/***/ ((module) => {
35254+
35255+
"use strict";
35256+
module.exports = require("node:url");
35257+
35258+
/***/ }),
35259+
3522035260
/***/ 7975:
3522135261
/***/ ((module) => {
3522235262

0 commit comments

Comments
 (0)