mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-10-09 08:56:12 +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:
parent
0f0e0b98e9
commit
7dc9b8ac0f
3 changed files with 92 additions and 4 deletions
|
@ -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)`);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue