55 branches :
66 - main
77 pull_request :
8- merge_group :
98
109permissions :
1110 contents : read
@@ -18,11 +17,13 @@ jobs:
1817 runs-on : ubuntu-latest
1918
2019 steps :
21- - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
20+ - name : Checkout
21+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2222 with :
2323 persist-credentials : false
2424
25- - uses : actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
25+ - name : Setup Node
26+ uses : actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
2627 with :
2728 node-version-file : " .nvmrc"
2829 cache : npm
@@ -40,11 +41,13 @@ jobs:
4041 runs-on : ubuntu-latest
4142
4243 steps :
43- - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
44+ - name : Checkout
45+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4446 with :
4547 persist-credentials : false
4648
47- - uses : actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
49+ - name : Setup Node
50+ uses : actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
4851 with :
4952 node-version-file : " .nvmrc"
5053 cache : npm
@@ -58,11 +61,13 @@ jobs:
5861 runs-on : ubuntu-latest
5962
6063 steps :
61- - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
64+ - name : Checkout
65+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
6266 with :
6367 persist-credentials : false
6468
65- - uses : actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
69+ - name : Setup Node
70+ uses : actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
6671 with :
6772 node-version-file : " .nvmrc"
6873 cache : npm
7176 - run : npm ci
7277
7378 - run : npm run unittest
79+
80+ diff-build :
81+ if : github.event_name == 'pull_request'
82+ runs-on : ubuntu-latest
83+
84+ concurrency :
85+ group : ${{ github.workflow }}-${{ github.event.pull_request.number }}-diff-build
86+ cancel-in-progress : true
87+
88+ steps :
89+ - name : Determine base ref
90+ id : base
91+ run : |
92+ if [[ "$GITHUB_HEAD_REF" == "release" ]]; then
93+ VERSION=$(npm view @mdn/browser-compat-data version)
94+ echo "ref=v$VERSION" >> "$GITHUB_OUTPUT"
95+ echo "Comparing release branch against published v$VERSION"
96+ else
97+ echo "ref=$GITHUB_BASE_REF" >> "$GITHUB_OUTPUT"
98+ echo "Comparing against base branch: $GITHUB_BASE_REF"
99+ fi
100+
101+ # Base
102+
103+ - name : Checkout (base)
104+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
105+ with :
106+ ref : ${{ steps.base.outputs.ref }}
107+ path : base
108+ persist-credentials : false
109+
110+ - name : Checkout (PR)
111+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
112+ with :
113+ path : pr
114+ persist-credentials : false
115+
116+ - name : Setup Node
117+ uses : actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
118+ with :
119+ node-version-file : pr/.nvmrc
120+ cache : npm
121+ cache-dependency-path : |
122+ base/package-lock.json
123+ pr/package-lock.json
124+ package-manager-cache : true
125+
126+ - name : Install
127+ run : |
128+ # sed command prefixes each line of output with [base] or [pr]
129+ cd base && npm ci | sed "s/^/[base] /" &
130+ cd pr && npm ci | sed "s/^/[pr] /" &
131+ wait
132+
133+ - name : Format
134+ run : |
135+ # sed command prefixes each line of output with [base] or [pr]
136+ cd base/build && npx prettier --write . | sed "s/^/[base] /" &
137+ cd pr/build && npx prettier --write . | sed "s/^/[pr] /" &
138+ wait
139+
140+ - name : Diff
141+ run : git diff --color=always --no-index base/build/ pr/build/ || true
0 commit comments