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
35 changes: 19 additions & 16 deletions .github/workflows/issue-triage.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 19 additions & 16 deletions .github/workflows/test-claude.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 19 additions & 16 deletions .github/workflows/test-codex.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 19 additions & 16 deletions .github/workflows/test-proxy.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 19 additions & 16 deletions .github/workflows/weekly-research.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 3 additions & 17 deletions pkg/workflow/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2683,23 +2683,9 @@ func (c *Compiler) generateOutputFileSetup(yaml *strings.Builder, data *Workflow
yaml.WriteString(" uses: actions/github-script@v7\n")
yaml.WriteString(" with:\n")
yaml.WriteString(" script: |\n")
yaml.WriteString(" const fs = require('fs');\n")
yaml.WriteString(" const crypto = require('crypto');\n")
yaml.WriteString(" // Generate a random filename for the output file\n")
yaml.WriteString(" const randomId = crypto.randomBytes(8).toString('hex');\n")
yaml.WriteString(" const outputFile = `/tmp/aw_output_${randomId}.txt`;\n")
yaml.WriteString(" // Ensure the /tmp directory exists and create empty output file\n")
yaml.WriteString(" fs.mkdirSync('/tmp', { recursive: true });\n")
yaml.WriteString(" fs.writeFileSync(outputFile, '', { mode: 0o644 });\n")
yaml.WriteString(" // Verify the file was created and is writable\n")
yaml.WriteString(" if (!fs.existsSync(outputFile)) {\n")
yaml.WriteString(" throw new Error(`Failed to create output file: ${outputFile}`);\n")
yaml.WriteString(" }\n")
yaml.WriteString(" // Set the environment variable for subsequent steps\n")
yaml.WriteString(" core.exportVariable('GITHUB_AW_OUTPUT', outputFile);\n")
yaml.WriteString(" console.log('Created agentic output file:', outputFile);\n")
yaml.WriteString(" // Also set as step output for reference\n")
yaml.WriteString(" core.setOutput('output_file', outputFile);\n")

// Use the embedded setup agent output script
WriteJavaScriptToYAML(yaml, setupAgentOutputScript)
}

// generateOutputCollectionStep generates a step that reads the output file and sets it as a GitHub Actions output
Expand Down
3 changes: 3 additions & 0 deletions pkg/workflow/js.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ var sanitizeOutputScript string
//go:embed js/add_labels.cjs
var addLabelsScript string

//go:embed js/setup_agent_output.cjs
var setupAgentOutputScript string

// FormatJavaScriptForYAML formats a JavaScript script with proper indentation for embedding in YAML
func FormatJavaScriptForYAML(script string) []string {
var formattedLines []string
Expand Down
26 changes: 26 additions & 0 deletions pkg/workflow/js/setup_agent_output.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
function main() {
const fs = require('fs');
const crypto = require('crypto');

// Generate a random filename for the output file
const randomId = crypto.randomBytes(8).toString('hex');
const outputFile = `/tmp/aw_output_${randomId}.txt`;

// Ensure the /tmp directory exists and create empty output file
fs.mkdirSync('/tmp', { recursive: true });
fs.writeFileSync(outputFile, '', { mode: 0o644 });

// Verify the file was created and is writable
if (!fs.existsSync(outputFile)) {
throw new Error(`Failed to create output file: ${outputFile}`);
}

// Set the environment variable for subsequent steps
core.exportVariable('GITHUB_AW_OUTPUT', outputFile);
console.log('Created agentic output file:', outputFile);

// Also set as step output for reference
core.setOutput('output_file', outputFile);
}

main();
Loading
Loading