Skip to content

Commit 9b5a0c6

Browse files
committed
Merge remote-tracking branch 'origin/master' into beta
2 parents c128fc6 + 71961af commit 9b5a0c6

File tree

7 files changed

+116
-43
lines changed

7 files changed

+116
-43
lines changed

lib/fail.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,16 @@ export default async (pluginConfig, context) => {
2424
labels,
2525
assignee,
2626
retryLimit,
27+
retryStatusCodes,
2728
} = resolveConfig(pluginConfig, context);
2829
const { encodedProjectPath, projectApiUrl } = getProjectContext(context, gitlabUrl, gitlabApiUrl, repositoryUrl);
2930

3031
const apiOptions = {
3132
headers: { "PRIVATE-TOKEN": gitlabToken },
32-
retry: { limit: retryLimit },
33+
retry: {
34+
limit: retryLimit,
35+
statusCodes: retryStatusCodes,
36+
},
3337
};
3438

3539
if (failComment === false || failTitle === false) {

lib/publish.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,17 @@ export default async (pluginConfig, context) => {
2222
nextRelease: { gitTag, gitHead, notes, version },
2323
logger,
2424
} = context;
25-
const { gitlabToken, gitlabUrl, gitlabApiUrl, assets, milestones, proxy, retryLimit, publishToCatalog } =
26-
resolveConfig(pluginConfig, context);
25+
const {
26+
gitlabToken,
27+
gitlabUrl,
28+
gitlabApiUrl,
29+
assets,
30+
milestones,
31+
proxy,
32+
retryLimit,
33+
retryStatusCodes,
34+
publishToCatalog,
35+
} = resolveConfig(pluginConfig, context);
2736
const assetsList = [];
2837
const { projectPath, projectApiUrl } = getProjectContext(context, gitlabUrl, gitlabApiUrl, repositoryUrl);
2938

@@ -45,7 +54,7 @@ export default async (pluginConfig, context) => {
4554
},
4655
],
4756
},
48-
retry: { limit: retryLimit },
57+
retry: { limit: retryLimit, statusCodes: retryStatusCodes },
4958
};
5059

5160
debug("projectPath: %o", projectPath);

lib/resolve-config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ export default (
3737
}
3838
) => {
3939
const DEFAULT_RETRY_LIMIT = 3;
40+
// Added 422 to fix #839
41+
// https://github.com/sindresorhus/got/blob/a359bd385129d2adbc765b52dfbbadac5f54a825/documentation/7-retry.md#retry
42+
const DEFAULT_RETRY_STATUS_CODES = [408, 413, 422, 429, 500, 502, 503, 504, 521, 522, 524];
4043
const userGitlabApiPathPrefix = isNil(gitlabApiPathPrefix)
4144
? isNil(GL_PREFIX)
4245
? GITLAB_PREFIX
@@ -68,6 +71,7 @@ export default (
6871
labels: isNil(labels) ? "semantic-release" : labels === false ? false : labels,
6972
assignee,
7073
retryLimit: retryLimit ?? DEFAULT_RETRY_LIMIT,
74+
retryStatusCodes: DEFAULT_RETRY_STATUS_CODES,
7175
publishToCatalog: publishToCatalog ?? false,
7276
};
7377
};

lib/success.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,20 @@ export default async (pluginConfig, context) => {
1515
commits,
1616
releases,
1717
} = context;
18-
const { gitlabToken, gitlabUrl, gitlabApiUrl, successComment, successCommentCondition, proxy, retryLimit } =
19-
resolveConfig(pluginConfig, context);
18+
const {
19+
gitlabToken,
20+
gitlabUrl,
21+
gitlabApiUrl,
22+
successComment,
23+
successCommentCondition,
24+
proxy,
25+
retryLimit,
26+
retryStatusCodes,
27+
} = resolveConfig(pluginConfig, context);
2028
const { projectApiUrl } = getProjectContext(context, gitlabUrl, gitlabApiUrl, repositoryUrl);
2129
const apiOptions = {
2230
headers: { "PRIVATE-TOKEN": gitlabToken },
23-
retry: { limit: retryLimit },
31+
retry: { limit: retryLimit, statusCodes: retryStatusCodes },
2432
};
2533

2634
if (successComment === false) {

package-lock.json

Lines changed: 81 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333
"url-join": "^4.0.0"
3434
},
3535
"devDependencies": {
36-
"ava": "6.2.0",
36+
"ava": "6.3.0",
3737
"c8": "10.1.3",
3838
"nock": "14.0.2",
3939
"prettier": "3.5.3",
40-
"semantic-release": "24.2.3",
40+
"semantic-release": "24.2.4",
4141
"sinon": "20.0.0",
4242
"tempy": "1.0.1",
4343
"testdouble": "^3.20.2"

test/resolve-config.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const defaultOptions = {
1818
assignee: undefined,
1919
proxy: {},
2020
retryLimit: 3,
21+
retryStatusCodes: [408, 413, 422, 429, 500, 502, 503, 504, 521, 522, 524],
2122
publishToCatalog: false,
2223
};
2324

0 commit comments

Comments
 (0)