-
-
Notifications
You must be signed in to change notification settings - Fork 8
Support using sketches reports from local path #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## main #5 +/- ##
========================================
Coverage ? 100.00%
========================================
Files ? 2
Lines ? 700
Branches ? 0
========================================
Hits ? 700
Misses ? 0
Partials ? 0 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 Thank you @per1234 🚀
@per1234 please resolve the conflict within README.md before merging. |
The test was triggering an intentional delay in a function, resulting in this test causing a signficant increase in the time required to run the unit tests. The solution was to simply fake time.sleep() so it no longer causes a delay.
…urce-name Preparation to use the input for specifying the source of sketches reports either in a workflow artifact or a local folder. The old input name is still supported but warning will be displayed in the build log to explain the name change.
The action was previously designed to only run from a scheduled workflow. The reason is that it needs a token with write permissions to comment on the PR, but due to security restrictions there is no way to have such a token when a workflow is triggered by a pull_request event from a fork. This is problematic for private repos because if the schedule is set to a short interval the action will use up the free GitHub actoins minutes allocation quickly (public repos have unlimited minutes). If the schedule is set to a long interval, then there is a long potential wait time for the report. A common work flow in private repos is for PRs to be submitted from branches, not forks, which makes it possible to trigger the action from the PR. Running from a pull request triggered workflow should actually work as the action was, but the method of finding the artifact is very inefficient and unintuitive in that context. Recently, GitHub added the ability for private repositories to allow write permissions for workflows triggered by pull requests, making it even more likely this method of using the action will be found useful: https://docs.github.com/en/github/administering-a-repository/disabling-or-limiting-github-actions-for-a-repository#enabling-workflows-for-private-repository-forks
…() into separate functions The addition of support for sourcing the sketches reports from a local path resulted in the function containing code for two completely separate usages of the script. Moving each flavor of code to a separate function improves readability, maintainability, and testability.
I decided the "-name" part of the input name was superfluous. This is part of a single PR, so no further backwards compatibility measures are necessary. I just don't feel like making the effort to fixup the previous name change commit and deal with all the conflicts while rebasing.
@aentinger I have now resolved the merge conflict. |
The action was previously designed to only run from a scheduled workflow. The reason is that it needs a token with write permissions to comment on the PR, but due to security restrictions there is no way to have such a token when a
workflow is triggered by a pull_request event from a fork.
This is problematic for private repos because if the schedule is set to a short interval the action will use up the free GitHub actoins minutes allocation quickly (public repos have unlimited minutes). If the schedule is set to a long
interval, then there is a long potential wait time for the report.
A common work flow in private repos is for PRs to be submitted from branches, not forks, which makes it possible to trigger the action from the PR.
Running from a pull request triggered workflow should actually work as the action was, but the method of finding the artifact is very inefficient and unintuitive in that context.
Recently, GitHub added the ability for private repositories to allow write permissions for workflows triggered by pull requests, making it even more likely this method of using the action will be found useful:
https://docs.github.com/en/github/administering-a-repository/disabling-or-limiting-github-actions-for-a-repository#enabling-workflows-for-private-repository-forks
Due to now supporting multiple sources of sketches reports, the input name
size-deltas-reports-artifact-name
was no longer appropriate (this input is now used for specifying the workflow artifact name when used in the traditional scheduled workflow method and for specifying the local folder name when using the new pull request triggered workflow method), so it has been renamedsketches-reports-source
.The previous input name is still supported, but a warning will be displayed in the build log recommending switching to the new input name.
Demonstration of the action used in a pull request triggered workflow:
https://github.com/per1234/report-size-deltas/pull/1#issuecomment-691649959
This is using the exact workflow from the readme, except with the
arduino/report-size-deltas@main
action name changed toper1234/report-size-deltas@local-report-support
so it can use the version of the action with the implementation of this proposal.