Skip to content

Commit 8e555b3

Browse files
authored
Merge pull request reduxjs#2305 from reduxjs/feature/harden-publishing-2026-05
Additional publishing hardening
2 parents 4134f88 + d184dd6 commit 8e555b3

2 files changed

Lines changed: 53 additions & 28 deletions

File tree

.github/workflows/size.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@ name: Bundle Size
22

33
on: [pull_request]
44

5+
permissions:
6+
contents: read
7+
pull-requests: write
8+
59
jobs:
610
build:
711
name: Check compressed size
812
runs-on: ubuntu-latest
913

1014
steps:
11-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1216
with:
1317
fetch-depth: 1
14-
- uses: preactjs/compressed-size-action@v2
18+
persist-credentials: false
19+
- uses: preactjs/compressed-size-action@66325aad6443cb7cf89c4bfcd414aea2367cda94 # v2
1520
with:
1621
repo-token: '${{ secrets.GITHUB_TOKEN }}'

.github/workflows/test.yml

Lines changed: 46 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: Tests
22

33
on: [push, pull_request, workflow_dispatch]
44

5+
permissions:
6+
contents: read
7+
58
jobs:
69
build:
710
name: Build and run test Suite
@@ -13,16 +16,18 @@ jobs:
1316

1417
steps:
1518
- name: Checkout code
16-
uses: actions/checkout@v4
19+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20+
with:
21+
persist-credentials: false
1722

1823
- name: Use node ${{ matrix.node }}
19-
uses: actions/setup-node@v4
24+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
2025
with:
2126
node-version: ${{ matrix.node }}
2227
cache: 'yarn'
2328

2429
- name: Install dependencies
25-
run: yarn install
30+
run: yarn install --frozen-lockfile
2631

2732
- name: Lint
2833
run: yarn lint
@@ -36,7 +41,7 @@ jobs:
3641
- name: Pack
3742
run: yarn pack
3843

39-
- uses: actions/upload-artifact@v4
44+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
4045
with:
4146
name: package
4247
path: ./package.tgz
@@ -67,22 +72,24 @@ jobs:
6772

6873
steps:
6974
- name: Checkout repo
70-
uses: actions/checkout@v4
75+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
76+
with:
77+
persist-credentials: false
7178

7279
- name: Use node ${{ matrix.node }}
73-
uses: actions/setup-node@v4
80+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
7481
with:
7582
node-version: ${{ matrix.node }}
7683
cache: 'yarn'
7784

7885
- name: Download build artifact
79-
uses: actions/download-artifact@v4
86+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
8087
with:
8188
name: package
8289
path: .
8390

8491
- name: Install deps
85-
run: yarn install
92+
run: yarn install --frozen-lockfile
8693

8794
- name: Install React ${{ matrix.react.version }} and React-DOM ${{ matrix.react.react-dom.version }}
8895
run: yarn add -D react@${{ matrix.react.version }} react-dom@${{ matrix.react.react-dom.version }} @types/react@${{ matrix.react.types }} @types/react-dom@${{ matrix.react.react-dom.types }}
@@ -114,22 +121,24 @@ jobs:
114121
node: ['22.x']
115122
steps:
116123
- name: Checkout repo
117-
uses: actions/checkout@v4
124+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
125+
with:
126+
persist-credentials: false
118127

119128
- name: Use node ${{ matrix.node }}
120-
uses: actions/setup-node@v4
129+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
121130
with:
122131
node-version: ${{ matrix.node }}
123132
cache: 'yarn'
124133

125-
- uses: actions/download-artifact@v4
134+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
126135
with:
127136
name: package
128137
path: .
129138

130139
# Note: We currently expect "FalseCJS" failures for Node16 + `moduleResolution: "node16",
131140
- name: Run are-the-types-wrong
132-
run: npx @arethetypeswrong/cli ./package.tgz --format table --ignore-rules false-cjs --exclude-entrypoints alternate-renderers
141+
run: npx @arethetypeswrong/cli@0.18.2 ./package.tgz --format table --ignore-rules false-cjs --exclude-entrypoints alternate-renderers
133142

134143
test-published-artifact:
135144
name: Test Published Artifact ${{ matrix.example }}
@@ -153,19 +162,24 @@ jobs:
153162
]
154163
steps:
155164
- name: Checkout repo
156-
uses: actions/checkout@v4
165+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
166+
with:
167+
persist-credentials: false
157168

158169
- name: Use node ${{ matrix.node }}
159-
uses: actions/setup-node@v4
170+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
160171
with:
161172
node-version: ${{ matrix.node }}
162173
cache: 'yarn'
163174

164-
- name: Clone RTK repo
165-
run: git clone https://github.com/reduxjs/redux-toolkit.git ./redux-toolkit
175+
- name: Clone RTK repo (pinned to known-good commit)
176+
run: |
177+
git init ./redux-toolkit
178+
git -C ./redux-toolkit fetch --depth 1 https://github.com/reduxjs/redux-toolkit.git 576a02f8056fbee2dcaddb4d2e4d2da3b7937c58
179+
git -C ./redux-toolkit checkout FETCH_HEAD
166180
167181
- name: Cache example deps
168-
uses: actions/cache@v4
182+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
169183
with:
170184
path: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}/node_modules
171185
key: test-published-artifact-${{ matrix.example }}-node_modules
@@ -175,14 +189,16 @@ jobs:
175189

176190
- name: Install example deps
177191
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
192+
env:
193+
YARN_ENABLE_SCRIPTS: false
178194
run: yarn install
179195

180196
- name: Install Playwright browser if necessary
181197
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
182198
continue-on-error: true
183199
run: yarn playwright install || true
184200

185-
- uses: actions/download-artifact@v4
201+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
186202
with:
187203
name: package
188204
path: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
@@ -224,21 +240,23 @@ jobs:
224240
working-directory: ./examples/publish-ci/${{ matrix.example }}
225241
steps:
226242
- name: Checkout repo
227-
uses: actions/checkout@v4
243+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
244+
with:
245+
persist-credentials: false
228246

229247
- name: Use node ${{ matrix.node }}
230-
uses: actions/setup-node@v4
248+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
231249
with:
232250
node-version: ${{ matrix.node }}
233251
cache: 'yarn'
234252

235253
- name: Install deps
236-
run: yarn install
254+
run: yarn install --frozen-lockfile
237255

238256
- name: Remove existing React-Redux
239257
run: yarn remove react-redux
240258

241-
- uses: actions/download-artifact@v4
259+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
242260
with:
243261
name: package
244262
path: ./examples/publish-ci/${{ matrix.example }}
@@ -279,19 +297,21 @@ jobs:
279297

280298
steps:
281299
- name: Checkout repo
282-
uses: actions/checkout@v4
300+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
301+
with:
302+
persist-credentials: false
283303

284304
- name: Use node ${{ matrix.node }}
285-
uses: actions/setup-node@v4
305+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
286306
with:
287307
node-version: ${{ matrix.node }}
288308
cache: 'yarn'
289309

290310
- name: Install deps
291-
run: yarn install
311+
run: yarn install --frozen-lockfile
292312

293313
- name: Download build artifact
294-
uses: actions/download-artifact@v4
314+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
295315
with:
296316
name: package
297317
path: .

0 commit comments

Comments
 (0)