Skip to content

Commit c64092f

Browse files
authored
Harden GitHub workflows (#313)
1 parent 645a44c commit c64092f

8 files changed

Lines changed: 63 additions & 15 deletions

File tree

.github/dependabot.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
version: 2
22
updates:
3-
# Maintain dependencies for GitHub Actions.
4-
- package-ecosystem: "github-actions"
5-
directory: "/"
6-
schedule:
7-
interval: "daily"
8-
# Too noisy. See https://github.community/t/increase-if-necessary-for-github-actions-in-dependabot/179581
9-
open-pull-requests-limit: 0
3+
# Maintain dependencies for GitHub Actions.
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
cooldown:
9+
default-days: 7
10+
ignore:
11+
- dependency-name: "yiisoft/*"
1012

11-
# Maintain dependencies for Composer
12-
- package-ecosystem: "composer"
13-
directory: "/"
14-
schedule:
15-
interval: "daily"
16-
versioning-strategy: increase-if-necessary
13+
# Maintain dependencies for Composer
14+
- package-ecosystem: "composer"
15+
directory: "/"
16+
schedule:
17+
interval: "daily"
18+
versioning-strategy: increase-if-necessary
19+
cooldown:
20+
default-days: 7

.github/workflows/bechmark.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,23 @@ on:
2424

2525
name: bechmark
2626

27+
permissions:
28+
contents: read
2729
jobs:
2830
phpbench:
2931
uses: yiisoft/actions/.github/workflows/phpbench.yml@master
3032
with:
3133
os: >-
32-
['ubuntu-latest', 'windows-latest']
34+
['ubuntu-latest']
3335
php: >-
3436
['8.1', '8.2', '8.3', '8.4']
37+
38+
phpbench-windows:
39+
uses: yiisoft/actions/.github/workflows/phpbench.yml@master
40+
with:
41+
os: >-
42+
['windows-latest']
43+
php: >-
44+
['8.1', '8.2', '8.3', '8.4']
45+
baseline-assertion: >-
46+
mode(variant.time.avg) <= mode(baseline.time.avg) +/- 15%

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ on:
2222

2323
name: build
2424

25+
permissions:
26+
contents: read
2527
jobs:
2628
phpunit:
2729
uses: yiisoft/actions/.github/workflows/phpunit.yml@master

.github/workflows/composer-require-checker.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ on:
2424

2525
name: Composer require checker
2626

27+
permissions:
28+
contents: read
2729
jobs:
2830
composer-require-checker:
2931
uses: yiisoft/actions/.github/workflows/composer-require-checker.yml@master

.github/workflows/mutation.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ on:
2020

2121
name: mutation test
2222

23+
permissions:
24+
contents: read
2325
jobs:
2426
mutation:
2527
uses: yiisoft/actions/.github/workflows/roave-infection.yml@master

.github/workflows/rector-cs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ on:
1212
- '.php-cs-fixer.dist.php'
1313

1414
permissions:
15-
contents: write
15+
contents: read
1616

1717
concurrency:
1818
group: ${{ github.workflow }}-${{ github.ref }}
1919
cancel-in-progress: true
2020

2121
jobs:
2222
rector:
23+
permissions:
24+
contents: write # Required to push PHP CS Fixer and Rector changes back to the branch.
2325
uses: yiisoft/actions/.github/workflows/rector-cs.yml@master
2426
with:
2527
php: '8.1'

.github/workflows/static.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ on:
2222

2323
name: static analysis
2424

25+
permissions:
26+
contents: read
2527
jobs:
2628
psalm:
2729
uses: yiisoft/actions/.github/workflows/psalm.yml@master

.github/workflows/zizmor.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: GitHub Actions Security Analysis with zizmor 🌈
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
paths:
9+
- '.github/**.yml'
10+
- '.github/**.yaml'
11+
pull_request:
12+
paths:
13+
- '.github/**.yml'
14+
- '.github/**.yaml'
15+
16+
permissions:
17+
actions: read # Required by zizmor when reading workflow metadata through the API.
18+
contents: read # Required to read workflow files.
19+
20+
jobs:
21+
zizmor:
22+
uses: yiisoft/actions/.github/workflows/zizmor.yml@master

0 commit comments

Comments
 (0)