Skip to content

Commit c68dd70

Browse files
committed
Add reusable phplinter-workflow
1 parent d777583 commit c68dd70

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/phplinter.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
3+
on: # yamllint disable-line rule:truthy
4+
workflow_call:
5+
inputs:
6+
php-version:
7+
description: 'The PHP-version to use for linting'
8+
type: choice
9+
required: true
10+
options:
11+
- 7.4
12+
- 8.0
13+
- 8.1
14+
- 8.2
15+
- 8.3
16+
- 8.4
17+
repository:
18+
description: 'The repository that needs linting'
19+
type: string
20+
required: true
21+
ref:
22+
description: 'The branch, tag or SHA that needs linting'
23+
type: string
24+
required: false
25+
default: 'master'
26+
27+
jobs:
28+
linter:
29+
runs-on: ubuntu-latest
30+
31+
steps:
32+
- name: Checkout Code
33+
uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0
36+
repository: ${{ inputs.repository }}
37+
ref: ${{ inputs.ref }}
38+
39+
- name: Setup PHP runtime
40+
uses: shivammathur/setup-php@v2
41+
with:
42+
tools: phive
43+
php-version: ${{ inputs.php-version }}
44+
coverage: "none"
45+
46+
- name: Install overtrue/phplint (v3.4)
47+
if: inputs.php-version == '7.4'
48+
run: |
49+
phive install overtrue/phplint@~3.4.0 --force-accept-unsigned --target ./bin
50+
51+
- name: Install overtrue/phplint (v4.5)
52+
if: inputs.php-version == '8.0'
53+
run: |
54+
phive install overtrue/phplint@~4.5.0 --force-accept-unsigned --target ./bin
55+
56+
- name: Install overtrue/phplint (v9.4)
57+
if: inputs.php-version == '8.1'
58+
run: |
59+
phive install overtrue/phplint@~9.4.0 --force-accept-unsigned --target ./bin
60+
61+
- name: Install overtrue/phplint (v9.5)
62+
if: inputs.php-version != '7.4' && inputs.php-version != '8.0' && inputs.php-version != '8.1'
63+
run: |
64+
phive install overtrue/phplint@~9.5.0 --force-accept-unsigned --target ./bin
65+
66+
- name: Lint PHP files
67+
run: |
68+
./bin/phplint --no-cache --no-progress -v

0 commit comments

Comments
 (0)