Skip to content

Commit 5080b3b

Browse files
committed
upload image
1 parent c95c3c9 commit 5080b3b

File tree

1 file changed

+31
-8
lines changed

1 file changed

+31
-8
lines changed

.github/workflows/compas-compile-ci.yml

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727

2828
name: Build COMPAS
2929
runs-on: ubuntu-22.04
30-
# Use Docker Hub for now (GHCR is private)
3130
container: teamcompas/compas:latest
3231
# TODO: Switch to GHCR when package is made public
3332
# container: ghcr.io/teamcompas/compas:latest
@@ -112,22 +111,48 @@ jobs:
112111
const workflowUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
113112
114113
let plotSection = '';
114+
115115
try {
116116
if (fs.existsSync(evolutionPlotPath)) {
117-
const imageData = fs.readFileSync(evolutionPlotPath, {encoding: 'base64'});
117+
const tag = `pr-${context.issue.number}-${Date.now()}`;
118+
const plotData = fs.readFileSync(evolutionPlotPath);
119+
120+
const release = await github.rest.repos.createRelease({
121+
owner: context.repo.owner,
122+
repo: context.repo.repo,
123+
tag_name: tag,
124+
name: `Evolution Plot for PR #${context.issue.number}`,
125+
body: `Temporary release to host evolution plot for PR #${context.issue.number}`,
126+
draft: false,
127+
prerelease: true
128+
});
129+
130+
const asset = await github.rest.repos.uploadReleaseAsset({
131+
owner: context.repo.owner,
132+
repo: context.repo.repo,
133+
release_id: release.data.id,
134+
name: 'detailedEvolutionPlot.png',
135+
data: plotData,
136+
headers: {
137+
'content-type': 'image/png'
138+
}
139+
});
140+
141+
const imageUrl = asset.data.browser_download_url;
142+
118143
plotSection = `
119-
### 📊 Detailed Evolution Plot
144+
### Detailed Evolution Plot
120145
<details><summary>Click to view evolution plot</summary>
121146
122-
![Evolution Plot](data:image/png;base64,${imageData})
147+
![Evolution Plot](${imageUrl})
123148
</details>`;
124149
} else {
125150
plotSection = '\n### ⚠️ Evolution plot not found';
126151
}
127152
} catch (error) {
128153
plotSection = `\n### ⚠️ Evolution plot error: ${error.message}`;
129154
}
130-
155+
131156
await github.rest.issues.createComment({
132157
issue_number: context.issue.number,
133158
owner: context.repo.owner,
@@ -152,6 +177,4 @@ jobs:
152177
echo "- COMPAS Build: Success" >> $GITHUB_STEP_SUMMARY
153178
echo "- Python Dependencies: Success" >> $GITHUB_STEP_SUMMARY
154179
echo "- Example COMPAS Job: Success" >> $GITHUB_STEP_SUMMARY
155-
echo "- Pytest Suite: Success" >> $GITHUB_STEP_SUMMARY
156-
echo "- Container: teamcompas/compas:latest (Docker Hub)" >> $GITHUB_STEP_SUMMARY
157-
echo "- Ready to switch to: ghcr.io/teamcompas/compas:latest" >> $GITHUB_STEP_SUMMARY
180+
echo "- Pytest Suite: Success" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)