From 8918cf6815ccabb786352e8eda5ca01f62c1a655 Mon Sep 17 00:00:00 2001 From: chemotaxis Date: Tue, 12 Apr 2022 04:59:50 -0400 Subject: [PATCH] Skip unlock api call if already unlocked --- pkg/cmd/issue/lock/lock.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/cmd/issue/lock/lock.go b/pkg/cmd/issue/lock/lock.go index 76bcb4668..304089d9b 100644 --- a/pkg/cmd/issue/lock/lock.go +++ b/pkg/cmd/issue/lock/lock.go @@ -202,6 +202,13 @@ func padlock(state string, opts *LockOptions) error { case Lock: err = lockLockable(httpClient, baseRepo, issuePr, opts) case Unlock: + // if already unlocked, skip the api call to unlock + if !issuePr.Locked { + successMsg = fmt.Sprintf("%s #%d already unlocked. Nothing changed.\n", + parent.FullName, issuePr.Number) + break + } + err = unlockLockable(httpClient, baseRepo, issuePr, opts) case Relock: relocked, errRelock := relockLockable(httpClient, baseRepo, issuePr, opts)