Skip to content

Commit

Permalink
Try to fix the size workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
daniilsapa committed Jan 11, 2025
1 parent 42bfc21 commit d466eb9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/bundle-size-trusted.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}

- name: Sanitize branch name
id: sanitize_branch
run: echo "::set-output name=stanitized::$(echo ${{ toJson(github.base_ref) }} | sed 's/[^0-9a-zA-Z\._\-]/_/g')"

- name: Create the report
id: create-report
uses: actions/github-script@v7
Expand All @@ -48,7 +52,7 @@ jobs:
}
const fs = require('fs');
const sizes = parseDuOutput(fs.readFileSync(`sizes-${${{ toJson(github.base_ref) }}}.txt`, 'utf8'));
const sizesPR = parseDuOutput(fs.readFileSync(`sizes-${${{ toJson(github.head_ref) }}}.txt`, 'utf8'));
const sizesPR = parseDuOutput(fs.readFileSync(`sizes-${${{ steps.sanitize_branch.outputs.sanitized }}}.txt`, 'utf8'));
core.summary.addHeading('📊 Package size report', '3');
core.summary.addTable([
['Package', 'Before', 'After'].map((data) => ({ data, header: true })),
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/bundle-size-untrusted.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ jobs:
with:
ref: ${{ matrix.branch }}

- name: Sanitize branch name
id: sanitize_branch
run: echo "::set-output name=stanitized::$(echo ${{ matrix.branch }} | sed 's/[^0-9a-zA-Z\._\-]/_/g')"

- name: Setup
uses: ./.github/actions/setup

Expand All @@ -35,10 +39,10 @@ jobs:

- name: Collect sizes in bytes
id: sizes
run: du -sb packages/*/dist > sizes-${{ matrix.branch }}.txt
run: du -sb packages/*/dist > sizes-${{ steps.sanitize_branch.outputs.sanitized }}.txt

- name: Upload the sizes
uses: actions/upload-artifact@v4
with:
name: sizes-${{ matrix.branch }}
path: sizes-${{ matrix.branch }}.txt
name: sizes-${{ steps.sanitize_branch.outputs.sanitized }}
path: sizes-${{ steps.sanitize_branch.outputs.sanitized }}.txt

0 comments on commit d466eb9

Please sign in to comment.