From 0a5b9b4c85cc891d26eecbff129e2c4b0ef3fbf3 Mon Sep 17 00:00:00 2001 From: Pranav Singh Date: Wed, 25 Dec 2024 17:34:46 +0530 Subject: [PATCH 1/2] Update kanvas.yaml Signed-off-by: Pranav Singh --- .github/workflows/kanvas.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/kanvas.yaml b/.github/workflows/kanvas.yaml index 83030531aa..4f241255f2 100644 --- a/.github/workflows/kanvas.yaml +++ b/.github/workflows/kanvas.yaml @@ -1,10 +1,5 @@ name: Kanvas Screenshot Service 'on': - pull_request: - types: - - opened - - synchronize - - reopened workflow_dispatch: inputs: contentID: From fd1dbba68643ab5a485d97af54bc3a8ad13feca4 Mon Sep 17 00:00:00 2001 From: Pranav Singh Date: Wed, 25 Dec 2024 17:36:11 +0530 Subject: [PATCH 2/2] add debug logs Signed-off-by: Pranav Singh --- cmd/kanvas-snapshot/cmd.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cmd/kanvas-snapshot/cmd.go b/cmd/kanvas-snapshot/cmd.go index a22f36bbc7..d795db0e4a 100644 --- a/cmd/kanvas-snapshot/cmd.go +++ b/cmd/kanvas-snapshot/cmd.go @@ -208,6 +208,7 @@ func CreateMesheryDesign(uri, name, email string) (string, error) { func GenerateSnapshot(contentID, assetLocation string, ghAccessToken string) error { payload := fmt.Sprintf(`{"ref":"master","inputs":{"contentID":"%s","assetLocation":"%s"}}`, contentID, assetLocation) req, err := http.NewRequest("POST", "https://api.github.com/repos/meshery/helm-kanvas-snapshot/actions/workflows/kanvas.yml/dispatches", bytes.NewBuffer([]byte(payload))) + fmt.Println(err) if err != nil { return err } @@ -217,11 +218,24 @@ func GenerateSnapshot(contentID, assetLocation string, ghAccessToken string) err client := &http.Client{} resp, err := client.Do(req) + fmt.Println(err) if err != nil { return err } defer resp.Body.Close() + // read response + + // Decode response + var result map[string]interface{} + err = json.NewDecoder(resp.Body).Decode(&result) + if err != nil { + body, _ := io.ReadAll(resp.Body) + return errors.ErrDecodingAPI(fmt.Errorf("failed to decode json. body: %s, error: %w", body, err)) + } + + fmt.Printf("%#v\n", result) + return nil }