33on : # 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 : ${{ env.php_supported_versions }}
16+
617 enable_eslinter :
718 description : ' Enable the ES-Linter for this repository'
819 type : boolean
920 required : false
1021 default : false
22+ eslinter-config :
23+ description : ' The location of the configuration file'
24+ type : string
25+ required : false
26+ default : ' ./tools/linters/eslint.config.js'
27+
1128 enable_jsonlinter :
1229 description : ' Enable the JSON-Linter for this repository'
1330 type : boolean
1431 required : false
1532 default : false
33+
1634 enable_yamllinter :
1735 description : ' Enable the YAML-Linter for this repository'
1836 type : boolean
1937 required : false
2038 default : false
39+ yamllinter-config :
40+ description : ' The location of the linter-configuration'
41+ type : string
42+ required : false
43+ default : ' '
44+
2145 enable_stylelinter :
2246 description : ' Enable the Style-Linter for this repository'
2347 type : boolean
2448 required : false
2549 default : false
26- repository :
27- description : ' The repository that needs linting'
28- type : string
29- default : ${{ github.repository }}
30- required : false
31- ref :
32- description : ' The branch, tag or SHA that needs linting'
33- type : string
34- required : false
35- default : ${{ github.ref }}
36-
37- eslinter-config :
38- description : ' The location of the configuration file'
39- type : string
40- required : false
41- default : ' ./tools/linters/eslint.config.js'
4250 stylelinter-pattern :
4351 description : ' The file-pattern to match files that are being linted'
4452 type : string
@@ -49,13 +57,73 @@ on: # yamllint disable-line rule:truthy
4957 type : string
5058 required : false
5159 default : ' tools/linters/.stylelintrc.json'
52- yamllinter-config :
53- description : ' The location of the linter-configuration'
60+
61+ repository :
62+ description : ' The repository that needs linting'
5463 type : string
64+ default : ${{ github.repository }}
5565 required : false
56- default : ' '
66+ ref :
67+ description : ' The branch, tag or SHA that needs linting'
68+ type : string
69+ required : false
70+ default : ${{ github.ref }}
71+
72+ env :
73+ php_supported_versions : ' ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]'
5774
5875jobs :
76+ phplinter :
77+ if : inputs.enable_phplinter == true
78+ runs-on : ubuntu-latest
79+
80+ strategy :
81+ matrix :
82+ php_version : fromJSON(inputs.php-versions)
83+
84+ steps :
85+ - name : Supported version check
86+ if : contains(fromJSON(env.php_supported_versions), inputs.php-versions) == 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.version }}
101+ coverage : " none"
102+
103+ - name : Install overtrue/phplint (v3.4)
104+ if : ${{ matrix.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.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.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 : ${{ matrix.version }} != '7.4' && ${{ matrix.version }} != '8.0' && ${{ matrix.version }} != '8.1'
120+ run : |
121+ phive install overtrue/phplint@~9.5.0 --force-accept-unsigned --target ./bin
122+
123+ - name : Lint PHP files
124+ run : |
125+ ./bin/phplint --no-cache --no-progress -v
126+
59127 ecmascript-linter :
60128 if : inputs.enable_eslinter == true
61129 runs-on : ubuntu-latest
0 commit comments