Crates.io | arduino-report-size-deltas |
lib.rs | arduino-report-size-deltas |
version | 1.0.2 |
created_at | 2025-07-18 20:26:49.548757+00 |
updated_at | 2025-08-18 14:12:00.674733+00 |
description | Post a comment on the pull request with a report about the change in memory usage of Arduino sketches |
homepage | |
repository | https://github.com/2bndy5/arduino-report-size-deltas |
max_upload_size | |
id | 1759657 |
size | 206,262 |
A CLI tool designed for CI workflows that posts comments on a Pull Request about the memory size of Arduino sketches.
This is a port of arduino/report-size-deltas
GitHub action from python to rust.
sketches-reports-source
The path to the folder containing sketches' reports (JSON files).
The default value is "sketches-reports"
when not specified.
token
The GitHub access token used to post comments on the Pull Request thread.
Uses github.token
by default.
This is only used for Pull Request events.
The following example workflow will compile sketches, save reports as artifacts, and submit a summarizing comment.
name: Get Compile Size
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
compile-sketches:
runs-on: ubuntu-latest
strategy:
matrix:
fqbn: [arduino::avr::uno, arduino::samd::mkrzero]
steps:
- uses: actions/checkout@v4
- uses: arduino/compile-sketches@v1
with:
fqbn: ${{ matrix.fqbn }}
enable-deltas-report: true
- uses: actions/upload-artifact@v4
with:
path: sketches-reports
name: sketches-reports_${{ matrix.fqbn }}
report-delta-size:
needs: [compile-sketches]
runs-on: ubuntu-latest
permissions:
# permission needed to create comments on a Pull Request
pull-requests: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: sketches-reports_*
path: sketches-reports
- name: Report size deltas
uses: 2bndy5/arduino-report-size-deltas@v1.0.2
pull_request
When this action is triggered by a pull_request
event,
it will post a thread comment summarizing the change in compiled sizes.
In this scenario, the given GitHub token
needs
write permission for pull-requests
(see example above) to post a comment.
Any existing report comment is updated. If for some reason, there are multiple report comments found, then all report comments except the latest are deleted. And only the latest found report comment is updated.
Only comments created by this action are manipulated.
pull_request
When this action is not triggered by a pull_request
event,
it will append the summary comment to the workflow's run summary page.
In this scenario, no special permissions are needed.
The original GitHub Action has some disadvantages:
Some features present in the original GitHub Action are not implemented in this port. These features can be added upon request, but the utility of the feature should be "Generally Applicable"; meaning the feature does not just satisfy an individual use case.
The CSV output used in the original GitHub Action is not included in this action's posted comment. This is because CSV is a machine-readable syntax that is better served via programmatic means. If you need CSV output, please submit a feature request so we can discuss the best approach toward integration.
Often called "cron jobs", the original GitHub Action supported GitHub's schedule workflow trigger. In this case, the original GitHub Action would
arduino/compile-sketches
action.
This involves traversing each commit on each Pull Request to find the latest applicable artifacts.This feature adds a lot of complexity to satisfy an unknown use case. There are no feature requests in the original GitHub Action history (or its original experimental source) that describe a problem this feature would solve.
Again, a request for this feature is welcome. But, the rationale for such complexity should be stated clearly in a way that is beneficial to the Arduino Community at large, not just beneficial to the Arduino GitHub Organization.
Steps 2 and 3 could easily lock out the given token
's read/write access by surpassing the
GitHub REST API's rate limits.
Additionally, force pushed commits on a feature branch can cause some workflow runs to correspond with orphaned commits. This further increases the possibility of violating the GitHub REST API's rate limits.
The discovered artifacts are not guaranteed to be produced by the arduino/compile-sketches
action.
In the original GitHub Action, the name of the artifact (not the JSON file name) is matched against the
sketches-reports-source
input value.
This approach introduces a surface area for undefined behavior because the
artifacts' JSON data/content is not verified (for which the solution would further increase the
possibility of violating the GitHub REST API's rate limits).