-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
90 lines (86 loc) · 3 KB
/
action.yml
File metadata and controls
90 lines (86 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: "Bundle Analysis"
description: "Analyze bundle size differences using rsdoctor and comment on PRs"
author: "GitHub Actions"
inputs:
base_dir:
description: "Directory containing base branch rsdoctor data"
default: ".bundle-base"
required: false
current_dir:
description: "Directory containing current branch rsdoctor data"
default: "."
required: false
github_token:
description: "GitHub token for posting comments"
required: true
header:
description: "Header to identify the comment (for sticky comments)"
default: "bundle-analysis"
required: false
pr_number:
description: "Pull request number (auto-detected if not provided)"
required: false
skip_comment:
description: "Skip posting comment if true"
default: "false"
required: false
packages_dir:
description: "Directory containing packages to analyze"
default: "packages"
required: false
fail_on_increase:
description: "Fail the action if bundle size increases significantly"
default: "false"
required: false
threshold:
description: "Percentage threshold for significant bundle size increase"
default: "10"
required: false
outputs:
report_path:
description: "Path to the generated bundle diff report"
has_changes:
description: "Whether bundle changes were detected"
total_diff_percent:
description: "Total bundle size change percentage"
runs:
using: "composite"
steps:
- name: Install dependencies
shell: bash
working-directory: ${{ github.action_path }}
run: |
if [ ! -d "node_modules" ]; then
# Use pnpm from PATH if available (set by workflow), otherwise install it
if ! command -v pnpm &> /dev/null; then
if [ -n "$PNPM_HOME" ]; then
export PATH="$PNPM_HOME:$PATH"
else
core_url="https://get.pnpm.io/install.sh"
curl -fsSL "$core_url" | sh -
export PNPM_HOME="$HOME/.local/share/pnpm"
export PATH="$PNPM_HOME:$PATH"
fi
fi
# Try frozen lockfile first, fall back to regular install if lockfile is outdated
pnpm install --frozen-lockfile || pnpm install --no-frozen-lockfile
fi
- name: Run bundle analysis
shell: bash
working-directory: ${{ github.action_path }}
run: |
# Ensure pnpm is in PATH
if [ -n "$PNPM_HOME" ] && [ -z "$(command -v pnpm)" ]; then
export PATH="$PNPM_HOME:$PATH"
fi
pnpm exec tsx "$GITHUB_ACTION_PATH/src/main.ts"
env:
INPUT_BASE_DIR: ${{ inputs.base_dir }}
INPUT_CURRENT_DIR: ${{ inputs.current_dir }}
INPUT_GITHUB_TOKEN: ${{ inputs.github_token }}
INPUT_HEADER: ${{ inputs.header }}
INPUT_PR_NUMBER: ${{ inputs.pr_number }}
INPUT_SKIP_COMMENT: ${{ inputs.skip_comment }}
INPUT_FAIL_ON_INCREASE: ${{ inputs.fail_on_increase }}
INPUT_PACKAGES_DIR: ${{ inputs.packages_dir }}
INPUT_THRESHOLD: ${{ inputs.threshold }}