Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions pkg/workflow/create_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ var createProjectLog = logger.New("workflow:create_project")
// CreateProjectsConfig holds configuration for creating GitHub Projects V2
type CreateProjectsConfig struct {
BaseSafeOutputConfig `yaml:",inline"`
GitHubToken string `yaml:"github-token,omitempty"`
TargetOwner string `yaml:"target-owner,omitempty"` // Default target owner (org/user) for the new project
TitlePrefix string `yaml:"title-prefix,omitempty"` // Default prefix for auto-generated project titles
Views []ProjectView `yaml:"views,omitempty"` // Project views to create automatically after project creation
Expand All @@ -25,14 +24,6 @@ func (c *Compiler) parseCreateProjectsConfig(outputMap map[string]any) *CreatePr
// Parse base config (max, github-token)
c.parseBaseSafeOutputConfig(configMap, &createProjectsConfig.BaseSafeOutputConfig, 1)

// Parse github-token override if specified
if token, exists := configMap["github-token"]; exists {
if tokenStr, ok := token.(string); ok {
createProjectsConfig.GitHubToken = tokenStr
createProjectLog.Print("Using custom GitHub token for create-project")
}
}

// Parse target-owner if specified
if targetOwner, exists := configMap["target-owner"]; exists {
if targetOwnerStr, ok := targetOwner.(string); ok {
Expand Down
13 changes: 2 additions & 11 deletions pkg/workflow/create_project_status_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ var createProjectStatusUpdateLog = logger.New("workflow:create_project_status_up

// CreateProjectStatusUpdateConfig holds configuration for creating GitHub project status updates
type CreateProjectStatusUpdateConfig struct {
BaseSafeOutputConfig
GitHubToken string `yaml:"github-token,omitempty"` // Optional custom GitHub token for project status updates
Project string `yaml:"project,omitempty"` // Optional default project URL for status updates
BaseSafeOutputConfig `yaml:",inline"`
Project string `yaml:"project,omitempty"` // Optional default project URL for status updates
}

// parseCreateProjectStatusUpdateConfig handles create-project-status-update configuration
Expand All @@ -23,14 +22,6 @@ func (c *Compiler) parseCreateProjectStatusUpdateConfig(outputMap map[string]any
if configMap, ok := configData.(map[string]any); ok {
c.parseBaseSafeOutputConfig(configMap, &config.BaseSafeOutputConfig, 10)

// Parse custom GitHub token
if token, ok := configMap["github-token"]; ok {
if tokenStr, ok := token.(string); ok {
config.GitHubToken = tokenStr
createProjectStatusUpdateLog.Print("Using custom GitHub token for create-project-status-update")
}
}

// Parse project URL override if specified
if project, exists := configMap["project"]; exists {
if projectStr, ok := project.(string); ok {
Expand Down
17 changes: 17 additions & 0 deletions pkg/workflow/create_project_status_update_handler_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,27 @@ import (
"testing"

"github.com/github/gh-aw/pkg/testutil"
"github.com/goccy/go-yaml"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestCreateProjectStatusUpdateConfigYAMLInlineBaseConfig(t *testing.T) {
config := CreateProjectStatusUpdateConfig{
BaseSafeOutputConfig: BaseSafeOutputConfig{
GitHubToken: "${{ secrets.CUSTOM_TOKEN }}",
},
Project: "https://github.com/orgs/test-org/projects/1",
}

out, err := yaml.Marshal(config)
require.NoError(t, err)

yamlStr := string(out)
assert.Contains(t, yamlStr, "github-token: ${{ secrets.CUSTOM_TOKEN }}")
assert.NotContains(t, yamlStr, "basesafeoutputconfig:")
}

// TestCreateProjectStatusUpdateHandlerConfigIncludesMax verifies that the max field
// is properly passed to the handler config JSON (GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG)
func TestCreateProjectStatusUpdateHandlerConfigIncludesMax(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/workflow/create_project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ func TestParseCreateProjectsConfig(t *testing.T) {
},
expectedConfig: &CreateProjectsConfig{
BaseSafeOutputConfig: BaseSafeOutputConfig{
Max: strPtr("1"),
Max: strPtr("1"),
GitHubToken: "${{ secrets.PROJECTS_PAT }}",
},
GitHubToken: "${{ secrets.PROJECTS_PAT }}",
TargetOwner: "myorg",
TitlePrefix: "Project",
},
Expand Down
9 changes: 0 additions & 9 deletions pkg/workflow/update_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ type ProjectFieldDefinition struct {
// UpdateProjectConfig holds configuration for unified project board management
type UpdateProjectConfig struct {
BaseSafeOutputConfig `yaml:",inline"`
GitHubToken string `yaml:"github-token,omitempty"`
Project string `yaml:"project,omitempty"` // Default project URL for operations
TargetRepoSlug string `yaml:"target-repo,omitempty"` // Default repository for cross-repo content resolution in "owner/repo" format
AllowedRepos []string `yaml:"allowed-repos,omitempty"` // List of additional repositories allowed for target_repo resolution
Expand All @@ -43,14 +42,6 @@ func (c *Compiler) parseUpdateProjectConfig(outputMap map[string]any) *UpdatePro
// Parse base config (max, github-token)
c.parseBaseSafeOutputConfig(configMap, &updateProjectConfig.BaseSafeOutputConfig, 10)

// Parse github-token override if specified
if token, exists := configMap["github-token"]; exists {
if tokenStr, ok := token.(string); ok {
updateProjectConfig.GitHubToken = tokenStr
updateProjectLog.Print("Using custom GitHub token for update-project")
}
}

// Parse project URL override if specified
if project, exists := configMap["project"]; exists {
if projectStr, ok := project.(string); ok {
Expand Down
Loading