mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-04 14:47:37 +03:00
Compare commits
2 Commits
79f64603ef
...
74d28daf42
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74d28daf42 | ||
|
|
cb95ddbd04 |
31
.github/workflows/ci.yml
vendored
31
.github/workflows/ci.yml
vendored
@ -86,7 +86,14 @@ jobs:
|
||||
if [ -n "$flash_line" ]; then echo "- ${flash_line}"; else echo "- Flash: not found"; fi
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
- name: Comment PR with firmware stats
|
||||
- name: Upload firmware.bin artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ github.event_name == 'pull_request' && format('firmware-bin-pr-{0}-{1}', github.event.pull_request.number, github.sha) || format('firmware-bin-{0}', github.sha) }}
|
||||
path: .pio/build/default/firmware.bin
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Comment PR with firmware stats and firmware.bin
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
@ -94,7 +101,27 @@ jobs:
|
||||
const marker = '<!-- firmware-stats -->';
|
||||
const ram = `${{ steps.fw_stats.outputs.ram_line }}`.trim();
|
||||
const flash = `${{ steps.fw_stats.outputs.flash_line }}`.trim();
|
||||
const body = `${marker}\n**Firmware build stats**\n\n\`\`\`\n${ram || 'RAM: not found'}\n${flash || 'Flash: not found'}\n\`\`\``;
|
||||
const prNumber = context.payload.pull_request?.number;
|
||||
const artifactName = prNumber
|
||||
? `firmware-bin-pr-${prNumber}-${context.sha}`
|
||||
: `firmware-bin-${context.sha}`;
|
||||
let firmwareLine = 'Firmware: artifact not found';
|
||||
try {
|
||||
const { data: artifacts } = await github.rest.actions.listWorkflowRunArtifacts({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
run_id: context.runId,
|
||||
});
|
||||
const firmwareArtifact = artifacts.artifacts.find((artifact) => artifact.name === artifactName);
|
||||
if (firmwareArtifact) {
|
||||
firmwareLine = `Firmware: [firmware.bin artifact](${firmwareArtifact.archive_download_url})`;
|
||||
} else {
|
||||
firmwareLine = `Firmware: artifact not found (${artifactName})`;
|
||||
}
|
||||
} catch (error) {
|
||||
firmwareLine = `Firmware: artifact lookup failed (${error.message})`;
|
||||
}
|
||||
const body = `${marker}\n**Firmware build stats**\n\n\`\`\`\n${ram || 'RAM: not found'}\n${flash || 'Flash: not found'}\n\`\`\`\n\n**Firmware binary**\n${firmwareLine}`;
|
||||
const { data: comments } = await github.rest.issues.listComments({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user