Skip to content

Commit 3e6f74f

Browse files
committed
fix: correct syntax in github-script step
1 parent 9de2402 commit 3e6f74f

1 file changed

Lines changed: 8 additions & 19 deletions

File tree

.github/workflows/python-app.yml

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -104,43 +104,32 @@ jobs:
104104
const path = require('path');
105105
106106
const testDir = 'test-results';
107-
let testSummary = '### Test Results\n\n| Python Version | Status |\n|---|---|
108-
';
107+
let testSummary = '### Test Results\\n\\n| Python Version | Status |\\n|---|---|\\n';
109108
let allPassed = true;
110109
111110
try {
112111
const files = fs.readdirSync(testDir);
113112
for (const dir of files) {
114-
// Artifact download creates a subdirectory for each artifact pattern match if they are separate
115-
// But here we downloaded by pattern. Let's inspect structure if needed.
116-
// Actually actions/download-artifact with pattern puts them in folders named after artifact usually if merge-multiple is false (default).
117-
// Let's assume folder structure: test-results/test-results-3.9/test-results-3.9.xml
118-
119-
// To keep it simple, we just assume success if the job passed (which it did if we are here, mostly).
120-
// But better to read the XML or just trust the 'needs' status.
121-
// Since we are in 'needs', tests passed.
122113
const version = dir.replace('test-results-', '');
123-
testSummary += `| ${version} | ✅ Passed |\n`;
114+
testSummary += `| ${version} | ✅ Passed |\\n`;
124115
}
125116
} catch (e) {
126-
testSummary += `Error reading test results: ${e.message}\n`;
117+
testSummary += `Error reading test results: ${e.message}\\n`;
127118
}
128119
129-
let graphSummary = '### Generated Graphs\n\nGraphs generated by `generate_graphs.py` have been uploaded as artifacts.';
120+
let graphSummary = '### Generated Graphs\\n\\nGraphs generated by `generate_graphs.py` have been uploaded as artifacts.';
130121
131-
// Note: We cannot easily embed images from artifacts directly into PR comments without hosting them.
132-
// We can listing the generated files.
133122
try {
134123
const graphFiles = fs.readdirSync('generated-graphs');
135-
graphSummary += '\n\n**Generated Files:**\n';
124+
graphSummary += '\\n\\n**Generated Files:**\\n';
136125
graphFiles.forEach(file => {
137-
graphSummary += `- ${file}\n`;
126+
graphSummary += `- ${file}\\n`;
138127
});
139128
} catch (e) {
140-
graphSummary += `\nError reading graphs: ${e.message}`;
129+
graphSummary += `\\nError reading graphs: ${e.message}`;
141130
}
142131
143-
const body = `## CI Summary 🚀\n\n${testSummary}\n\n${graphSummary}\n\n[View Artifacts](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})`;
132+
const body = `## CI Summary 🚀\\n\\n${testSummary}\\n\\n${graphSummary}\\n\\n[View Artifacts](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})`;
144133
145134
github.rest.issues.createComment({
146135
issue_number: context.issue.number,

0 commit comments

Comments
 (0)