Repository navigation
[NOJIRA] Expose adoption comparison action outputs - #4966
Conversation
|
Visit https://backpack.github.io/storybook-prs/4966 to see this build running in a browser. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Expose the adoption comparison already computed by backpack-adoption-guard as GitHub Action outputs, enabling downstream workflows to report Head/Base/Delta without re-running base analysis.
Changes:
- Added
head-backpack-adoption,base-backpack-adoption, andbackpack-adoption-deltaas Action outputs. - Implemented
setOutputplumbing in the action IO layer and emits outputs fromrun. - Updated README and added unit test assertions for emitted outputs.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/backpack-adoption-guard/src/action/run.ts | Emits the new GitHub Action outputs based on the already-computed comparison. |
| packages/backpack-adoption-guard/src/action/run-test.ts | Adds unit assertions verifying the outputs are set. |
| packages/backpack-adoption-guard/src/action/io.ts | Extends ActionIO to include setOutput and wires it to @actions/core. |
| packages/backpack-adoption-guard/action.yml | Declares the new outputs in the action metadata. |
| packages/backpack-adoption-guard/README.md | Documents the new outputs for consumers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Visit https://backpack.github.io/storybook-prs/4966 to see this build running in a browser. |
| headBackpackPercentage, | ||
| } = result.comparison; | ||
|
|
||
| io.setOutput(ADOPTION_OUTPUTS.head, String(headBackpackPercentage)); |
There was a problem hiding this comment.
action.yml/README says these outputs are "rounded to at most two decimal places," but this layer just does String(...) — the rounding actually happens upstream in the analyzer. So the documented format is accurate only by coincidence, and the tests (asserting String(result.comparison.…)) wouldn't catch a drift.
Either round explicitly here + assert the exact string in a test, or soften the docs to just "numeric string."
There was a problem hiding this comment.
Addressed in e44da5d. Output formatting is now enforced at the action boundary: non-empty values use toFixed(2) and unavailable values remain empty strings. The action metadata and README now specify exactly two decimal places, and the tests assert concrete values (100.00, 0.00).
|
Visit https://backpack.github.io/storybook-prs/4966 to see this build running in a browser. |
Summary
Expose the adoption comparison already calculated by
backpack-adoption-guardas GitHub Action outputs:head-backpack-adoptionbase-backpack-adoptionbackpack-adoption-deltaThis lets consuming workflows publish Head/Base/Delta in a PR comment without checking out the base ref or running the guard a second time. The existing Cortex JSON result schema is unchanged.
Why
The guard already calculates the comparison for PR evaluation, but previously only persisted the Head metric in its JSON file. Consumers therefore had to duplicate the Base calculation solely for presentation.
Consumer impact
This is a backwards-compatible, additive action API change. Consumers can use the new outputs after upgrading to the next guard release.
Apply the
minorlabel.Validation
packages/backpack-adoption-guard/README.mdgit diff --checkpassed