@@ -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})();
3453434534Object.defineProperty(exports, "__esModule", ({ value: true }));
34535- exports.readConfig = void 0;
34535+ exports.readRemoteConfig = exports. readConfig = void 0;
3453634536const config_1 = __nccwpck_require__(7899);
3453734537const yaml = __importStar(__nccwpck_require__(4281));
3453834538const filesystem_1 = __nccwpck_require__(9742);
3453934539const 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};
3454834551exports.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})();
3459134613Object.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;
3459334615const fs = __importStar(__nccwpck_require__(3024));
34616+ const core_1 = __nccwpck_require__(7484);
3459434617const cwd = () => {
3459534618 const path = process.env.GITHUB_WORKSPACE;
3459634619 if (path === undefined) {
@@ -34602,6 +34625,15 @@ exports.cwd = cwd;
3460234625const filePath = (config, filename) => `${config.directory}/${filename}`;
3460334626const fileExists = (config, filename) => fs.existsSync(filePath(config, filename));
3460434627exports.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;
3460534637const 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