diff --git a/CHANGELOG.md b/CHANGELOG.md index 587fefa0..e90df7d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## [v1.17.6] - 2022-03-07 + +[Release notes](https://github.com/betahuhn/repo-file-sync-action/releases/tag/v1.17.6) · [Compare](https://github.com/betahuhn/repo-file-sync-action/compare/v1.17.5...v1.17.6) · [Tag](https://github.com/betahuhn/repo-file-sync-action/tree/v1.17.6) · Archive ([zip](https://github.com/betahuhn/repo-file-sync-action/archive/v1.17.6.zip) · [tar.gz](https://github.com/betahuhn/repo-file-sync-action/archive/v1.17.6.tar.gz)) + +### Dependency updates + +- [`36cbece`](https://github.com/betahuhn/repo-file-sync-action/commit/36cbece) Bump @octokit/plugin-throttling from 3.5.2 to 3.6.1 + ## [v1.17.5] - 2022-02-28 [Release notes](https://github.com/betahuhn/repo-file-sync-action/releases/tag/v1.17.5) · [Compare](https://github.com/betahuhn/repo-file-sync-action/compare/v1.17.4...v1.17.5) · [Tag](https://github.com/betahuhn/repo-file-sync-action/tree/v1.17.5) · Archive ([zip](https://github.com/betahuhn/repo-file-sync-action/archive/v1.17.5.zip) · [tar.gz](https://github.com/betahuhn/repo-file-sync-action/archive/v1.17.5.tar.gz)) diff --git a/dist/index.js b/dist/index.js index 7ffc1d28..a881c51a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3994,7 +3994,7 @@ function _defineProperty(obj, key, value) { return obj; } -const VERSION = "3.5.2"; +const VERSION = "3.6.1"; const noop = () => Promise.resolve(); // @ts-ignore @@ -4145,21 +4145,21 @@ function throttling(octokit, octokitOptions = {}) { const state = Object.assign(_objectSpread2({ clustering: connection != null, triggersNotification, - minimumAbuseRetryAfter: 5, + minimumSecondaryRateRetryAfter: 5, retryAfterBaseValue: 1000, retryLimiter: new Bottleneck(), id }, groups), // @ts-ignore octokitOptions.throttle); - if (typeof state.onAbuseLimit !== "function" || typeof state.onRateLimit !== "function") { + if (typeof state.onSecondaryRateLimit !== "function" && typeof state.onAbuseLimit !== "function" || typeof state.onRateLimit !== "function") { throw new Error(`octokit/plugin-throttling error: - You must pass the onAbuseLimit and onRateLimit error handlers. + You must pass the onSecondaryRateLimit and onRateLimit error handlers. See https://github.com/octokit/rest.js#throttling const octokit = new Octokit({ throttle: { - onAbuseLimit: (retryAfter, options) => {/* ... */}, + onSecondaryRateLimit: (retryAfter, options) => {/* ... */}, onRateLimit: (retryAfter, options) => {/* ... */} } }) @@ -4169,11 +4169,14 @@ function throttling(octokit, octokitOptions = {}) { const events = {}; const emitter = new Bottleneck.Events(events); // @ts-ignore - events.on("abuse-limit", state.onAbuseLimit); // @ts-ignore + events.on("secondary-limit", state.onSecondaryRateLimit || function (...args) { + octokit.log.warn("[@octokit/plugin-throttling] `onAbuseLimit()` is deprecated and will be removed in a future release of `@octokit/plugin-throttling`, please use the `onSecondaryRateLimit` handler instead"); + return state.onAbuseLimit(...args); + }); // @ts-ignore events.on("rate-limit", state.onRateLimit); // @ts-ignore - events.on("error", e => console.warn("Error in throttling-plugin limit handler", e)); // @ts-ignore + events.on("error", e => octokit.log.warn("Error in throttling-plugin limit handler", e)); // @ts-ignore state.retryLimiter.on("failed", async function (error, info) { const options = info.args[info.args.length - 1]; @@ -4193,12 +4196,12 @@ function throttling(octokit, octokitOptions = {}) { retryAfter } = await async function () { if (/\bsecondary rate\b/i.test(error.message)) { - // The user has hit the abuse rate limit. (REST and GraphQL) - // https://docs.github.com/en/rest/overview/resources-in-the-rest-api#abuse-rate-limits - // The Retry-After header can sometimes be blank when hitting an abuse limit, + // The user has hit the secondary rate limit. (REST and GraphQL) + // https://docs.github.com/en/rest/overview/resources-in-the-rest-api#secondary-rate-limits + // The Retry-After header can sometimes be blank when hitting a secondary rate limit, // but is always present after 2-3s, so make sure to set `retryAfter` to at least 5s by default. - const retryAfter = Math.max(~~error.response.headers["retry-after"], state.minimumAbuseRetryAfter); - const wantRetry = await emitter.trigger("abuse-limit", retryAfter, options, octokit); + const retryAfter = Math.max(~~error.response.headers["retry-after"], state.minimumSecondaryRateRetryAfter); + const wantRetry = await emitter.trigger("secondary-limit", retryAfter, options, octokit); return { wantRetry, retryAfter diff --git a/package-lock.json b/package-lock.json index c804b3c8..02de1774 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "repo-file-sync-action", - "version": "1.17.5", + "version": "1.17.6", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index faeebc4c..07a23449 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "repo-file-sync-action", - "version": "1.17.5", + "version": "1.17.6", "description": "GitHub Action to keep files like Action workflows or entire directories in sync between multiple repositories.", "main": "dist/index.js", "scripts": {