@@ -310,13 +310,93 @@ jobs:
310310 "--workflow.generator.workflows.release-train.test.env.COMMERCIAL_REPO_PASSWORD=secrets.COMMERCIAL_ARTIFACTORY_PASSWORD"
311311
312312 - name : Commit and push changes
313+ id : commit
313314 working-directory : repo
314315 run : |
315316 git add .github/
316317 if git diff --staged --quiet; then
317318 echo "No changes to commit for ${{ matrix.repo }}@${{ matrix.branch }}."
319+ echo "changed=false" >> "$GITHUB_OUTPUT"
318320 else
319321 git commit -m "Update generated GitHub Actions workflow files"
320322 git push
321323 echo "Changes pushed to ${{ matrix.repo }}@${{ matrix.branch }}."
324+ echo "changed=true" >> "$GITHUB_OUTPUT"
322325 fi
326+
327+ - name : Record result
328+ if : always()
329+ id : record
330+ env :
331+ REPO : ${{ matrix.repo }}
332+ BRANCH : ${{ matrix.branch }}
333+ CHANGED : ${{ steps.commit.outputs.changed }}
334+ run : |
335+ safe="${REPO//\//-}-${BRANCH//\//-}"
336+ safe="${safe//./-}"
337+ echo "safe-name=${safe}" >> "$GITHUB_OUTPUT"
338+ echo '{"repo":"'"$REPO"'","branch":"'"$BRANCH"'","changed":'"${CHANGED:-false}"'}' \
339+ > "result-${safe}.json"
340+
341+ - name : Upload result
342+ if : always()
343+ uses : actions/upload-artifact@v4
344+ with :
345+ name : result-${{ steps.record.outputs.safe-name }}
346+ path : result-${{ steps.record.outputs.safe-name }}.json
347+
348+ summary :
349+ name : Summary
350+ needs : generate
351+ runs-on : ubuntu-latest
352+ if : always()
353+ steps :
354+ - name : Download results
355+ uses : actions/download-artifact@v4
356+ with :
357+ pattern : result-*
358+ merge-multiple : true
359+ path : results
360+
361+ - name : Write summary
362+ run : |
363+ node - << 'JSEOF'
364+ const fs = require('fs');
365+ const path = require('path');
366+
367+ const files = fs.readdirSync('results').filter(f => f.endsWith('.json'));
368+ const results = files
369+ .map(f => JSON.parse(fs.readFileSync(path.join('results', f), 'utf8')))
370+ .sort((a, b) => {
371+ if (a.changed !== b.changed) return a.changed ? -1 : 1;
372+ return `${a.repo}@${a.branch}`.localeCompare(`${b.repo}@${b.branch}`);
373+ });
374+
375+ const updated = results.filter(r => r.changed);
376+ const unchanged = results.filter(r => !r.changed);
377+
378+ let md = '## Workflow Generator Results\n\n';
379+
380+ if (updated.length > 0) {
381+ md += `### Updated (${updated.length})\n\n`;
382+ md += '| Repository | Branch |\n|---|---|\n';
383+ for (const r of updated) {
384+ md += `| \`${r.repo}\` | \`${r.branch}\` |\n`;
385+ }
386+ md += '\n';
387+ } else {
388+ md += '> No changes were made.\n\n';
389+ }
390+
391+ if (unchanged.length > 0) {
392+ md += `<details><summary>Unchanged (${unchanged.length})</summary>\n\n`;
393+ md += '| Repository | Branch |\n|---|---|\n';
394+ for (const r of unchanged) {
395+ md += `| \`${r.repo}\` | \`${r.branch}\` |\n`;
396+ }
397+ md += '\n</details>\n';
398+ }
399+
400+ fs.appendFileSync(process.env.GITHUB_STEP_SUMMARY, md);
401+ console.log(md);
402+ JSEOF
0 commit comments