Skip to content

Commit d3a509a

Browse files
committed
feat(chocolatey): enhance error handling for package submission and add pending review check release:patch
1 parent 7f81d30 commit d3a509a

2 files changed

Lines changed: 48 additions & 7 deletions

File tree

.claude/settings.local.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,9 @@
217217
"Bash(gh pr close:*)",
218218
"Bash(for pr in 333835 333887 333888 333890)",
219219
"Bash(do)",
220-
"Bash(done)"
220+
"Bash(done)",
221+
"Bash(pnpm lint-staged:*)",
222+
"Bash(npx lint-staged)"
221223
],
222224
"deny": [
223225
"Bash(npm *)",

scripts/lib/package-managers/chocolatey.ts

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,51 @@ https://github.com/profullstack/pairux.com
265265
cwd: tempDir,
266266
stdio: 'pipe',
267267
});
268-
} catch {
269-
// Try nuget push as fallback
270-
execSync(`nuget push ${nupkgFile} -Source ${CHOCOLATEY_API_URL} -ApiKey ${apiKey}`, {
271-
cwd: tempDir,
272-
stdio: 'pipe',
273-
});
268+
} catch (chocoError) {
269+
const errorMessage = chocoError instanceof Error ? chocoError.message : String(chocoError);
270+
271+
// Check if this is a pending submission error (403)
272+
if (
273+
errorMessage.includes('previous version in a submitted state') ||
274+
errorMessage.includes('403')
275+
) {
276+
const packageUrl = `https://community.chocolatey.org/packages/${PACKAGE_ID}`;
277+
this.logger.success(`Previous version pending review: ${packageUrl}`);
278+
return {
279+
packageManager: this.name,
280+
status: 'success',
281+
message: `Previous version pending review on Chocolatey: ${packageUrl}`,
282+
url: packageUrl,
283+
};
284+
}
285+
286+
// Try nuget push as fallback for other errors
287+
try {
288+
execSync(`nuget push ${nupkgFile} -Source ${CHOCOLATEY_API_URL} -ApiKey ${apiKey}`, {
289+
cwd: tempDir,
290+
stdio: 'pipe',
291+
});
292+
} catch (nugetError) {
293+
const nugetErrorMessage =
294+
nugetError instanceof Error ? nugetError.message : String(nugetError);
295+
296+
// Also check nuget error for pending submission
297+
if (
298+
nugetErrorMessage.includes('previous version in a submitted state') ||
299+
nugetErrorMessage.includes('403')
300+
) {
301+
const packageUrl = `https://community.chocolatey.org/packages/${PACKAGE_ID}`;
302+
this.logger.success(`Previous version pending review: ${packageUrl}`);
303+
return {
304+
packageManager: this.name,
305+
status: 'success',
306+
message: `Previous version pending review on Chocolatey: ${packageUrl}`,
307+
url: packageUrl,
308+
};
309+
}
310+
311+
throw nugetError;
312+
}
274313
}
275314

276315
this.logger.success(`Pushed ${PACKAGE_ID} ${release.version} to Chocolatey`);

0 commit comments

Comments
 (0)