Skip to content

Commit 3c4d321

Browse files
fix: address agent tasks review comments
1 parent 43387ee commit 3c4d321

5 files changed

Lines changed: 18 additions & 14 deletions

File tree

.golangci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ linters:
277277
- ActionsCacheListOptions.Key
278278
- ActionsCacheListOptions.Ref
279279
- ActionsCacheListOptions.Sort
280+
- AgentTaskListByRepoOptions.CreatorID # TODO: AgentTasks
280281
- ActiveCommittersListOptions.AdvancedSecurityProduct
281282
- AnalysesListOptions.Ref
282283
- AnalysesListOptions.SarifID

github/agent_tasks.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,12 @@ func (s *AgentTasksService) Create(ctx context.Context, owner, repo string, opts
158158
return task, resp, nil
159159
}
160160

161-
// GetByRepo gets a repository task by ID.
161+
// GetByRepoAndID gets a repository task by ID.
162162
//
163163
// GitHub API docs: https://docs.github.com/rest/agent-tasks/agent-tasks?apiVersion=2026-03-10#get-a-task-by-repo
164164
//
165165
//meta:operation GET /agents/repos/{owner}/{repo}/tasks/{task_id}
166-
func (s *AgentTasksService) GetByRepo(ctx context.Context, owner, repo, taskID string) (*AgentTask, *Response, error) {
166+
func (s *AgentTasksService) GetByRepoAndID(ctx context.Context, owner, repo, taskID string) (*AgentTask, *Response, error) {
167167
u := fmt.Sprintf("agents/repos/%v/%v/tasks/%v", owner, repo, taskID)
168168

169169
req, err := s.client.NewRequest(ctx, "GET", u, nil, WithVersion("2026-03-10"))

github/agent_tasks_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func TestAgentTasksService_ListByRepo(t *testing.T) {
151151
Since: Ptr(time.Date(2025, time.January, 1, 0, 0, 0, 0, time.UTC)),
152152
ListOptions: ListOptions{Page: 2, PerPage: 1},
153153
},
154-
CreatorID: 1,
154+
CreatorID: Ptr(int64(1)),
155155
}
156156

157157
ctx := t.Context()
@@ -227,7 +227,7 @@ func TestAgentTasksService_Create(t *testing.T) {
227227
})
228228
}
229229

230-
func TestAgentTasksService_GetByRepo(t *testing.T) {
230+
func TestAgentTasksService_GetByRepoAndID(t *testing.T) {
231231
t.Parallel()
232232
client, mux, _ := setup(t)
233233

@@ -238,22 +238,22 @@ func TestAgentTasksService_GetByRepo(t *testing.T) {
238238
})
239239

240240
ctx := t.Context()
241-
task, _, err := client.AgentTasks.GetByRepo(ctx, "o", "r", agentTaskID)
241+
task, _, err := client.AgentTasks.GetByRepoAndID(ctx, "o", "r", agentTaskID)
242242
if err != nil {
243-
t.Fatalf("AgentTasks.GetByRepo returned error: %v", err)
243+
t.Fatalf("AgentTasks.GetByRepoAndID returned error: %v", err)
244244
}
245245
if diff := cmp.Diff(agentTask(true), task, cmpJSONRawMessageComparator()); diff != "" {
246-
t.Errorf("AgentTasks.GetByRepo mismatch (-want +got):\n%v", diff)
246+
t.Errorf("AgentTasks.GetByRepoAndID mismatch (-want +got):\n%v", diff)
247247
}
248248

249-
const methodName = "GetByRepo"
249+
const methodName = "GetByRepoAndID"
250250
testBadOptions(t, methodName, func() error {
251-
_, _, err := client.AgentTasks.GetByRepo(ctx, "\n", "\n", "\n")
251+
_, _, err := client.AgentTasks.GetByRepoAndID(ctx, "\n", "\n", "\n")
252252
return err
253253
})
254254

255255
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
256-
got, resp, err := client.AgentTasks.GetByRepo(ctx, "o", "r", agentTaskID)
256+
got, resp, err := client.AgentTasks.GetByRepoAndID(ctx, "o", "r", agentTaskID)
257257
if got != nil {
258258
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
259259
}

github/github-accessors.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/github-accessors_test.go

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)