From e515b73c23ce4db6fe0d4fe8ddff6871dc25f0a2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 07:39:38 +0000 Subject: [PATCH 1/2] Initial plan From d017b29804ce31593e136750a7c2b7296d3ba118 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 07:47:12 +0000 Subject: [PATCH 2/2] style: apply formatting and linting fixes Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com> --- actions/setup/js/update_project.cjs | 9 +++----- pkg/workflow/update_project_test.go | 36 ++++++++++++++--------------- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/actions/setup/js/update_project.cjs b/actions/setup/js/update_project.cjs index 9225d138b0b..85890dd8b90 100644 --- a/actions/setup/js/update_project.cjs +++ b/actions/setup/js/update_project.cjs @@ -410,7 +410,7 @@ async function updateProject(output) { const layout = typeof view.layout === "string" ? view.layout.trim() : ""; if (!layout || !["table", "board", "roadmap"].includes(layout)) { - throw new Error('Invalid view.layout. Must be one of: table, board, roadmap.'); + throw new Error("Invalid view.layout. Must be one of: table, board, roadmap."); } const filter = typeof view.filter === "string" ? view.filter : undefined; @@ -429,17 +429,14 @@ async function updateProject(output) { } if (typeof view.description === "string" && view.description.trim()) { - core.warning('view.description is not supported by the GitHub Projects Views API; ignoring.'); + core.warning("view.description is not supported by the GitHub Projects Views API; ignoring."); } if (typeof github.request !== "function") { throw new Error("GitHub client does not support github.request(); cannot call Projects Views REST API."); } - const route = - projectInfo.scope === "orgs" - ? "POST /orgs/{org}/projectsV2/{project_number}/views" - : "POST /users/{user_id}/projectsV2/{project_number}/views"; + const route = projectInfo.scope === "orgs" ? "POST /orgs/{org}/projectsV2/{project_number}/views" : "POST /users/{user_id}/projectsV2/{project_number}/views"; const params = projectInfo.scope === "orgs" diff --git a/pkg/workflow/update_project_test.go b/pkg/workflow/update_project_test.go index d0fc6eb5ed8..59524887392 100644 --- a/pkg/workflow/update_project_test.go +++ b/pkg/workflow/update_project_test.go @@ -114,16 +114,16 @@ func TestParseUpdateProjectConfig(t *testing.T) { func TestUpdateProjectConfig_DefaultMax(t *testing.T) { compiler := NewCompiler(false, "", "test") - + outputMap := map[string]any{ "update-project": map[string]any{ "github-token": "${{ secrets.TOKEN }}", }, } - + config := compiler.parseUpdateProjectConfig(outputMap) require.NotNil(t, config) - + // Default max should be 10 when not specified assert.Equal(t, 10, config.Max, "Default max should be 10") } @@ -149,13 +149,13 @@ func TestUpdateProjectConfig_TokenPrecedence(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { compiler := NewCompiler(false, "", "test") - + outputMap := map[string]any{ "update-project": map[string]any{ "github-token": tt.configToken, }, } - + config := compiler.parseUpdateProjectConfig(outputMap) require.NotNil(t, config) assert.Equal(t, tt.expectedToken, config.GitHubToken) @@ -165,10 +165,10 @@ func TestUpdateProjectConfig_TokenPrecedence(t *testing.T) { func TestBuildUpdateProjectJob(t *testing.T) { tests := []struct { - name string + name string workflowData *WorkflowData - expectError bool - errorMsg string + expectError bool + errorMsg string }{ { name: "valid config", @@ -224,9 +224,9 @@ func TestBuildUpdateProjectJob(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { compiler := NewCompiler(false, "", "test") - + job, err := compiler.buildUpdateProjectJob(tt.workflowData, "main") - + if tt.expectError { require.Error(t, err) assert.Contains(t, err.Error(), tt.errorMsg) @@ -234,7 +234,7 @@ func TestBuildUpdateProjectJob(t *testing.T) { } else { require.NoError(t, err) require.NotNil(t, job) - + // Verify job has basic structure assert.NotEmpty(t, job.Steps, "Job should have steps") } @@ -244,7 +244,7 @@ func TestBuildUpdateProjectJob(t *testing.T) { func TestUpdateProjectJob_EnvironmentVariables(t *testing.T) { compiler := NewCompiler(false, "", "test") - + workflowData := &WorkflowData{ Name: "test-workflow", SafeOutputs: &SafeOutputsConfig{ @@ -256,14 +256,14 @@ func TestUpdateProjectJob_EnvironmentVariables(t *testing.T) { }, }, } - + job, err := compiler.buildUpdateProjectJob(workflowData, "main") require.NoError(t, err) require.NotNil(t, job) - + // Job should contain steps assert.NotEmpty(t, job.Steps, "Job should have steps") - + // Check that GH_AW_PROJECT_GITHUB_TOKEN is set in the environment hasProjectToken := false for _, step := range job.Steps { @@ -277,7 +277,7 @@ func TestUpdateProjectJob_EnvironmentVariables(t *testing.T) { func TestUpdateProjectJob_Permissions(t *testing.T) { compiler := NewCompiler(false, "", "test") - + workflowData := &WorkflowData{ Name: "test-workflow", SafeOutputs: &SafeOutputsConfig{ @@ -288,11 +288,11 @@ func TestUpdateProjectJob_Permissions(t *testing.T) { }, }, } - + job, err := compiler.buildUpdateProjectJob(workflowData, "main") require.NoError(t, err) require.NotNil(t, job) - + // Verify permissions are set correctly // update_project requires contents: read permission require.NotEmpty(t, job.Permissions, "Job should have permissions")