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
11 changes: 0 additions & 11 deletions pkg/cli/update_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -660,17 +660,6 @@ func updateActionsInWorkflowFiles(ctx context.Context, deps actionUpdateDeps, wo
return nil
}

// updateActionRefsInContent replaces outdated "uses: org/repo@version" references
// in content with the latest major version and SHA. Returns (changed, newContent, error).
// cache is keyed by "repo@currentVersion" and avoids redundant API calls across lines/files.
// coolDownCache is keyed by "repo@tag" and avoids redundant cooldown date API calls.
// When allowMajor is true (the default), all matched actions are updated to the latest
// major version. When allowMajor is false (--disable-release-bump), non-core (non
// actions/*) action refs are skipped; core actions are always updated.
func updateActionRefsInContent(ctx context.Context, content string, cache map[string]latestReleaseResult, coolDownCache map[string]coolDownCheckResult, allowMajor, verbose bool, coolDown time.Duration) (bool, string, error) {
return updateActionRefsInContentWithDeps(ctx, defaultActionUpdateDeps(), content, cache, coolDownCache, allowMajor, verbose, coolDown)
}

func updateActionRefsInContentWithDeps(ctx context.Context, deps actionUpdateDeps, content string, cache map[string]latestReleaseResult, coolDownCache map[string]coolDownCheckResult, allowMajor, verbose bool, coolDown time.Duration) (bool, string, error) {
changed := false
lines := strings.Split(content, "\n")
Expand Down
37 changes: 0 additions & 37 deletions pkg/cli/update_actions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,43 +353,6 @@ func TestIsCoreAction(t *testing.T) {
}
}

func TestUpdateActionRefsInContent_NonCoreActionsUnchanged(t *testing.T) {
// When allowMajor=false (--disable-release-bump), non-actions/* org references
// should not be modified because they are not core actions.
input := `steps:
- uses: docker/login-action@v3
- uses: github/codeql-action/upload-sarif@v3
- run: echo hello`

cache := make(map[string]latestReleaseResult)
changed, newContent, err := updateActionRefsInContent(context.Background(), input, cache, make(map[string]coolDownCheckResult), false, false, 0)
if err != nil {
t.Fatalf("updateActionRefsInContent() error = %v", err)
}
if changed {
t.Errorf("updateActionRefsInContent() changed = true, want false for non-actions/* refs with allowMajor=false")
}
if newContent != input {
t.Errorf("updateActionRefsInContent() modified content for non-actions/* refs\nGot: %s\nWant: %s", newContent, input)
}
}

func TestUpdateActionRefsInContent_NoActionRefs(t *testing.T) {
input := `description: Test workflow
steps:
- run: echo hello
- run: echo world`

cache := make(map[string]latestReleaseResult)
changed, _, err := updateActionRefsInContent(context.Background(), input, cache, make(map[string]coolDownCheckResult), true, false, 0)
if err != nil {
t.Fatalf("updateActionRefsInContent() error = %v", err)
}
if changed {
t.Errorf("updateActionRefsInContent() changed = true, want false for content with no action refs")
}
}

