Skip to content

Commit ecd5a00

Browse files
committed
[CI] Pin actions to commit SHAs and scope workflow permissions
1 parent d833c5a commit ecd5a00

2 files changed

Lines changed: 73 additions & 12 deletions

File tree

.github/dependabot.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# https://docs.github.com/en/code-security/reference/supply-chain-security/dependabot-options-reference
2+
3+
version: 2
4+
updates:
5+
# GitHub Actions
6+
- package-ecosystem: 'github-actions'
7+
directory: '/'
8+
schedule:
9+
interval: 'weekly'
10+
groups:
11+
github-actions:
12+
patterns:
13+
- '*'
14+
cooldown:
15+
default-days: 7
16+
17+
# npm, but only Reprise's internal dev/build tooling. The runtime dependency
18+
# (unplugin) and the peer dependencies (vite, @rsbuild/core, @hotwired/stimulus)
19+
# are semver-meaningful for consumers and bumped by hand, so they are excluded.
20+
- package-ecosystem: 'npm'
21+
directories:
22+
- '/'
23+
- '/assets'
24+
schedule:
25+
interval: 'weekly'
26+
allow:
27+
- dependency-name: '@antfu/eslint-config'
28+
- dependency-name: 'eslint'
29+
- dependency-name: '@rspack/core'
30+
- dependency-name: '@types/node'
31+
- dependency-name: 'jsdom'
32+
- dependency-name: 'nodemon'
33+
- dependency-name: 'tsdown'
34+
- dependency-name: 'tsx'
35+
- dependency-name: 'typescript'
36+
- dependency-name: 'vitest'
37+
groups:
38+
npm-dev-dependencies:
39+
patterns:
40+
- '*'
41+
cooldown:
42+
default-days: 7

.github/workflows/ci.yml

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,25 @@ on:
99
branches:
1010
- main
1111

12+
# Cancel any in-progress run for the same ref (branch/PR) when a new commit is pushed.
1213
concurrency:
1314
group: ${{ github.workflow }}-${{ github.ref }}
1415
cancel-in-progress: true
1516

17+
permissions: {}
18+
1619
jobs:
1720
lint:
1821
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
1924
steps:
20-
- uses: actions/checkout@v4
21-
- uses: pnpm/action-setup@v4
25+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
26+
with:
27+
persist-credentials: false
28+
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
2229
- name: Set node
23-
uses: actions/setup-node@v4
30+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
2431
with:
2532
node-version-file: .nvmrc
2633
cache: pnpm
@@ -32,15 +39,19 @@ jobs:
3239

3340
test:
3441
runs-on: ${{ matrix.os }}
42+
permissions:
43+
contents: read
3544
strategy:
3645
fail-fast: false
3746
matrix:
3847
os: [ubuntu-latest, windows-latest, macos-latest]
3948
steps:
40-
- uses: actions/checkout@v4
41-
- uses: pnpm/action-setup@v4
49+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
50+
with:
51+
persist-credentials: false
52+
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
4253
- name: Set node
43-
uses: actions/setup-node@v4
54+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
4455
with:
4556
node-version-file: .nvmrc
4657
cache: pnpm
@@ -55,6 +66,8 @@ jobs:
5566
php:
5667
name: PHP ${{ matrix.php-version }} + Symfony ${{ matrix.symfony-version }}${{ matrix.dependency-version == 'lowest' && ' lowest' || '' }} on ${{ matrix.os || 'ubuntu-latest' }}
5768
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
69+
permissions:
70+
contents: read
5871
strategy:
5972
fail-fast: false
6073
matrix:
@@ -82,14 +95,16 @@ jobs:
8295
# symfony/* package to this version during the Composer resolution.
8396
SYMFONY_REQUIRE: ${{ matrix.symfony-version }}
8497
steps:
85-
- uses: actions/checkout@v4
98+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
99+
with:
100+
persist-credentials: false
86101
- name: Setup PHP
87-
uses: shivammathur/setup-php@v2
102+
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
88103
with:
89104
php-version: ${{ matrix.php-version }}
90105
tools: flex
91106
- name: Install dependencies
92-
uses: ramsey/composer-install@v3
107+
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
93108
with:
94109
dependency-versions: ${{ matrix.dependency-version == 'lowest' && 'lowest' || 'highest' }}
95110
composer-options: --prefer-dist
@@ -99,17 +114,21 @@ jobs:
99114

100115
php-qa:
101116
runs-on: ubuntu-latest
117+
permissions:
118+
contents: read
102119
steps:
103-
- uses: actions/checkout@v4
120+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
121+
with:
122+
persist-credentials: false
104123
- name: Setup PHP
105-
uses: shivammathur/setup-php@v2
124+
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
106125
with:
107126
php-version: '8.4'
108127
tools: composer:v2
109128
- name: Validate composer.json
110129
run: composer validate --strict
111130
- name: Install dependencies
112-
uses: ramsey/composer-install@v3
131+
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
113132
with:
114133
dependency-versions: highest
115134
composer-options: --prefer-dist

0 commit comments

Comments
 (0)