mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-04 22:57:50 +03:00
Compare commits
2 Commits
cb95ddbd04
...
a540edd437
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a540edd437 | ||
|
|
c008d238d5 |
14
.github/workflows/ci.yml
vendored
14
.github/workflows/ci.yml
vendored
@ -72,6 +72,10 @@ jobs:
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
pio run | tee pio.log
|
pio run | tee pio.log
|
||||||
|
|
||||||
|
- name: Capture short SHA
|
||||||
|
id: short_sha
|
||||||
|
run: echo "short=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Extract firmware stats
|
- name: Extract firmware stats
|
||||||
id: fw_stats
|
id: fw_stats
|
||||||
run: |
|
run: |
|
||||||
@ -89,7 +93,7 @@ jobs:
|
|||||||
- name: Upload firmware.bin artifact
|
- name: Upload firmware.bin artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
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) }}
|
name: ${{ github.event_name == 'pull_request' && format('firmware-bin-pr-{0}-{1}', github.event.pull_request.number, steps.short_sha.outputs.short) || format('firmware-bin-{0}', steps.short_sha.outputs.short) }}
|
||||||
path: .pio/build/default/firmware.bin
|
path: .pio/build/default/firmware.bin
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
@ -102,9 +106,10 @@ jobs:
|
|||||||
const ram = `${{ steps.fw_stats.outputs.ram_line }}`.trim();
|
const ram = `${{ steps.fw_stats.outputs.ram_line }}`.trim();
|
||||||
const flash = `${{ steps.fw_stats.outputs.flash_line }}`.trim();
|
const flash = `${{ steps.fw_stats.outputs.flash_line }}`.trim();
|
||||||
const prNumber = context.payload.pull_request?.number;
|
const prNumber = context.payload.pull_request?.number;
|
||||||
|
const shortSha = `${{ steps.short_sha.outputs.short }}`.trim() || context.sha.substring(0, 7);
|
||||||
const artifactName = prNumber
|
const artifactName = prNumber
|
||||||
? `firmware-bin-pr-${prNumber}-${context.sha}`
|
? `firmware-bin-pr-${prNumber}-${shortSha}`
|
||||||
: `firmware-bin-${context.sha}`;
|
: `firmware-bin-${shortSha}`;
|
||||||
let firmwareLine = 'Firmware: artifact not found';
|
let firmwareLine = 'Firmware: artifact not found';
|
||||||
try {
|
try {
|
||||||
const { data: artifacts } = await github.rest.actions.listWorkflowRunArtifacts({
|
const { data: artifacts } = await github.rest.actions.listWorkflowRunArtifacts({
|
||||||
@ -114,7 +119,8 @@ jobs:
|
|||||||
});
|
});
|
||||||
const firmwareArtifact = artifacts.artifacts.find((artifact) => artifact.name === artifactName);
|
const firmwareArtifact = artifacts.artifacts.find((artifact) => artifact.name === artifactName);
|
||||||
if (firmwareArtifact) {
|
if (firmwareArtifact) {
|
||||||
firmwareLine = `Firmware: [firmware.bin artifact](${firmwareArtifact.archive_download_url})`;
|
const artifactUiUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}/artifacts/${firmwareArtifact.id}`;
|
||||||
|
firmwareLine = `Firmware: [${artifactName}](${artifactUiUrl})`;
|
||||||
} else {
|
} else {
|
||||||
firmwareLine = `Firmware: artifact not found (${artifactName})`;
|
firmwareLine = `Firmware: artifact not found (${artifactName})`;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user