Closed per1234 closed 9 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
57289ee
) 100.00% compared to head (d590a75
) 100.00%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
In the use case where the arduino/report-size-deltas action is ran from a GitHub Actions workflow triggered by a
schedule
event, it downloads the sketches report file from a workflow artifact.The GitHub REST API is used to perform this artifact download. The artifact download process is:
/repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format}
endpointThe API request at step (1) must be authenticated using a GitHub access token. This token is passed via the
Authorization
HTTP header in the request.No authentication is required for the download request at step (3).
The
urllib.request
Python module is used to perform the HTTP requests. By default, this module [passes the headers from the original request to the redirect request](https://docs.python.org/3/library/urllib.request.html#urllib.request.Request:~:text=will%20be%20treated%20as%20if%20add_header()%20was%20called%20with%20each%20key%20and%20value%20as%20arguments).Although these headers were superfluous, they didn't affect the download request when the target artifact was of the v1 format generated by version 3.x and earlier of the actions/upload-artifact action. A new v2 artifact format was introduced in the 4.0.0 release of the actions/upload-artifact action. Previously, the request at step (3) of the artifact download procedure would fail when the target artifact had the v2 format:
https://github.com/arduino/report-size-deltas/actions/runs/7633691244/job/20796387110#step:3:164
The cause of the failure was the inclusion of the
Authorization
HTTP header in the download request. Theurllib.request
Python module can be configured to pass a header in the original request but not in the redirected request by defining the header via theRequest.add_unredirected_header
method instead of in theRequest
instantiation. This provides compatibility for using the action with v2 format artifacts.