Currently the base ref has to be the branch that a PR will be merged into. However, this is restrictive for some workflows such as using release-please where the release PR actually only represents the version bump in package.json etc which is unlikely to meaningfully change the final built size, so this information is not useful.
For these cases, it'd be more useful to be able to specify that it compare against a known ref, such as the previous release tag.
This would allow monitoring the change in package size not just over single PRs, but the cumulative effect over all PRs that are going into a release.
Proposed API
- uses: preactjs/compressed-size-action@v2
with:
base-ref: "v1.2.0" # compare against a specific tag/ref instead of the PR base branch
Implementation notes
The change should be small — src/index.js already resolves baseRef/baseSha from the PR context. Adding a getInput('base-ref') that overrides baseRef before the existing fetch/checkout logic would be sufficient. ~5 lines:
action.yml — add a base-ref input
src/index.js — after lines 22-38 where baseRef/baseSha are resolved, add an override like:
const inputBaseRef = getInput('base-ref');
if (inputBaseRef) {
baseRef = inputBaseRef;
baseSha = null;
}
Let me know if you'd like me to raise a PR for this change
Currently the base ref has to be the branch that a PR will be merged into. However, this is restrictive for some workflows such as using release-please where the release PR actually only represents the version bump in package.json etc which is unlikely to meaningfully change the final built size, so this information is not useful.
For these cases, it'd be more useful to be able to specify that it compare against a known ref, such as the previous release tag.
This would allow monitoring the change in package size not just over single PRs, but the cumulative effect over all PRs that are going into a release.
Proposed API
Implementation notes
The change should be small —
src/index.jsalready resolvesbaseRef/baseShafrom the PR context. Adding agetInput('base-ref')that overridesbaseRefbefore the existing fetch/checkout logic would be sufficient. ~5 lines:action.yml — add a base-ref input
src/index.js — after lines 22-38 where baseRef/baseSha are resolved, add an override like:
Let me know if you'd like me to raise a PR for this change