You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by kl...@apache.org on 2026/04/09 13:43:09 UTC

(incubator-devlake) branch main updated: Fix/gh copilot apiversion (#8826)

This is an automated email from the ASF dual-hosted git repository.

klesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new c2b530a5c Fix/gh copilot apiversion (#8826)
c2b530a5c is described below

commit c2b530a5cf98584295710149af048fcb3771f87e
Author: Amit Kumar <am...@evolent.com>
AuthorDate: Thu Apr 9 19:13:05 2026 +0530

    Fix/gh copilot apiversion (#8826)
    
    * fix: changed apiversion of gh copilot as per the docs
    
    * fix: added test and a const for testable version
---
 backend/plugins/gh-copilot/service/connection_test_helper.go | 2 +-
 backend/plugins/gh-copilot/tasks/api_client.go               | 4 +++-
 backend/plugins/gh-copilot/tasks/api_client_test.go          | 5 +++++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/backend/plugins/gh-copilot/service/connection_test_helper.go b/backend/plugins/gh-copilot/service/connection_test_helper.go
index 5bffb63b4..9cda8ae1d 100644
--- a/backend/plugins/gh-copilot/service/connection_test_helper.go
+++ b/backend/plugins/gh-copilot/service/connection_test_helper.go
@@ -73,7 +73,7 @@ func TestConnection(ctx stdctx.Context, br corectx.BasicRes, connection *models.
 	}
 	apiClient.SetHeaders(map[string]string{
 		"Accept":               "application/vnd.github+json",
-		"X-GitHub-Api-Version": "2022-11-28",
+		"X-GitHub-Api-Version": "2026-03-10",
 	})
 
 	result := &TestConnectionResult{
diff --git a/backend/plugins/gh-copilot/tasks/api_client.go b/backend/plugins/gh-copilot/tasks/api_client.go
index d217a687b..1a58eb65b 100644
--- a/backend/plugins/gh-copilot/tasks/api_client.go
+++ b/backend/plugins/gh-copilot/tasks/api_client.go
@@ -28,6 +28,8 @@ import (
 	"github.com/apache/incubator-devlake/plugins/gh-copilot/models"
 )
 
+const gitHubApiVersion = "2026-03-10"
+
 type nowFunc func() time.Time
 type sleepFunc func(time.Duration)
 
@@ -65,7 +67,7 @@ func CreateApiClient(taskCtx plugin.TaskContext, connection *models.GhCopilotCon
 
 	apiClient.SetHeaders(map[string]string{
 		"Accept":               "application/vnd.github+json",
-		"X-GitHub-Api-Version": "2022-11-28",
+		"X-GitHub-Api-Version": gitHubApiVersion,
 	})
 
 	rateLimiter := &helper.ApiRateLimitCalculator{UserRateLimitPerHour: connection.RateLimitPerHour}
diff --git a/backend/plugins/gh-copilot/tasks/api_client_test.go b/backend/plugins/gh-copilot/tasks/api_client_test.go
index 0574b137e..51485ad2e 100644
--- a/backend/plugins/gh-copilot/tasks/api_client_test.go
+++ b/backend/plugins/gh-copilot/tasks/api_client_test.go
@@ -75,3 +75,8 @@ func TestHandleGitHubRetryAfterNoopOnNon429(t *testing.T) {
 	require.Equal(t, time.Duration(0), slept)
 	require.Len(t, logger.warnings, 0)
 }
+
+func TestGitHubApiVersionHeaderValue(t *testing.T) {
+	require.Equal(t, "2026-03-10", gitHubApiVersion,
+		"GitHub API version header was changed; verify the new version is supported and update this test")
+}