Skip to content

Commit 1b2795a

Browse files
committed
Security harden the workflows
1 parent 63fd8ca commit 1b2795a

5 files changed

Lines changed: 36 additions & 21 deletions

File tree

.github/dependabot.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ updates:
1010
- package-ecosystem: github-actions
1111
directory: /
1212
schedule:
13-
interval: daily
14-
ignore:
15-
- dependency-name: '*'
16-
update-types:
17-
- version-update:semver-minor
18-
- version-update:semver-patch
13+
interval: weekly
14+
groups:
15+
actions:
16+
patterns:
17+
- '*'

.github/workflows/auto-review.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ on:
1818
- tests/**
1919
- .github/workflows/auto-review.yml
2020

21+
permissions:
22+
contents: read
23+
2124
concurrency:
2225
group: auto-review-${{ github.ref }}
2326
cancel-in-progress: true
@@ -27,6 +30,7 @@ jobs:
2730
name: Automatic Review on Code [PHP ${{ matrix.php-version }}]
2831
runs-on: ubuntu-24.04
2932
if: github.repository == 'codeigniter4/translations'
33+
timeout-minutes: 15
3034

3135
strategy:
3236
fail-fast: false
@@ -40,10 +44,12 @@ jobs:
4044

4145
steps:
4246
- name: Checkout code
43-
uses: actions/checkout@v6
47+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
48+
with:
49+
persist-credentials: false
4450

4551
- name: Setup PHP
46-
uses: shivammathur/setup-php@v2
52+
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0
4753
with:
4854
php-version: ${{ matrix.php-version }}
4955
extensions: intl, mbstring
@@ -56,7 +62,7 @@ jobs:
5662
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
5763

5864
- name: Cache composer dependencies
59-
uses: actions/cache@v5
65+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
6066
with:
6167
path: ${{ steps.composer-cache.outputs.COMPOSER_CACHE_FILES_DIR }}
6268
key: composer-PHP_${{ matrix.php-version }}-${{ hashFiles('**/composer.json') }}

.github/workflows/build.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
name: Build [PHP ${{ matrix.php-version }}]
3333
runs-on: ubuntu-24.04
3434
if: github.repository == 'codeigniter4/translations'
35+
timeout-minutes: 20
3536

3637
strategy:
3738
fail-fast: false
@@ -40,16 +41,17 @@ jobs:
4041

4142
steps:
4243
- name: Checkout code
43-
uses: actions/checkout@v6
44+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4445
with:
4546
fetch-depth: 2
47+
persist-credentials: false
4648

4749
- name: Checkout other refs
4850
run: |
4951
git fetch --no-tags --prune --depth=2 origin +refs/heads/*:refs/remotes/origin/*
5052
5153
- name: Setup PHP
52-
uses: shivammathur/setup-php@v2
54+
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0
5355
with:
5456
php-version: ${{ matrix.php-version }}
5557
extensions: intl, mbstring
@@ -62,7 +64,7 @@ jobs:
6264
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
6365

6466
- name: Cache composer dependencies
65-
uses: actions/cache@v5
67+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
6668
with:
6769
path: ${{ steps.composer-cache.outputs.COMPOSER_CACHE_FILES_DIR }}
6870
key: composer-PHP_${{ matrix.php-version }}-${{ hashFiles('**/composer.json') }}

.github/workflows/code-style.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
name: Code Style Check [PHP ${{ matrix.php-version }}]
3535
runs-on: ubuntu-24.04
3636
if: github.repository == 'codeigniter4/translations'
37+
timeout-minutes: 10
3738

3839
strategy:
3940
fail-fast: false
@@ -42,10 +43,12 @@ jobs:
4243

4344
steps:
4445
- name: Checkout repository
45-
uses: actions/checkout@v6
46+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
47+
with:
48+
persist-credentials: false
4649

4750
- name: Setup PHP
48-
uses: shivammathur/setup-php@v2
51+
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0
4952
with:
5053
php-version: ${{ matrix.php-version }}
5154
extensions: tokenizer
@@ -58,7 +61,7 @@ jobs:
5861
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
5962

6063
- name: Cache composer dependencies
61-
uses: actions/cache@v5
64+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
6265
with:
6366
path: ${{ steps.composer-cache.outputs.COMPOSER_CACHE_FILES_DIR }}
6467
key: composer-PHP_${{ matrix.php-version }}-${{ hashFiles('**/composer.json') }}

.github/workflows/generate-page.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,16 @@ jobs:
2727
build:
2828
runs-on: ubuntu-24.04
2929
if: github.repository == 'codeigniter4/translations'
30+
timeout-minutes: 15
3031

3132
steps:
3233
- name: Checkout code
33-
uses: actions/checkout@v6
34+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
35+
with:
36+
persist-credentials: false
3437

3538
- name: Setup PHP
36-
uses: shivammathur/setup-php@v2
39+
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0
3740
with:
3841
php-version: '8.2'
3942
extensions: intl, mbstring
@@ -46,7 +49,7 @@ jobs:
4649
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
4750

4851
- name: Cache composer dependencies
49-
uses: actions/cache@v5
52+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
5053
with:
5154
path: ${{ steps.composer-cache.outputs.COMPOSER_CACHE_FILES_DIR }}
5255
key: composer-PHP_8.2-${{ hashFiles('**/composer.json') }}
@@ -59,13 +62,13 @@ jobs:
5962

6063
- name: Setup Pages
6164
id: pages
62-
uses: actions/configure-pages@v6
65+
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
6366

6467
- name: Build
6568
run: ./bin/generate-page
6669

6770
- name: Upload artifact
68-
uses: actions/upload-pages-artifact@v5
71+
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
6972
with:
7073
path: ./page/build
7174

@@ -76,7 +79,9 @@ jobs:
7679
url: ${{ steps.deployment.outputs.page_url }}
7780
runs-on: ubuntu-24.04
7881
needs: build
82+
timeout-minutes: 10
83+
7984
steps:
8085
- name: Deploy to GitHub Pages
8186
id: deployment
82-
uses: actions/deploy-pages@v5
87+
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0

0 commit comments

Comments
 (0)