-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
52b2ecd
commit 1b669de
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Check Node Modules Size | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
# `yarn.lock` should no longer be present, but we'll keep this here in case we add it back. | ||
- yarn.lock | ||
- package.json | ||
|
||
push: | ||
branches: | ||
- "*" | ||
|
||
jobs: | ||
analyze-size: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- name: Get main branch node_modules size | ||
id: main_size | ||
run: echo "::set-output name=size::$(du -sh node_modules | awk '{print $1}')" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Analyze node_modules size | ||
id: current_size | ||
run: echo "::set-output name=size::$(du -sh node_modules | awk '{print $1}')" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Compare sizes and send alert | ||
if: ${{ steps.current_size.outputs.size != steps.main_size.outputs.size }} | ||
run: | | ||
echo "Node Modules size has changed!" | ||
echo "Main branch size: ${{ steps.main_size.outputs.size }}" | ||
echo "Current branch size: ${{ steps.current_size.outputs.size }}" | ||
# Add your alerting mechanism here, such as sending a Slack notification, creating an issue, etc. |