Skip to content

Commit 5bf3ffe

Browse files
committed
Refactor
1 parent 3d8f866 commit 5bf3ffe

File tree

2 files changed

+69
-68
lines changed

2 files changed

+69
-68
lines changed

.github/workflows/reusable_linter.yml

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,6 @@
33
on: # yamllint disable-line rule:truthy
44
workflow_call:
55
inputs:
6-
enable_phplinter:
7-
description: 'Enable the PHP-Linter for this repository'
8-
type: boolean
9-
required: false
10-
default: false
11-
phplinter-versions:
12-
description: 'The PHP-version to use for linting'
13-
type: string
14-
required: false
15-
default: '["8.1", "8.2", "8.3", "8.4"]'
16-
176
enable_eslinter:
187
description: 'Enable the ES-Linter for this repository'
198
type: boolean
@@ -69,64 +58,7 @@ on: # yamllint disable-line rule:truthy
6958
required: false
7059
default: ${{ github.ref }}
7160

72-
env:
73-
php_supported_versions: '["7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]'
74-
7561
jobs:
76-
phplinter:
77-
if: inputs.enable_phplinter == true
78-
runs-on: ubuntu-latest
79-
80-
strategy:
81-
matrix:
82-
php_version: ${{ fromJSON(inputs.phplinter-versions) }}
83-
84-
steps:
85-
- name: Supported version check
86-
if: contains(fromJSON(env.php_supported_versions), matrix.php_version) == false
87-
run: exit 1
88-
89-
- name: Checkout Code
90-
uses: actions/checkout@v4
91-
with:
92-
fetch-depth: 0
93-
repository: ${{ inputs.repository }}
94-
ref: ${{ inputs.ref }}
95-
96-
- name: Setup PHP runtime
97-
uses: shivammathur/setup-php@v2
98-
with:
99-
tools: phive
100-
php-version: ${{ matrix.php_version }}
101-
coverage: "none"
102-
103-
- name: Install overtrue/phplint (v3.4)
104-
if: matrix.php_version == '7.4'
105-
run: |
106-
phive install overtrue/phplint@~3.4.0 --force-accept-unsigned --target ./bin
107-
108-
- name: Install overtrue/phplint (v4.5)
109-
if: matrix.php_version == '8.0'
110-
run: |
111-
phive install overtrue/phplint@~4.5.0 --force-accept-unsigned --target ./bin
112-
113-
- name: Install overtrue/phplint (v9.4)
114-
if: matrix.php_version == '8.1'
115-
run: |
116-
phive install overtrue/phplint@~9.4.0 --force-accept-unsigned --target ./bin
117-
118-
- name: Install overtrue/phplint (v9.5)
119-
if: |
120-
matrix.php_version != '7.4'
121-
&& matrix.php_version != '8.0'
122-
&& matrix.php_version != '8.1'
123-
run: |
124-
phive install overtrue/phplint@~9.5.0 --force-accept-unsigned --target ./bin
125-
126-
- name: Lint PHP files
127-
run: |
128-
./bin/phplint --no-cache --no-progress -v
129-
13062
ecmascript-linter:
13163
if: inputs.enable_eslinter == true
13264
runs-on: ubuntu-latest
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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: string
9+
required: true
10+
repository:
11+
description: 'The repository that needs linting'
12+
type: string
13+
required: false
14+
default: ${{ github.repository }}
15+
ref:
16+
description: 'The branch, tag or SHA that needs linting'
17+
type: string
18+
required: false
19+
default: ${{ github.ref }}
20+
21+
env:
22+
supported: '["7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]'
23+
24+
jobs:
25+
linter:
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- name: Supported version check
30+
if: contains(fromJSON(env.supported), inputs.php-version) == false
31+
run: exit 1
32+
33+
- name: Checkout Code
34+
uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0
37+
repository: ${{ inputs.repository }}
38+
ref: ${{ inputs.ref }}
39+
40+
- name: Setup PHP runtime
41+
uses: shivammathur/setup-php@v2
42+
with:
43+
tools: phive
44+
php-version: ${{ inputs.php-version }}
45+
coverage: "none"
46+
47+
- name: Install overtrue/phplint (v3.4)
48+
if: inputs.php-version == '7.4'
49+
run: |
50+
phive install overtrue/phplint@~3.4.0 --force-accept-unsigned --target ./bin
51+
52+
- name: Install overtrue/phplint (v4.5)
53+
if: inputs.php-version == '8.0'
54+
run: |
55+
phive install overtrue/phplint@~4.5.0 --force-accept-unsigned --target ./bin
56+
57+
- name: Install overtrue/phplint (v9.4)
58+
if: inputs.php-version == '8.1'
59+
run: |
60+
phive install overtrue/phplint@~9.4.0 --force-accept-unsigned --target ./bin
61+
62+
- name: Install overtrue/phplint (v9.5)
63+
if: inputs.php-version != '7.4' && inputs.php-version != '8.0' && inputs.php-version != '8.1'
64+
run: |
65+
phive install overtrue/phplint@~9.5.0 --force-accept-unsigned --target ./bin
66+
67+
- name: Lint PHP files
68+
run: |
69+
./bin/phplint --no-cache --no-progress -v

0 commit comments

Comments
 (0)