-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
44 lines (39 loc) · 1.47 KB
/
action.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
name: 'Run BundleWatch'
description: 'Check if the bundle size is within limits using BundleWatch'
inputs:
config:
description: 'The path to the BundleWatch config file'
required: false
default: ''
token:
description: 'The BundleWatch token'
required: true
runs:
using: composite
steps:
# The following was taken from:
# https://github.com/woocommerce/google-listings-and-ads/blob/ba29fbec68cc156933a8bd9d866c45e89e821428/.github/workflows/bundle-size.yml#L41-L60
- name: 'Prepare env values - push'
if: ${{ github.event_name == 'push' }}
shell: bash
#language=bash
run: |
BRANCH=$(echo '${{ github.event.ref }}' | sed 's/^refs\/heads\///')
echo "CI_BRANCH=$BRANCH" >> $GITHUB_ENV
echo "CI_BRANCH_BASE=$BRANCH" >> $GITHUB_ENV
echo "CI_COMMIT_SHA=${{ github.sha }}" >> $GITHUB_ENV
- name: 'Prepare env values - pull request'
if: ${{ github.event_name == 'pull_request' }}
shell: bash
#language=bash
run: |
echo "CI_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
echo "CI_BRANCH_BASE=${{ github.base_ref }}" >> $GITHUB_ENV
echo "CI_COMMIT_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
- name: 'Check bundle size'
shell: bash
#language=bash
run: |
npx bundlewatch $(if [ -n "${{ inputs.config }}" ]; then echo "--config ${{ inputs.config }}"; fi)
env:
BUNDLEWATCH_GITHUB_TOKEN: ${{ inputs.token }}