-
Notifications
You must be signed in to change notification settings - Fork 25
52 lines (44 loc) · 1.54 KB
/
bundle-impact.yml
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
name: Bundle Impact
on:
pull_request_target:
branches: [main, next]
types: [opened, synchronize]
jobs:
bundle-impact:
name: Calculate Bundle Impact
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout Pull Request
id: checkout
env:
PR_REPO_URL: ${{ github.event.pull_request.head.repo.clone_url }}
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
run: |
git remote add pr $PR_REPO_URL
git fetch pr "$PR_HEAD_REF"
git checkout "pr/$PR_HEAD_REF" -- src
if [ -z "$(git status --porcelain)" ]; then
echo '::set-output name=has_changes::false'
else
echo '::set-output name=has_changes::true'
fi
- name: Install pnpm
if: steps.checkout.outputs.has_changes == 'true'
uses: pnpm/action-setup@v4
- name: Install Node.js
if: steps.checkout.outputs.has_changes == 'true'
uses: actions/setup-node@v4
with:
cache: pnpm
- name: Install dependencies
if: steps.checkout.outputs.has_changes == 'true'
run: |
pnpm install -C scripts/bundle-impact
- name: Run Bundle Impact
if: steps.checkout.outputs.has_changes == 'true'
env:
RADASHI_BOT_TOKEN: ${{ secrets.RADASHI_BOT_TOKEN }}
TARGET_BRANCH: ${{ github.base_ref }}
run: |
./scripts/bundle-impact/node_modules/.bin/tsx ./scripts/bundle-impact/pr-bundle-impact.ts ${{ github.event.number }}