From a2ab7cca75d48fc2a808ac315fb3953148fa648b Mon Sep 17 00:00:00 2001 From: Brice Messeca Date: Tue, 24 Mar 2026 09:37:04 +0100 Subject: [PATCH] fix: handle 404 status when deleting release branch in protected-branch plugin The catch block for deleteRef only handled status 422 for "Reference does not exist", but GitHub API may also return 404. This causes intermittent release failures when the branch has already been deleted (e.g. by GitHub's auto-delete on merge). Co-Authored-By: Claude Opus 4.6 (1M context) --- plugins/protected-branch/src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/protected-branch/src/index.ts b/plugins/protected-branch/src/index.ts index e5d0a16dd..ff4b215c5 100644 --- a/plugins/protected-branch/src/index.ts +++ b/plugins/protected-branch/src/index.ts @@ -121,7 +121,8 @@ export default class ProtectedBranchPlugin implements IPlugin { }); } catch (e) { // Silently ignore reference not found error since the ref might already be deleted - if (!e || e.status !== 422 || e.message !== "Reference does not exist") { + // GitHub API may return either 422 or 404 for non-existent references + if (!e || (e.status !== 422 && e.status !== 404) || e.message !== "Reference does not exist") { throw e; } }