Skip to content

Commit 6db4610

Browse files
committed
feat: add security workflow
1 parent ec47af1 commit 6db4610

File tree

2 files changed

+68
-1
lines changed

2 files changed

+68
-1
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
3+
on: # yamllint disable-line rule:truthy
4+
pull_request:
5+
branches:
6+
- master
7+
- develop
8+
9+
name: 🔐 Security analysis
10+
11+
env:
12+
APP_RUNNER: 'cd app &&'
13+
14+
jobs:
15+
security-analysis:
16+
timeout-minutes: 4
17+
runs-on: ${{ matrix.os }}
18+
concurrency:
19+
cancel-in-progress: true
20+
group: security-analysis-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
21+
strategy:
22+
fail-fast: true
23+
matrix:
24+
os:
25+
- ubuntu-latest
26+
php-version:
27+
- '8.3'
28+
dependencies:
29+
- locked
30+
steps:
31+
- name: 📦 Check out the codebase
32+
uses: actions/checkout@v4.1.6
33+
34+
- name: 🛠️ Setup PHP
35+
uses: shivammathur/setup-php@2.30.4
36+
with:
37+
php-version: ${{ matrix.php-version }}
38+
extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, curl, fileinfo
39+
ini-values: error_reporting=E_ALL
40+
coverage: none
41+
42+
- name: 🛠️ Setup problem matchers
43+
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
44+
45+
- name: 🤖 Validate composer.json and composer.lock
46+
run: make validate-composer
47+
48+
- name: 🔍 Get composer cache directory
49+
uses: wayofdev/gh-actions/actions/composer/get-cache-directory@v3.1.0
50+
with:
51+
working-directory: app
52+
53+
- name: ♻️ Restore cached dependencies installed with composer
54+
uses: actions/cache@v4.0.2
55+
with:
56+
path: ${{ env.COMPOSER_CACHE_DIR }}
57+
key: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}
58+
restore-keys: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-
59+
60+
- name: 📥 Install "${{ matrix.dependencies }}" dependencies with composer
61+
uses: wayofdev/gh-actions/actions/composer/install@v3.1.0
62+
with:
63+
working-directory: app
64+
dependencies: ${{ matrix.dependencies }}
65+
66+
- name: 🐛 Check installed packages for security vulnerability advisories
67+
run: make lint-audit

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ lint-composer: ## Normalize composer.json and composer.lock files
291291
.PHONY: lint-composer
292292

293293
lint-audit: ## Runs security checks for composer dependencies
294-
$(APP_COMPOSER) audit
294+
$(APP_COMPOSER) audit --ansi
295295
.PHONY: lint-security
296296

297297
validate-composer: ## Validates composer.json and composer.lock files

0 commit comments

Comments
 (0)