1- name : Size Check
1+ name : Build Results
22
33on :
44 workflow_run :
@@ -11,12 +11,15 @@ permissions:
1111 pull-requests : write
1212
1313jobs :
14- check-size :
14+ check-sizes :
1515 name : Check Artifact Sizes
1616 runs-on : ubuntu-latest
1717 if : github.event.workflow_run.conclusion == 'success'
1818 timeout-minutes : 15
1919
20+ outputs :
21+ sizes-json : ${{ steps.sizes.outputs.json }}
22+
2023 steps :
2124 - name : Checkout
2225 uses : actions/checkout@v6
3942 --output sizes.json \
4043 --summary "$GITHUB_STEP_SUMMARY" \
4144 --no-fail
42- python tools/check-sizes.py artifacts/ --markdown > sizes.md
45+ echo "json=$(jq -c . sizes.json)" >> $GITHUB_OUTPUT
4346
4447 - name : Upload size report
4548 uses : actions/upload-artifact@v5
@@ -68,10 +71,10 @@ jobs:
6871 echo "::warning::Artifact size thresholds exceeded. See size report for details."
6972 fi
7073
71- comment -pr :
72- name : Post Size Comment
74+ post -pr-comment :
75+ name : Post Build Results
7376 runs-on : ubuntu-latest
74- needs : check-size
77+ needs : check-sizes
7578 if : github.event.workflow_run.event == 'pull_request'
7679 timeout-minutes : 10
7780
@@ -99,7 +102,67 @@ jobs:
99102 });
100103 return prs.data.length > 0 ? prs.data[0].number : null;
101104
102- - name : Download PR artifacts
105+ - name : Collect build status
106+ if : steps.pr.outputs.result != 'null'
107+ id : builds
108+ uses : actions/github-script@v7
109+ with :
110+ script : |
111+ const headSha = context.payload.workflow_run.head_sha;
112+
113+ const runs = await github.rest.actions.listWorkflowRunsForRepo({
114+ owner: context.repo.owner,
115+ repo: context.repo.repo,
116+ head_sha: headSha,
117+ per_page: 100
118+ });
119+
120+ const platforms = {
121+ 'Linux': { status: '⏳', conclusion: 'pending', url: '' },
122+ 'Windows': { status: '⏳', conclusion: 'pending', url: '' },
123+ 'MacOS': { status: '⏳', conclusion: 'pending', url: '' },
124+ 'Android': { status: '⏳', conclusion: 'pending', url: '' }
125+ };
126+
127+ for (const run of runs.data.workflow_runs) {
128+ if (platforms[run.name]) {
129+ if (run.status === 'completed') {
130+ platforms[run.name].status = run.conclusion === 'success' ? '✅' : '❌';
131+ platforms[run.name].conclusion = run.conclusion;
132+ platforms[run.name].url = run.html_url;
133+ } else if (run.status === 'in_progress') {
134+ platforms[run.name].status = '🔄';
135+ platforms[run.name].conclusion = 'in_progress';
136+ platforms[run.name].url = run.html_url;
137+ }
138+ }
139+ }
140+
141+ let table = '| Platform | Status | Details |\n|----------|--------|--------|\n';
142+ for (const [name, info] of Object.entries(platforms)) {
143+ const link = info.url ? `[View](${info.url})` : '-';
144+ table += `| ${name} | ${info.status} | ${link} |\n`;
145+ }
146+
147+ const allComplete = Object.values(platforms).every(p =>
148+ ['success', 'failure', 'cancelled'].includes(p.conclusion)
149+ );
150+ const allSuccess = Object.values(platforms).every(p => p.conclusion === 'success');
151+
152+ let summary = '';
153+ if (allComplete) {
154+ summary = allSuccess
155+ ? '✅ All builds passed!'
156+ : '❌ Some builds failed.';
157+ } else {
158+ summary = '⏳ Some builds still in progress...';
159+ }
160+
161+ core.setOutput('table', table);
162+ core.setOutput('summary', summary);
163+ core.setOutput('all_complete', allComplete);
164+
165+ - name : Download PR artifacts for size comparison
103166 if : steps.pr.outputs.result != 'null'
104167 uses : actions/download-artifact@v5
105168 with :
@@ -115,12 +178,27 @@ jobs:
115178 path : baseline-sizes.json
116179 key : artifact-sizes-baseline-latest
117180
118- - name : Compare sizes
181+ - name : Generate combined report
119182 if : steps.pr.outputs.result != 'null'
120- id : compare
121183 run : |
122- python tools/check-sizes.py artifacts-pr/ --json --output pr-sizes.json --no-fail
123- python3 << 'EOF'
184+ cat > comment.md << 'HEADER'
185+ ## 🏗️ Build Results
186+
187+ ### Platform Status
188+
189+ ${{ steps.builds.outputs.table }}
190+ **${{ steps.builds.outputs.summary }}**
191+
192+ HEADER
193+
194+ # Generate size report
195+ python tools/check-sizes.py artifacts-pr/ --json --output pr-sizes.json --no-fail 2>/dev/null || true
196+
197+ if [[ -f "pr-sizes.json" ]]; then
198+ echo "### 📦 Artifact Sizes" >> comment.md
199+ echo "" >> comment.md
200+
201+ python3 << 'EOF'
124202 import json
125203 import os
126204
@@ -133,7 +211,7 @@ jobs:
133211 baseline_data = json.load(f)
134212 baseline = {a['name']: a for a in baseline_data.get('artifacts', [])}
135213
136- lines = ['## 📦 Artifact Size Report', '' ]
214+ lines = []
137215
138216 if baseline:
139217 lines.extend([
@@ -147,10 +225,10 @@ jobs:
147225 ])
148226
149227 total_delta = 0
150- for a in pr_data[ 'artifacts'] :
228+ for a in pr_data.get( 'artifacts', []) :
151229 name = a['name']
152230 size = a['size_human']
153- status = '⚠️' if a[ 'exceeds_threshold'] else '✅'
231+ status = '⚠️' if a.get( 'exceeds_threshold') else '✅'
154232
155233 if baseline and name in baseline:
156234 old_size = baseline[name]['size_bytes']
@@ -167,25 +245,33 @@ jobs:
167245
168246 lines.append(f'| {name} | {size} | {delta_str} | {status} |')
169247 else:
170- threshold = f"{a[ 'threshold_mb'] } MB" if a[ 'threshold_mb'] else '-'
248+ threshold = f"{a.get( 'threshold_mb', '-') } MB" if a.get( 'threshold_mb') else '-'
171249 lines.append(f'| {name} | {size} | {threshold} | {status} |')
172250
173251 lines.append('')
174252 if baseline and total_delta != 0:
175253 direction = 'increased' if total_delta > 0 else 'decreased'
176254 lines.append(f'**Total size {direction} by {abs(total_delta) / 1024 / 1024:.2f} MB**')
177255 elif not baseline:
178- lines.append('*No baseline available for comparison (first build or cache expired) *')
256+ lines.append('*No baseline available for comparison*')
179257
180- with open('size-comment .md', 'w') as f:
258+ with open('sizes-section .md', 'w') as f:
181259 f.write('\n'.join(lines))
182260 EOF
183- cat size-comment.md
184261
185- - name : Post PR comment
262+ cat sizes-section.md >> comment.md
263+ fi
264+
265+ echo "" >> comment.md
266+ echo "---" >> comment.md
267+ echo "<sub>Updated: $(date -u '+%Y-%m-%d %H:%M:%S UTC')</sub>" >> comment.md
268+
269+ cat comment.md
270+
271+ - name : Post combined comment
186272 if : steps.pr.outputs.result != 'null'
187273 uses : thollander/actions-comment-pull-request@v3
188274 with :
189275 pr-number : ${{ steps.pr.outputs.result }}
190- comment-tag : artifact-sizes
191- file-path : size- comment.md
276+ comment-tag : build-results
277+ file-path : comment.md
0 commit comments