Przeglądaj źródła

Do not keep retrying checking for porter.yaml if response has status code forbidden (#3657)

Co-authored-by: Jose Diaz-Gonzalez <jose@porter.run>
Feroze Mohideen 2 lat temu
rodzic
commit
cf7f9f9862
2 zmienionych plików z 12 dodań i 12 usunięć
  1. 0 1
      dashboard/.gitignore
  2. 12 11
      dashboard/src/lib/hooks/usePorterYaml.ts

+ 0 - 1
dashboard/.gitignore

@@ -1,5 +1,4 @@
 # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
-
 .env
 
 # dependencies

+ 12 - 11
dashboard/src/lib/hooks/usePorterYaml.ts

@@ -9,17 +9,17 @@ import { z } from "zod";
 
 type PorterYamlStatus =
   | {
-      loading: true;
-      detectedName: null;
-      detectedServices: null;
-      porterYamlFound: false;
-    }
+    loading: true;
+    detectedName: null;
+    detectedServices: null;
+    porterYamlFound: false;
+  }
   | {
-      detectedServices: DetectedServices | null;
-      detectedName: string | null;
-      loading: false;
-      porterYamlFound: boolean;
-    };
+    detectedServices: DetectedServices | null;
+    detectedName: string | null;
+    loading: false;
+    porterYamlFound: boolean;
+  };
 
 /*
  *
@@ -83,7 +83,8 @@ export const usePorterYaml = ({
         Boolean(source.git_branch),
       retry: (_failureCount, error) => {
         if (
-          error.response.data?.error?.includes("404") ||
+          // error response will be 403 status if user does not have access to the github installation
+          error.response?.status === 404 || error.response?.status === 403 ||
           error.response.data?.error?.includes("not found")
         ) {
           setPorterYamlFound(false);