@@ -29237,8 +29237,10 @@ async function run() {
2923729237 }
2923829238 const octokit = (0, util_1.getOctokit)();
2923929239 const { addresses } = (0, util_1.generateTokens)(commentBody);
29240+ core.notice(`geocoding ${addresses.length} addresses`);
2924029241 const results = await (0, geocode_1.geocode)(addresses, core.getInput('API_KEY'));
29241- core.notice('updating comments');
29242+ core.debug(`results: ${JSON.stringify(results)}`);
29243+ core.notice('geocoding complete, updating comment');
2924229244 await octokit.rest.issues.updateComment({
2924329245 owner: context.repo.owner,
2924429246 repo: context.repo.repo,
@@ -31173,30 +31175,15 @@ __nccwpck_require__.d(__webpack_exports__, {
3117331175;// CONCATENATED MODULE: ./node_modules/ky/distribution/errors/HTTPError.js
3117431176// eslint-lint-disable-next-line @typescript-eslint/naming-convention
3117531177class HTTPError extends Error {
31178+ response;
31179+ request;
31180+ options;
3117631181 constructor(response, request, options) {
3117731182 const code = (response.status || response.status === 0) ? response.status : '';
3117831183 const title = response.statusText || '';
3117931184 const status = `${code} ${title}`.trim();
3118031185 const reason = status ? `status code ${status}` : 'an unknown error';
3118131186 super(`Request failed with ${reason}: ${request.method} ${request.url}`);
31182- Object.defineProperty(this, "response", {
31183- enumerable: true,
31184- configurable: true,
31185- writable: true,
31186- value: void 0
31187- });
31188- Object.defineProperty(this, "request", {
31189- enumerable: true,
31190- configurable: true,
31191- writable: true,
31192- value: void 0
31193- });
31194- Object.defineProperty(this, "options", {
31195- enumerable: true,
31196- configurable: true,
31197- writable: true,
31198- value: void 0
31199- });
3120031187 this.name = 'HTTPError';
3120131188 this.response = response;
3120231189 this.request = request;
@@ -31206,14 +31193,9 @@ class HTTPError extends Error {
3120631193//# sourceMappingURL=HTTPError.js.map
3120731194;// CONCATENATED MODULE: ./node_modules/ky/distribution/errors/TimeoutError.js
3120831195class TimeoutError extends Error {
31196+ request;
3120931197 constructor(request) {
3121031198 super(`Request timed out: ${request.method} ${request.url}`);
31211- Object.defineProperty(this, "request", {
31212- enumerable: true,
31213- configurable: true,
31214- writable: true,
31215- value: void 0
31216- });
3121731199 this.name = 'TimeoutError';
3121831200 this.request = request;
3121931201 }
@@ -31247,10 +31229,22 @@ const mergeHeaders = (source1 = {}, source2 = {}) => {
3124731229 }
3124831230 return result;
3124931231};
31232+ function newHookValue(original, incoming, property) {
31233+ return (Object.hasOwn(incoming, property) && incoming[property] === undefined)
31234+ ? []
31235+ : deepMerge(original[property] ?? [], incoming[property] ?? []);
31236+ }
31237+ const mergeHooks = (original = {}, incoming = {}) => ({
31238+ beforeRequest: newHookValue(original, incoming, 'beforeRequest'),
31239+ beforeRetry: newHookValue(original, incoming, 'beforeRetry'),
31240+ afterResponse: newHookValue(original, incoming, 'afterResponse'),
31241+ beforeError: newHookValue(original, incoming, 'beforeError'),
31242+ });
3125031243// TODO: Make this strongly-typed (no `any`).
3125131244const deepMerge = (...sources) => {
3125231245 let returnValue = {};
3125331246 let headers = {};
31247+ let hooks = {};
3125431248 for (const source of sources) {
3125531249 if (Array.isArray(source)) {
3125631250 if (!Array.isArray(returnValue)) {
@@ -31265,6 +31259,10 @@ const deepMerge = (...sources) => {
3126531259 }
3126631260 returnValue = { ...returnValue, [key]: value };
3126731261 }
31262+ if (isObject(source.hooks)) {
31263+ hooks = mergeHooks(hooks, source.hooks);
31264+ returnValue.hooks = hooks;
31265+ }
3126831266 if (isObject(source.headers)) {
3126931267 headers = mergeHeaders(headers, source.headers);
3127031268 returnValue.headers = headers;
@@ -31381,7 +31379,6 @@ const normalizeRetryOptions = (retry = {}) => {
3138131379 return {
3138231380 ...defaultRetryOptions,
3138331381 ...retry,
31384- afterStatusCodes: retryAfterStatusCodes,
3138531382 };
3138631383};
3138731384//# sourceMappingURL=normalize.js.map
@@ -31511,47 +31508,18 @@ class Ky {
3151131508 }
3151231509 return result;
3151331510 }
31511+ request;
31512+ abortController;
31513+ _retryCount = 0;
31514+ _input;
31515+ _options;
3151431516 // eslint-disable-next-line complexity
3151531517 constructor(input, options = {}) {
31516- Object.defineProperty(this, "request", {
31517- enumerable: true,
31518- configurable: true,
31519- writable: true,
31520- value: void 0
31521- });
31522- Object.defineProperty(this, "abortController", {
31523- enumerable: true,
31524- configurable: true,
31525- writable: true,
31526- value: void 0
31527- });
31528- Object.defineProperty(this, "_retryCount", {
31529- enumerable: true,
31530- configurable: true,
31531- writable: true,
31532- value: 0
31533- });
31534- Object.defineProperty(this, "_input", {
31535- enumerable: true,
31536- configurable: true,
31537- writable: true,
31538- value: void 0
31539- });
31540- Object.defineProperty(this, "_options", {
31541- enumerable: true,
31542- configurable: true,
31543- writable: true,
31544- value: void 0
31545- });
3154631518 this._input = input;
31547- const credentials = this._input instanceof Request && 'credentials' in Request.prototype
31548- ? this._input.credentials
31549- : undefined;
3155031519 this._options = {
31551- ...(credentials && { credentials }), // For exactOptionalPropertyTypes
3155231520 ...options,
3155331521 headers: mergeHeaders(this._input.headers, options.headers),
31554- hooks: deepMerge ({
31522+ hooks: mergeHooks ({
3155531523 beforeRequest: [],
3155631524 beforeRetry: [],
3155731525 beforeError: [],
@@ -31579,12 +31547,10 @@ class Ky {
3157931547 }
3158031548 if (supportsAbortController) {
3158131549 this.abortController = new globalThis.AbortController();
31582- if (this._options.signal) {
31583- const originalSignal = this._options.signal;
31584- this._options.signal.addEventListener('abort', () => {
31585- this.abortController.abort(originalSignal.reason);
31586- });
31587- }
31550+ const originalSignal = this._options.signal ?? this._input.signal;
31551+ originalSignal?.addEventListener('abort', () => {
31552+ this.abortController.abort(originalSignal.reason);
31553+ });
3158831554 this._options.signal = this.abortController.signal;
3158931555 }
3159031556 if (supportsRequestStreams) {
@@ -31615,28 +31581,35 @@ class Ky {
3161531581 }
3161631582 _calculateRetryDelay(error) {
3161731583 this._retryCount++;
31618- if (this._retryCount <= this._options.retry.limit && !(error instanceof TimeoutError)) {
31619- if (error instanceof HTTPError) {
31620- if (!this._options.retry.statusCodes.includes(error.response.status)) {
31621- return 0;
31622- }
31623- const retryAfter = error.response.headers.get('Retry-After');
31624- if (retryAfter && this._options.retry.afterStatusCodes.includes(error.response.status)) {
31625- let after = Number(retryAfter) * 1000;
31626- if (Number.isNaN(after)) {
31627- after = Date.parse(retryAfter) - Date.now();
31628- }
31629- const max = this._options.retry.maxRetryAfter ?? after;
31630- return after < max ? after : max;
31584+ if (this._retryCount > this._options.retry.limit || error instanceof TimeoutError) {
31585+ throw error;
31586+ }
31587+ if (error instanceof HTTPError) {
31588+ if (!this._options.retry.statusCodes.includes(error.response.status)) {
31589+ throw error;
31590+ }
31591+ const retryAfter = error.response.headers.get('Retry-After')
31592+ ?? error.response.headers.get('RateLimit-Reset')
31593+ ?? error.response.headers.get('X-RateLimit-Reset') // GitHub
31594+ ?? error.response.headers.get('X-Rate-Limit-Reset'); // Twitter
31595+ if (retryAfter && this._options.retry.afterStatusCodes.includes(error.response.status)) {
31596+ let after = Number(retryAfter) * 1000;
31597+ if (Number.isNaN(after)) {
31598+ after = Date.parse(retryAfter) - Date.now();
3163131599 }
31632- if (error.response.status === 413) {
31633- return 0;
31600+ else if (after >= Date.parse('2024-01-01')) {
31601+ // A large number is treated as a timestamp (fixed threshold protects against clock skew)
31602+ after -= Date.now();
3163431603 }
31604+ const max = this._options.retry.maxRetryAfter ?? after;
31605+ return after < max ? after : max;
31606+ }
31607+ if (error.response.status === 413) {
31608+ throw error;
3163531609 }
31636- const retryDelay = this._options.retry.delay(this._retryCount);
31637- return Math.min(this._options.retry.backoffLimit, retryDelay);
3163831610 }
31639- return 0;
31611+ const retryDelay = this._options.retry.delay(this._retryCount);
31612+ return Math.min(this._options.retry.backoffLimit, retryDelay);
3164031613 }
3164131614 _decorateResponse(response) {
3164231615 if (this._options.parseJson) {
@@ -31650,24 +31623,24 @@ class Ky {
3165031623 }
3165131624 catch (error) {
3165231625 const ms = Math.min(this._calculateRetryDelay(error), maxSafeTimeout);
31653- if (ms !== 0 && this._retryCount > 0) {
31654- await delay(ms, { signal: this._options.signal });
31655- for (const hook of this._options.hooks.beforeRetry) {
31656- // eslint-disable-next-line no-await-in-loop
31657- const hookResult = await hook({
31658- request: this.request,
31659- options: this._options,
31660- error: error,
31661- retryCount: this._retryCount,
31662- });
31663- // If `stop` is returned from the hook, the retry process is stopped
31664- if (hookResult === stop) {
31665- return;
31666- }
31626+ if (this._retryCount < 1) {
31627+ throw error;
31628+ }
31629+ await delay(ms, { signal: this._options.signal });
31630+ for (const hook of this._options.hooks.beforeRetry) {
31631+ // eslint-disable-next-line no-await-in-loop
31632+ const hookResult = await hook({
31633+ request: this.request,
31634+ options: this._options,
31635+ error: error,
31636+ retryCount: this._retryCount,
31637+ });
31638+ // If `stop` is returned from the hook, the retry process is stopped
31639+ if (hookResult === stop) {
31640+ return;
3166731641 }
31668- return this._retry(function_);
3166931642 }
31670- throw error ;
31643+ return this._retry(function_) ;
3167131644 }
3167231645 }
3167331646 async _fetch() {
@@ -31748,7 +31721,12 @@ const createInstance = (defaults) => {
3174831721 ky[method] = (input, options) => Ky.create(input, validateAndMerge(defaults, options, { method }));
3174931722 }
3175031723 ky.create = (newDefaults) => createInstance(validateAndMerge(newDefaults));
31751- ky.extend = (newDefaults) => createInstance(validateAndMerge(defaults, newDefaults));
31724+ ky.extend = (newDefaults) => {
31725+ if (typeof newDefaults === 'function') {
31726+ newDefaults = newDefaults(defaults ?? {});
31727+ }
31728+ return createInstance(validateAndMerge(defaults, newDefaults));
31729+ };
3175231730 ky.stop = stop;
3175331731 return ky;
3175431732};
0 commit comments