Skip to content
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

Add bundle size reports to the PR description #5280

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

Leah-Xia-Microsoft
Copy link
Member

@Leah-Xia-Microsoft Leah-Xia-Microsoft commented Oct 8, 2024

What

  • Add/update the bundle size reports to the bottom of the PR description
  • Remove the bundle size comments
  • Block PR if the bundle size change is greater than the significant threshold and no tag is added

Why

How Tested

  • After adding a testing commit to increase the bundle size, the chat bundle size has been updated in the description.
    image

  • And the CI job fails with the correct error message
    image

  • After adding the significant bundle size change label, the bundleSizeCheck step is ignored and the CI job passes
    image

Process & policy checklist

  • I have updated the project documentation to reflect my changes if necessary.
  • I have read the CONTRIBUTING documentation.

Is this a breaking change?

  • This change causes current functionality to break.

Calling bundle size is not changed.

  • Current size: 11750180
  • Base size: 11750180
  • Diff size: 0

CallWithChat bundle size is not changed.

  • Current size: 11750193
  • Base size: 11750193
  • Diff size: 0

Chat bundle size is not changed.

  • Current size: 1756460
  • Base size: 1756460
  • Diff size: 0

Copy link
Contributor

github-actions bot commented Oct 8, 2024

@azure/communication-react jest test coverage for stable.

Lines Statements Functions Branches
Base 26726 / 42984
62.17%
26726 / 42984
62.17%
729 / 1333
54.68%
2118 / 3387
62.53%
Current 26667 / 42984
62.03%
26667 / 42984
62.03%
729 / 1333
54.68%
2105 / 3375
62.37%
Diff -59 / 0
-0.14%
-59 / 0
-0.14%
0 / 0
0%
-13 / -12
-0.16%

Copy link
Contributor

github-actions bot commented Oct 8, 2024

@azure/communication-react jest test coverage for beta.

Lines Statements Functions Branches
Base 54006 / 88291
61.16%
54006 / 88291
61.16%
1096 / 2485
44.1%
3166 / 5259
60.2%
Current 53982 / 88291
61.14%
53982 / 88291
61.14%
1096 / 2485
44.1%
3156 / 5258
60.02%
Diff -24 / 0
-0.02%
-24 / 0
-0.02%
0 / 0
0%
-10 / -1
-0.18%

@Azure Azure deleted a comment from github-actions bot Oct 8, 2024
@Azure Azure deleted a comment from github-actions bot Oct 8, 2024
@Azure Azure deleted a comment from github-actions bot Oct 8, 2024
@Leah-Xia-Microsoft Leah-Xia-Microsoft added the does not need changelog Changes that does not affect the published package in any way do not need changelog entry label Oct 8, 2024
Copy link
Member

@JamesBurnside JamesBurnside left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just want to get edward to check on the santization comment

.github/workflows/ci.md Outdated Show resolved Hide resolved
uses: peter-evans/create-or-update-comment@v2
- name: Checkout repository
uses: actions/checkout@v4
- name: Update PR Description
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edwardlee-msft given this PR #5269 do we need to ensure any santization is happening if someone injects scripts into the PR description?

Co-authored-by: James Burnside <[email protected]>
Signed-off-by: Leah Xia <[email protected]>
Comment on lines +789 to +795
content: |
<!-- ${{ matrix.app }} bundle-size-report -->
## ${{ matrix.app }} bundle size is ***${{ steps.bundles.outputs.change }}***.
- Current size: ${{ steps.bundles.outputs.current_size }}
- Base size: ${{ steps.bundles.outputs.base_size}}
- Diff size: ${{ steps.bundles.outputs.diff}}
edit-mode: replace
- Base size: ${{ steps.bundles.outputs.base_size }}
- Diff size: ${{ steps.bundles.outputs.diff }}
<!-- end-bundle-size-report -->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these ${{values}}, can be areas where RCE can happen if not santization is implemented.
Especially if this is passed through some kind of bash command.

Can the steps.bundles.ouputs values be manipulated or edited by a User?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're safe from attacks since it's this CI workflow that build the sample apps to generate and upload the bundle size reports to gist, then in the following steps, it downloads the reports and calculate and generate the variables we uses here, such as steps.bundles.outputs.change.
If all the variables are provided by this workflow it self, we should be ok?
@edwardlee-msft and @JamesBurnside please let me know what you think. Should we implement sanitization anyways just to be safe?

- name: Checkout repository
uses: actions/checkout@v4
- name: Update PR Description
uses: nefrob/[email protected]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does nefrob/[email protected] apply sanitization?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately,
nefrob/[email protected] does not handle sanitization:
https://github.com/nefrob/pr-description/blob/master/index.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
does not need changelog Changes that does not affect the published package in any way do not need changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants