mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-10-10 18:41:39 +00:00
fix(action): handle 422 already_exists race condition (#665)
- Add retry logic for 422 'already_exists' errors in race conditions - Allow action to find and update existing releases instead of failing - Add test to verify race condition handling works correctly - Fixes regression that broke matrix workflows in v2.2.2+ closes #616
This commit is contained in:
@@ -388,8 +388,18 @@ async function createRelease(
|
||||
throw error;
|
||||
|
||||
case 422:
|
||||
console.log('Skip retry - validation failed');
|
||||
throw error;
|
||||
// Check if this is a race condition with "already_exists" error
|
||||
const errorData = error.response?.data;
|
||||
if (errorData?.errors?.[0]?.code === 'already_exists') {
|
||||
console.log(
|
||||
'⚠️ Release already exists (race condition detected), retrying to find and update existing release...',
|
||||
);
|
||||
// Don't throw - allow retry to find existing release
|
||||
} else {
|
||||
console.log('Skip retry - validation failed');
|
||||
throw error;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
console.log(`retrying... (${maxRetries - 1} retries remaining)`);
|
||||
|
Reference in New Issue
Block a user