@@ -33,50 +33,11 @@ jobs:
3333 with :
3434 workspace_name : ' @launchdarkly/js-client-sdk'
3535 workspace_path : packages/sdk/browser
36- - name : Install Brotli
37- if : github.event_name == 'pull_request'
38- run : sudo apt-get update && sudo apt-get install brotli
39- - name : Get package size
36+ - name : Check package size
4037 if : github.event_name == 'pull_request' && matrix.version == '21'
41- env :
42- PR_NUMBER : ${{ github.event.number }}
43- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
44- run : |
45- brotli packages/sdk/browser/dist/index.js
46- export PACK_SIZE=$(stat -c %s packages/sdk/browser/dist/index.js.br)
47- echo "PACK_SIZE=$PACK_SIZE" >> $GITHUB_ENV
48-
49- - name : Find Size Comment
50- if : github.event_name == 'pull_request' && matrix.version == '21'
51- uses : peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e
52- id : fc
53- with :
54- issue-number : ${{ github.event.number }}
55- comment-author : ' github-actions[bot]'
56- body-includes : ' @launchdarkly/js-client-sdk size report'
57-
58- - name : Create comment
59- if : steps.fc.outputs.comment-id == '' && github.event_name == 'pull_request' && matrix.version == '21'
60- uses : peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043
38+ uses : ./actions/package-size
6139 with :
62- issue-number : ${{ github.event.number }}
63- body : |
64- @launchdarkly/js-client-sdk size report
65- This is the brotli compressed size of the ESM build.
66- Size: ${{ env.PACK_SIZE }} bytes
67-
68- - name : Update comment
69- if : steps.fc.outputs.comment-id != '' && github.event_name == 'pull_request' && matrix.version == '21'
70- uses : peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043
71- with :
72- comment-id : ${{ steps.fc.outputs.comment-id }}
73- edit-mode : replace
74- body : |
75- @launchdarkly/js-client-sdk size report
76- This is the brotli compressed size of the ESM build.
77- Size: ${{ env.PACK_SIZE }} bytes
78-
79- - name : Check package size limit
80- if : github.event_name == 'pull_request' && matrix.version == '21'
81- run : |
82- [ $PACK_SIZE -le 25000 ] || exit 1
40+ github_token : ${{ secrets.GITHUB_TOKEN }}
41+ target_file : ' packages/sdk/browser/dist/index.js'
42+ package_name : ' @launchdarkly/js-client-sdk'
43+ pr_numer : ${{ github.event.number }}
0 commit comments