@@ -94,44 +94,10 @@ jobs:
9494 permissions :
9595 pull-requests : write
9696 steps :
97- - name : Post a PR comment if the size has changed
98- uses : actions/github-script@v6
99- env :
100- SIZE_REFERENCE : ${{ needs.measure.outputs.binary-size-reference }}
101- SIZE_UPDATED : ${{ needs.measure.outputs.binary-size-updated }}
97+ # Clone backtrace to access Github composite actions to report size.
98+ - uses : actions/checkout@v3
99+ # Run the size reporting action.
100+ - uses : ./.github/actions/report-code-size-changes
102101 with :
103- script : |
104- const reference = process.env.SIZE_REFERENCE;
105- const updated = process.env.SIZE_UPDATED;
106-
107- if (!(reference > 0)) {
108- core.setFailed(`Reference size invalid: ${reference}`);
109- return;
110- }
111-
112- if (!(updated > 0)) {
113- core.setFailed(`Updated size invalid: ${updated}`);
114- return;
115- }
116-
117- const diff = updated - reference;
118- const plus = diff > 0 ? "+" : "";
119- const diff_str = `${plus}${diff}B`;
120-
121- if (diff !== 0) {
122- const percent = (((updated / reference) - 1) * 100).toFixed(2);
123- // The body is created here and wrapped so "weirdly" to avoid whitespace at the start of the lines,
124- // which is interpreted as a code block by Markdown.
125- const body = `Below is the size of a hello-world Rust program linked with libstd with backtrace.
126-
127- Original binary size: **${reference}B**
128- Updated binary size: **${updated}B**
129- Difference: **${diff_str}** (${percent}%)`;
130-
131- github.rest.issues.createComment({
132- issue_number: context.issue.number,
133- owner: context.repo.owner,
134- repo: context.repo.repo,
135- body
136- })
137- }
102+ reference : ${{ needs.measure.outputs.binary-size-reference }}
103+ updated : ${{ needs.measure.outputs.binary-size-updated }}
0 commit comments