From 4550db3c89dddf3c31c7f4e5e86215ee8a8217e2 Mon Sep 17 00:00:00 2001 From: Tingluo Huang Date: Wed, 29 Apr 2026 10:44:26 -0400 Subject: [PATCH] Not retry and report action download 403. (#4391) --- src/Runner.Worker/ActionManager.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Runner.Worker/ActionManager.cs b/src/Runner.Worker/ActionManager.cs index 685240b92..133129a01 100644 --- a/src/Runner.Worker/ActionManager.cs +++ b/src/Runner.Worker/ActionManager.cs @@ -1446,6 +1446,11 @@ namespace GitHub.Runner.Worker // It doesn't make sense to retry in this case, so just stop throw new ActionNotFoundException(new Uri(downloadUrl), requestId); } + else if (response.StatusCode == HttpStatusCode.Forbidden) + { + // It doesn't make sense to retry in this case, so just stop + throw new AccessDeniedException($"Access denied to '{downloadUrl}' ({requestId})"); + } else { // Something else bad happened, let's go to our retry logic @@ -1469,6 +1474,11 @@ namespace GitHub.Runner.Worker Trace.Info($"The action at '{downloadUrl}' does not exist"); throw; } + catch (AccessDeniedException) + { + Trace.Info($"Access denied to '{downloadUrl}'"); + throw; + } catch (Exception ex) when (retryCount < 2) { retryCount++; @@ -1494,7 +1504,7 @@ namespace GitHub.Runner.Worker } } } - catch (Exception ex) when (!(ex is OperationCanceledException) && !executionContext.CancellationToken.IsCancellationRequested) + catch (Exception ex) when (!(ex is AccessDeniedException) && !(ex is OperationCanceledException) && !executionContext.CancellationToken.IsCancellationRequested) { Trace.Error($"Failed to download archive '{downloadUrl}' after {retryCount + 1} attempts."); Trace.Error(ex);