-
Notifications
You must be signed in to change notification settings - Fork 6
69 lines (63 loc) · 2.04 KB
/
lint-php.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Lint PHP
on:
workflow_call:
inputs:
PHP_VERSION:
description: PHP version with which the scripts are executed.
default: '8.2'
required: false
type: string
COMPOSER_ARGS:
description: Set of arguments passed to Composer.
default: '--prefer-dist'
required: false
type: string
LINT_ARGS:
description: Set of arguments passed to PHP Parallel Lint.
default: '. -e php --colors --show-deprecated'
required: false
type: string
COMPOSER_DEPS_INSTALL:
description: Whether or not to install Composer dependencies before linting.
type: boolean
default: false
required: false
secrets:
COMPOSER_AUTH_JSON:
description: Authentication for privately hosted packages and repositories as a JSON formatted object.
required: false
ENV_VARS:
description: Additional environment variables as a JSON formatted object.
required: false
jobs:
lint-php:
timeout-minutes: 5
runs-on: ubuntu-latest
env:
COMPOSER_AUTH: '${{ secrets.COMPOSER_AUTH_JSON }}'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up custom environment variables
env:
ENV_VARS: ${{ secrets.ENV_VARS }}
if: ${{ env.ENV_VARS }}
uses: actions/github-script@v7
with:
script: |
JSON
.parse(process.env.ENV_VARS)
.forEach(envVar => core.exportVariable(envVar.name, envVar.value));
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.PHP_VERSION }}
tools: cs2pr, parallel-lint
coverage: none
- name: Install Composer dependencies
if: ${{ inputs.COMPOSER_DEPS_INSTALL }}
uses: ramsey/composer-install@v3
with:
composer-options: ${{ inputs.COMPOSER_ARGS }}
- name: Run PHP lint check
run: parallel-lint ${{ inputs.LINT_ARGS }} --checkstyle | cs2pr