@@ -78,6 +78,45 @@ func handleIssueCommentEvent(gh utils.GithubClientProvider, payload *github.Issu
78
78
)
79
79
return fmt .Errorf ("error getting github app link" )
80
80
}
81
+ if link == nil {
82
+ slog .Error ("GitHub app installation link not found" ,
83
+ "installationId" , installationId ,
84
+ )
85
+
86
+ // Try to get GitHub service to post error comment
87
+ ghService , _ , ghServiceErr := utils .GetGithubService (gh , installationId , repoFullName , repoOwner , repoName )
88
+ if ghServiceErr != nil {
89
+ slog .Error ("Error getting GitHub service to post error comment" ,
90
+ "installationId" , installationId ,
91
+ "repoFullName" , repoFullName ,
92
+ "error" , ghServiceErr ,
93
+ )
94
+ return fmt .Errorf ("github app installation link not found and could not post error comment" )
95
+ }
96
+
97
+ // Post helpful error message to the user
98
+ errorMsg := ":x: **Digger could not find the GitHub App installation record.**\n \n " +
99
+ "This usually happens when:\n " +
100
+ "• The GitHub App was not installed successfully\n " +
101
+ "• The installation process did not complete the callback to Digger\n " +
102
+ "• There was an issue with the GitHub App installation flow\n \n " +
103
+ "Please ensure that:\n " +
104
+ "1. The GitHub App is properly installed on your repository\n " +
105
+ "2. The installation completed successfully and redirected to the callback URL\n " +
106
+ "3. The repository is accessible to the GitHub App\n \n " +
107
+ "If the issue persists, please contact support with this installation ID: " + fmt .Sprintf ("%d" , installationId )
108
+
109
+ _ , commentErr := ghService .PublishComment (issueNumber , errorMsg )
110
+ if commentErr != nil {
111
+ slog .Error ("Error posting installation not found comment" ,
112
+ "issueNumber" , issueNumber ,
113
+ "error" , commentErr ,
114
+ )
115
+ return fmt .Errorf ("github app installation link not found and could not post error comment" )
116
+ }
117
+
118
+ return fmt .Errorf ("github app installation link not found" )
119
+ }
81
120
orgId := link .OrganisationId
82
121
83
122
if * payload .Action != "created" {
0 commit comments