@@ -95,86 +95,59 @@ jobs:
95
95
id : upload
96
96
uses : actions/upload-artifact@v4
97
97
with :
98
- name : ${{ env.ARTIFACT_NAME }}
98
+ name : evolution-plot- ${{ github.run_number }}
99
99
path : ${{ env.ARTIFACT_PATH }}/${{ env.ARTIFACT_NAME }}
100
100
if-no-files-found : error
101
101
102
- - name : Comment on PR with results
103
- if : github.event_name == 'pull_request'
104
- uses : actions/github-script@v7
105
- with :
106
- github-token : ${{ secrets.GITHUB_TOKEN }}
107
- script : |
108
- const fs = require('fs');
109
- const evolutionPlotPath = '${{ env.ARTIFACT_PATH }}/${{ env.ARTIFACT_NAME }}';
110
- const shortSha = context.sha.substring(0, 7);
111
- const workflowUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
112
-
113
- let plotSection = '';
114
-
115
- try {
116
- if (fs.existsSync(evolutionPlotPath)) {
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
-
143
- plotSection = `
144
- ### Detailed Evolution Plot
145
- <details><summary>Click to view evolution plot</summary>
146
-
147
- 
148
- </details>`;
149
- } else {
150
- plotSection = '\n### ⚠️ Evolution plot not found';
151
- }
152
- } catch (error) {
153
- plotSection = `\n### ⚠️ Evolution plot error: ${error.message}`;
154
- }
155
-
156
- await github.rest.issues.createComment({
157
- issue_number: context.issue.number,
158
- owner: context.repo.owner,
159
- repo: context.repo.repo,
160
- body: `
161
-
162
- ## ✅ COMPAS Build Successful!
163
-
164
- | Item | Value |
165
- |------|-------|
166
- | **Commit** | [\`${shortSha}\`](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/commit/${context.sha}) |
167
- | **Logs** | [View workflow](${workflowUrl}) |
168
- ${plotSection}
169
-
170
- ---
171
- <sub>Generated by COMPAS CI</sub>`
172
- });
173
-
174
102
- name : Test Summary
175
103
run : |
176
104
echo "### COMPAS CI Results" >> $GITHUB_STEP_SUMMARY
177
105
echo "- COMPAS Build: Success" >> $GITHUB_STEP_SUMMARY
178
106
echo "- Python Dependencies: Success" >> $GITHUB_STEP_SUMMARY
179
107
echo "- Example COMPAS Job: Success" >> $GITHUB_STEP_SUMMARY
180
- echo "- Pytest Suite: Success" >> $GITHUB_STEP_SUMMARY
108
+ echo "- Pytest Suite: Success" >> $GITHUB_STEP_SUMMARY
109
+
110
+ comment-with-plot :
111
+ name : Comment PR with Evolution Plot
112
+ runs-on : ubuntu-22.04
113
+ container : docker://ghcr.io/iterative/cml:0-dvc2-base1
114
+ needs : compas
115
+ if : github.event_name == 'pull_request'
116
+
117
+ env :
118
+ ARTIFACT_NAME : detailedEvolutionPlot.png
119
+
120
+ steps :
121
+ - name : Download evolution plot
122
+ uses : actions/download-artifact@v4
123
+ with :
124
+ name : evolution-plot-${{ github.run_number }}
125
+
126
+ - name : Create report with evolution plot
127
+ env :
128
+ REPO_TOKEN : ${{ secrets.GITHUB_TOKEN }}
129
+ run : |
130
+ echo "## ✅ COMPAS Build Successful!" >> report.md
131
+ echo "" >> report.md
132
+ echo "| Item | Value |" >> report.md
133
+ echo "|------|-------|" >> report.md
134
+ echo "| **Commit** | [\`${GITHUB_SHA:0:7}\`](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}) |" >> report.md
135
+ echo "| **Logs** | [View workflow](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}) |" >> report.md
136
+ echo "" >> report.md
137
+
138
+ if [ -f "${{ env.ARTIFACT_NAME }}" ]; then
139
+ echo "### 📊 Detailed Evolution Plot" >> report.md
140
+ echo "<details><summary>Click to view evolution plot</summary>" >> report.md
141
+ echo "" >> report.md
142
+ echo "" >> report.md
143
+ echo "</details>" >> report.md
144
+ else
145
+ echo "### ⚠️ Evolution plot not found" >> report.md
146
+ fi
147
+
148
+ echo "" >> report.md
149
+ echo "---" >> report.md
150
+ echo "<sub>Generated by COMPAS CI with CML</sub>" >> report.md
151
+
152
+ # Post the report using CML
153
+ cml comment create report.md
0 commit comments