Skip to content

Commit 0270969

Browse files
committed
workflow: stricter permissions
1 parent 15c64d4 commit 0270969

6 files changed

Lines changed: 33 additions & 4 deletions

File tree

.github/workflows/compressed-size.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@ name: Compressed Size
22

33
on: [pull_request]
44

5+
permissions:
6+
contents: read
7+
58
jobs:
69
compressed_size:
710
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
pull-requests: write
814
steps:
915
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1016
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0

.github/workflows/preview-release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@ name: Preview Release
22

33
on: [push, pull_request]
44

5+
permissions:
6+
contents: read
7+
58
jobs:
69
preview_release:
710
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
pull-requests: write
814
steps:
915
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1016
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0

.github/workflows/test-multiple-builds.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
pull_request:
77
types: [opened, synchronize]
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
test_multiple_builds:
1114
runs-on: ubuntu-latest

.github/workflows/test-multiple-versions.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
pull_request:
77
types: [opened, synchronize]
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
test_multiple_versions:
1114
runs-on: ubuntu-latest
@@ -41,5 +44,7 @@ jobs:
4144
sed -i~ 's/import\.meta\.env[?]\.MODE/"DEVELOPMENT".toLowerCase()/' src/*.ts src/*/*.ts src/*/*/*.ts
4245
- name: Test ${{ matrix.react }}
4346
run: |
44-
pnpm add -D react@${{ matrix.react }} react-dom@${{ matrix.react }}
47+
pnpm add -D react@$REACT_VER react-dom@$REACT_VER
4548
pnpm run test:spec
49+
env:
50+
REACT_VER: ${{ matrix.react }}

.github/workflows/test-old-typescript.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
pull_request:
77
types: [opened, synchronize]
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
test_old_typescript:
1114
runs-on: ubuntu-latest
@@ -46,10 +49,11 @@ jobs:
4649
sed -i~ 's/"verbatimModuleSyntax": true,//' tsconfig.json
4750
- name: Patch for specific TS version
4851
run: |
49-
ts_ver_esc=${{ matrix.typescript }}
50-
ts_ver_esc=${ts_ver_esc//./\\.}
52+
ts_ver_esc=${TS_VER//./\\.}
5153
sed -i~ "s/\/\/ @ts-expect-error .*\[SKIP-TS-${ts_ver_esc}\].*//" src/*/*.ts src/*/*/*.ts
5254
sed -i~ "s/\/\/ .*\[ONLY-TS-${ts_ver_esc}\].* @ts-/\/\/ @ts-/" src/*/*.ts src/*/*/*.ts
55+
env:
56+
TS_VER: ${{ matrix.typescript }}
5357
- name: Patch for Old TS
5458
if: ${{ matrix.typescript == '5.5.4' || matrix.typescript == '5.4.5' || matrix.typescript == '5.3.3' || matrix.typescript == '5.2.2' || matrix.typescript == '5.1.6' || matrix.typescript == '5.0.4' || matrix.typescript == '4.9.5' || matrix.typescript == '4.8.4' || matrix.typescript == '4.7.4' || matrix.typescript == '4.6.4' || matrix.typescript == '4.5.5' }}
5559
run: |
@@ -65,6 +69,8 @@ jobs:
6569
pnpm add -D @types/node@18.13.0
6670
pnpm add -D vitest@3.2.4 @vitest/coverage-v8@3.2.4 @vitest/ui@3.2.4
6771
- name: Install old TypeScript
68-
run: pnpm add -D typescript@${{ matrix.typescript }}
72+
run: pnpm add -D typescript@$TS_VER
73+
env:
74+
TS_VER: ${{ matrix.typescript }}
6975
- name: Test ${{ matrix.typescript }}
7076
run: pnpm run test:types

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
pull_request:
77
types: [opened, synchronize]
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
test:
1114
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)