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:
Stephen Way 2025-10-03 11:34:31 -07:00 committed by GitHub
parent 0f0e0b98e9
commit 7dc9b8ac0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 92 additions and 4 deletions

View file

@ -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)`);