Skip to content

Commit eb4c2d5

Browse files
authored
Remove obsolete action references and clean up actions build system (#8055)
1 parent ae78791 commit eb4c2d5

5 files changed

Lines changed: 25 additions & 173 deletions

File tree

.github/instructions/developer.instructions.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -364,14 +364,11 @@ The custom actions build system is **entirely implemented in Go** in `pkg/cli/ac
364364
**Directory Structure**:
365365
```
366366
actions/
367-
├── setup-safe-inputs/
368-
│ ├── action.yml
369-
│ ├── index.js
370-
│ └── src/
371-
├── setup-safe-outputs/
372-
│ ├── action.yml
373-
│ ├── index.js
374-
│ └── src/
367+
└── setup/
368+
├── action.yml
369+
├── setup.sh
370+
├── js/
371+
└── sh/
375372
```
376373
377374
**Implementation**: See specs/actions.md and `pkg/cli/actions_build_command.go`

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ trivy-results.sarif
139139
# Note: If workflows fail due to missing js/ files, these may need to be committed
140140
# The js/ directories contain compiled JavaScript from pkg/workflow/js/*.cjs
141141
# and are generated by 'make actions-build'
142-
actions/setup-safe-outputs/js/
143142

144143
# License compliance reports
145144
licenses.csv

actions/README.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,6 @@ Copies workflow script files to the agent environment. This action embeds all ne
2323

2424
[Documentation](./setup/README.md)
2525

26-
### setup-safe-outputs
27-
28-
Copies safe-outputs MCP server files to the agent environment. This action embeds all necessary JavaScript files for the safe-outputs MCP server and copies them to a specified destination directory.
29-
30-
[Documentation](./setup-safe-outputs/README.md)
31-
32-
### setup-safe-inputs
33-
34-
Copies safe-inputs MCP server files to the agent environment. This action embeds all necessary JavaScript files for the safe-inputs MCP server and copies them to a specified destination directory.
35-
36-
[Documentation](./setup-safe-inputs/README.md)
37-
3826
### noop
3927

4028
Processes noop safe output - a fallback output type that logs messages for transparency without taking any GitHub API actions.
@@ -264,7 +252,7 @@ Test actions locally by:
264252
1. Creating a test workflow in `.github/workflows/`
265253
2. Using the action with a local path:
266254
```yaml
267-
- uses: ./actions/setup-safe-outputs
255+
- uses: ./actions/setup
268256
with:
269257
destination: /tmp/test
270258
```

pkg/cli/actions_build_command.go

Lines changed: 2 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ func ActionsCleanCommand() error {
105105

106106
cleanedCount := 0
107107
for _, actionName := range actionDirs {
108-
// Clean index.js for actions that use it (except setup-safe-outputs and setup)
109-
if actionName != "setup-safe-outputs" && actionName != "setup" {
108+
// Clean index.js for actions that use it (except setup)
109+
if actionName != "setup" {
110110
indexPath := filepath.Join(actionsDir, actionName, "index.js")
111111
if _, err := os.Stat(indexPath); err == nil {
112112
if err := os.Remove(indexPath); err != nil {
@@ -117,18 +117,6 @@ func ActionsCleanCommand() error {
117117
}
118118
}
119119

120-
// Clean js/ directory for setup-safe-outputs
121-
if actionName == "setup-safe-outputs" {
122-
jsDir := filepath.Join(actionsDir, actionName, "js")
123-
if _, err := os.Stat(jsDir); err == nil {
124-
if err := os.RemoveAll(jsDir); err != nil {
125-
return fmt.Errorf("failed to remove %s: %w", jsDir, err)
126-
}
127-
fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" ✓ Removed %s/js/", actionName)))
128-
cleanedCount++
129-
}
130-
}
131-
132120
// For setup action, both js/ and sh/ directories are source of truth (NOT generated)
133121
// Do not clean them
134122
}
@@ -219,11 +207,6 @@ func buildAction(actionsDir, actionName string) error {
219207
return err
220208
}
221209

222-
// Special handling for setup-safe-outputs: copy files instead of embedding
223-
if actionName == "setup-safe-outputs" {
224-
return buildSetupSafeOutputsAction(actionsDir, actionName)
225-
}
226-
227210
// Special handling for setup: build shell script with embedded files
228211
if actionName == "setup" {
229212
return buildSetupAction(actionsDir, actionName)
@@ -287,43 +270,6 @@ func buildAction(actionsDir, actionName string) error {
287270
return nil
288271
}
289272

290-
// buildSetupSafeOutputsAction builds the setup-safe-outputs action by copying JavaScript files
291-
func buildSetupSafeOutputsAction(actionsDir, actionName string) error {
292-
actionPath := filepath.Join(actionsDir, actionName)
293-
jsDir := filepath.Join(actionPath, "js")
294-
295-
// Get dependencies for this action
296-
dependencies := getActionDependencies(actionName)
297-
fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" ✓ Found %d dependencies", len(dependencies))))
298-
299-
// Get all JavaScript sources
300-
sources := workflow.GetJavaScriptSources()
301-
302-
// Create js directory if it doesn't exist
303-
if err := os.MkdirAll(jsDir, 0755); err != nil {
304-
return fmt.Errorf("failed to create js directory: %w", err)
305-
}
306-
307-
// Copy each dependency file to the js directory
308-
copiedCount := 0
309-
for _, dep := range dependencies {
310-
if content, ok := sources[dep]; ok {
311-
destPath := filepath.Join(jsDir, dep)
312-
if err := os.WriteFile(destPath, []byte(content), 0644); err != nil {
313-
return fmt.Errorf("failed to write %s: %w", dep, err)
314-
}
315-
fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" - %s", dep)))
316-
copiedCount++
317-
} else {
318-
fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf(" ⚠ Warning: Could not find %s", dep)))
319-
}
320-
}
321-
322-
fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf(" ✓ Copied %d files to js/", copiedCount)))
323-
324-
return nil
325-
}
326-
327273
// buildSetupAction builds the setup action by checking that source files exist.
328274
// Note: Both JavaScript and shell scripts are source of truth in actions/setup/js/ and actions/setup/sh/
329275
// They get synced to pkg/workflow/js/ and pkg/workflow/sh/ during the build process via Makefile targets.
@@ -374,49 +320,5 @@ func getActionDependencies(actionName string) []string {
374320
return workflow.GetAllScriptFilenames()
375321
}
376322

377-
// Static dependencies for other actions
378-
dependencyMap := map[string][]string{
379-
"setup-safe-outputs": {
380-
"safe_outputs_mcp_server.cjs",
381-
"safe_outputs_bootstrap.cjs",
382-
"safe_outputs_tools_loader.cjs",
383-
"safe_outputs_config.cjs",
384-
"safe_outputs_handlers.cjs",
385-
"mcp_server_core.cjs",
386-
"mcp_logger.cjs",
387-
"messages.cjs",
388-
},
389-
"setup-safe-inputs": {
390-
"safe_inputs_mcp_server.cjs",
391-
"safe_inputs_bootstrap.cjs",
392-
"safe_inputs_config_loader.cjs",
393-
"safe_inputs_tool_factory.cjs",
394-
"safe_inputs_validation.cjs",
395-
"mcp_server_core.cjs",
396-
"mcp_logger.cjs",
397-
},
398-
"noop": {
399-
"load_agent_output.cjs",
400-
},
401-
"minimize_comment": {
402-
"load_agent_output.cjs",
403-
},
404-
"close_issue": {
405-
"close_entity_helpers.cjs",
406-
},
407-
"close_pull_request": {
408-
"close_entity_helpers.cjs",
409-
},
410-
"close_discussion": {
411-
"generate_footer.cjs",
412-
"get_repository_url.cjs",
413-
"get_tracker_id.cjs",
414-
"load_agent_output.cjs",
415-
},
416-
}
417-
418-
if deps, ok := dependencyMap[actionName]; ok {
419-
return deps
420-
}
421323
return []string{}
422324
}

specs/actions.md

Lines changed: 17 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,14 @@ Create a custom actions system that:
9494
┌─────────────────────────────────────────────────────────┐
9595
│ actions/ Directory │
9696
│ ┌────────────────────────────────────────────────────┐ │
97-
│ │ setup-safe-inputs/ setup-safe-outputs/ │ │
98-
│ │ ├── action.yml ├── action.yml │ │
99-
│ │ ├── index.js ├── index.js │ │
100-
│ │ ├── src/ ├── src/ │ │
101-
│ │ │ └── index.js │ └── index.js │ │
102-
│ │ └── README.md └── README.md │ │
97+
│ │ setup/ │ │
98+
│ │ ├── action.yml │ │
99+
│ │ ├── setup.sh │ │
100+
│ │ ├── js/ │ │
101+
│ │ │ └── *.cjs (copied from pkg/workflow/js/) │ │
102+
│ │ ├── sh/ │ │
103+
│ │ │ └── *.sh (source of truth) │ │
104+
│ │ └── README.md │ │
103105
│ └────────────────────────────────────────────────────┘ │
104106
└─────────────────────────────────────────────────────────┘
105107
```text
@@ -149,18 +151,6 @@ gh-aw/
149151
│ │ ├── sh/ # Shell scripts (SOURCE OF TRUTH)
150152
│ │ │ └── *.sh # Manually edited shell scripts
151153
│ │ └── README.md # Action-specific docs
152-
│ ├── setup-safe-inputs/ # Safe inputs MCP server setup
153-
│ │ ├── action.yml # Action metadata
154-
│ │ ├── index.js # Bundled output (committed)
155-
│ │ ├── src/ # Source files
156-
│ │ │ └── index.js # Source that references FILES constant
157-
│ │ └── README.md # Action-specific docs
158-
│ └── setup-safe-outputs/ # Safe outputs MCP server setup
159-
│ ├── action.yml # Action metadata
160-
│ ├── index.js # Bundled output (committed)
161-
│ ├── src/ # Source files
162-
│ │ └── index.js # Source that references FILES constant
163-
│ └── README.md # Action-specific docs
164154
├── pkg/
165155
│ ├── cli/
166156
│ │ └── actions_build_command.go # Build system implementation
@@ -319,31 +309,12 @@ Currently uses manual mapping in `getActionDependencies()`:
319309
320310
```go
321311
func getActionDependencies(actionName string) []string {
322-
dependencyMap := map[string][]string{
323-
"setup-safe-outputs": {
324-
"safe_outputs_mcp_server.cjs",
325-
"safe_outputs_bootstrap.cjs",
326-
"safe_outputs_tools_loader.cjs",
327-
"safe_outputs_config.cjs",
328-
"safe_outputs_handlers.cjs",
329-
"mcp_server_core.cjs",
330-
"mcp_logger.cjs",
331-
"messages.cjs",
332-
},
333-
"setup-safe-inputs": {
334-
"safe_inputs_mcp_server.cjs",
335-
"safe_inputs_bootstrap.cjs",
336-
"safe_inputs_config_loader.cjs",
337-
"safe_inputs_tool_factory.cjs",
338-
"safe_inputs_validation.cjs",
339-
"mcp_server_core.cjs",
340-
"mcp_logger.cjs",
341-
},
342-
}
343-
344-
if deps, ok := dependencyMap[actionName]; ok {
345-
return deps
312+
// For setup, use the dynamic script discovery
313+
// This ensures all .cjs files are included automatically
314+
if actionName == "setup" {
315+
return workflow.GetAllScriptFilenames()
346316
}
317+
347318
return []string{}
348319
}
349320
```text
@@ -449,15 +420,10 @@ jobs:
449420
steps:
450421
- uses: actions/checkout@v4
451422
452-
- name: Setup Safe Inputs
453-
uses: ./actions/setup-safe-inputs
454-
with:
455-
destination: /tmp/safe-inputs
456-
457-
- name: Setup Safe Outputs
458-
uses: ./actions/setup-safe-outputs
423+
- name: Setup Workflow Scripts
424+
uses: ./actions/setup
459425
with:
460-
destination: /tmp/safe-outputs
426+
destination: /tmp/scripts
461427
```text
462428
463429
### Creating a New Action
@@ -727,7 +693,7 @@ The custom GitHub Actions build system provides a foundation for migrating from
727693
✅ **Go-based build system** reusing workflow bundler infrastructure
728694
✅ **Makefile integration** for action management
729695
✅ **CI validation** ensuring actions stay buildable
730-
✅ **Two initial actions** (setup-safe-inputs, setup-safe-outputs)
696+
✅ **Setup action** for workflow script management
731697
✅ **Comprehensive documentation** for future development
732698

733699
The system is production-ready and extensible, with clear paths for enhancement and migration of existing inline scripts.

0 commit comments

Comments
 (0)