func TestUpdateActionRefsInContent_VersionTagReplacement(t *testing.T) {
// Stub latest release lookup so the test doesn't hit the network.
deps := newActionUpdateDepsWithLatestRelease(func(_ context.Context, repo, currentVersion string, allowMajor, verbose bool) (string, string, error) {
Expand Down
6 changes: 0 additions & 6 deletions pkg/workflow/call_workflow_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,6 @@ func extractMDWorkflowCallInputs(mdPath string) (map[string]any, error) {
return extractInputsFromMarkdown(mdPath, "workflow_call")
}

// extractWorkflowCallInputsFromParsed extracts workflow_call inputs from an already-parsed
// workflow map (used for both .lock.yml and .yml files).
func extractWorkflowCallInputsFromParsed(workflow map[string]any) map[string]any {
return extractInputsFromParsedWorkflow(workflow, "workflow_call")
}

// mdHasWorkflowCall reads a .md workflow file's frontmatter and reports whether
// the workflow includes a workflow_call trigger in its 'on:' section.
func mdHasWorkflowCall(mdPath string) (bool, error) {
Expand Down
39 changes: 0 additions & 39 deletions pkg/workflow/engine_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
//
// # Key Functions
//
// Base Installation:
// - GetBaseInstallationSteps() - Generate base installation steps for an engine
//
// Secret Validation:
// - GenerateMultiSecretValidationStep() - Validate at least one of multiple secrets
// - BuildDefaultSecretValidationStep() - Build secret validation step for an engine
Expand Down Expand Up @@ -89,42 +86,6 @@ func engineEnvHasKey(workflowData *WorkflowData, key string) bool {
return ok
}

// GetBaseInstallationSteps returns the common installation steps for an engine.
// This includes npm package installation steps shared across all engines.
// Secret validation is now handled in the activation job via GetSecretValidationStep.
//
// Parameters:
// - config: Engine-specific configuration for installation
// - workflowData: The workflow data containing engine configuration
//
// Returns:
// - []GitHubActionStep: The base installation steps (npm install)
func GetBaseInstallationSteps(config EngineInstallConfig, workflowData *WorkflowData) []GitHubActionStep {
engineHelpersLog.Printf("Generating base installation steps for %s engine: workflow=%s", config.Name, workflowData.Name)

var steps []GitHubActionStep

// Secret validation step is now generated in the activation job (GetSecretValidationStep).

// Determine step name - use InstallStepName if provided, otherwise default to "Install <Name>"
stepName := config.InstallStepName
if stepName == "" {
stepName = "Install " + config.Name
}

// Add npm package installation steps
npmSteps := BuildStandardNpmEngineInstallSteps(
config.NpmPackage,
config.Version,
stepName,
config.CliName,
workflowData,
)
steps = append(steps, npmSteps...)

return steps
}

// GenerateMultiSecretValidationStep creates a GitHub Actions step that validates at least one
// of multiple secrets is available.
// secretNames: slice of secret names to validate (e.g., []string{"CODEX_API_KEY", "OPENAI_API_KEY"})
Expand Down
21 changes: 0 additions & 21 deletions pkg/workflow/safe_outputs_call_workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,27 +465,6 @@ jobs:

// TestExtractWorkflowCallInputsFromParsed tests the parsing of workflow_call inputs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dangling comment left after the test function was deleted.

💡 Suggested fix

Remove the orphaned comment (lines 464–465):

// TestExtractWorkflowCallInputsFromParsed tests the parsing of workflow_call inputs
// from an already-parsed workflow map

Since the function it described no longer exists, this comment misleads readers about what the next function tests.

// from an already-parsed workflow map

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/zoom-out] Orphaned comment left behind after deleting the test function.

Lines 466–467 still reference TestExtractWorkflowCallInputsFromParsed but the function was removed. Delete both lines to avoid confusing future readers.

💡 Note on coverage

No coverage gap here — the underlying extractInputsFromParsedWorkflow is exercised in workflow_inputs_extractor_test.go.

func TestExtractWorkflowCallInputsFromParsed(t *testing.T) {
workflow := map[string]any{
"on": map[string]any{
"workflow_call": map[string]any{
"inputs": map[string]any{
"payload": map[string]any{
"type": "string",
"required": false,
},
},
},
},
}

inputs := extractWorkflowCallInputsFromParsed(workflow)
assert.Contains(t, inputs, "payload", "Should extract payload input")

payloadInput, ok := inputs["payload"].(map[string]any)
require.True(t, ok, "payload input should be a map")
assert.Equal(t, "string", payloadInput["type"], "payload should be string type")
}

// TestCallWorkflowConfig_WithGeneratedYAML tests that the compiled YAML for a gateway workflow
// includes the expected call-workflow fan-out jobs structure
Comment on lines 466 to 470
Expand Down
Loading