Skip to content

Commit 18ff20d

Browse files
committed
ci: generate build summary
Signed-off-by: Yi Huang <[email protected]>
1 parent 924ace7 commit 18ff20d

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/build.yml

+47
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,50 @@ jobs:
3434
plugins: ${{ toJSON(matrix.plugins) }}
3535
version: ${{ needs.get-versions.outputs.version }}
3636
secrets: inherit
37+
38+
check-artifacts:
39+
if: ${{ !cancelled() }} # TODO: check output from `get-versions` and `parse-plugins`
40+
needs:
41+
- get-versions
42+
- parse-plugins
43+
- linux
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v4
47+
- uses: actions/github-script@v7
48+
with:
49+
script: |
50+
const fs = require("fs");
51+
const raw = JSON.parse(fs.readFileSync(".github/plugins.json"));
52+
53+
core.summary.addHeading('Build Summary');
54+
55+
let table = [
56+
[{data: 'plugin/platform', header: true}],
57+
];
58+
let platforms = [];
59+
Object.entries(raw.platforms).forEach(([key, platform]) => {
60+
table[0].push({data: key, header: true});
61+
platforms.push([platform.plugin_tag, platform.asset_tag].filter((tag) => tag !== undefined));
62+
});
63+
64+
let artifacts = await github
65+
.paginate(github.rest.actions.listWorkflowRunArtifacts, {
66+
owner: context.repo.owner,
67+
repo: context.repo.repo,
68+
run_id: context.runId,
69+
});
70+
71+
Object.keys(raw.plugins).forEach((plugin) => {
72+
let row = [{data: plugin, header: true}];
73+
let filtered = artifacts.filter((artifact) => artifact.name.includes(plugin));
74+
platforms.forEach((tags) => {
75+
row.push({
76+
data: filtered.some((artifact) => tags.every((tag) => artifact.name.includes(tag))) ? ':ok:' : ':x:'
77+
});
78+
});
79+
table.push(row);
80+
});
81+
82+
core.summary.addTable(table);
83+
core.summary.write()

0 commit comments

Comments
 (0)