Skip to content

Commit 28a5b34

Browse files
authored
Modify PHP MD workflow configuration
Updated cron schedule and PHPMD configuration.
1 parent 5cd88a1 commit 28a5b34

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

.github/workflows/phpmd.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
# PHPMD is a spin-off project of PHP Depend and
6+
# aims to be a PHP equivalent of the well known Java tool PMD.
7+
# What PHPMD does is: It takes a given PHP source code base
8+
# and look for several potential problems within that source.
9+
# These problems can be things like:
10+
# Possible bugs
11+
# Suboptimal code
12+
# Overcomplicated expressions
13+
# Unused parameters, methods, properties
14+
# More details at https://phpmd.org/
15+
16+
name: PHPMD
17+
18+
on:
19+
push:
20+
branches: [ "master" ]
21+
pull_request:
22+
# The branches below must be a subset of the branches above
23+
branches: [ "master" ]
24+
schedule:
25+
- cron: '21 16 * * 1'
26+
27+
permissions:
28+
contents: read
29+
30+
jobs:
31+
PHPMD:
32+
name: Run PHPMD scanning
33+
runs-on: ubuntu-latest
34+
permissions:
35+
contents: read # for checkout to fetch code
36+
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
37+
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
38+
39+
steps:
40+
- name: Checkout code
41+
uses: actions/checkout@v4
42+
43+
- name: Setup PHP
44+
uses: shivammathur/setup-php@aa1fe473f9c687b6fb896056d771232c0bc41161
45+
with:
46+
coverage: none
47+
tools: phpmd
48+
ini-values: memory_limit=-1
49+
50+
- name: Run PHPMD
51+
run: phpmd . sarif cleancode,codesize,design,naming,unusedcode --reportfile phpmd-results.sarif --exclude cache/
52+
continue-on-error: true
53+
54+
- name: Upload analysis results to GitHub
55+
uses: github/codeql-action/upload-sarif@v4
56+
continue-on-error: true
57+
if: always() && hashFiles('phpmd-results.sarif') != ''
58+
with:
59+
sarif_file: phpmd-results.sarif
60+
wait-for-processing: true

0 commit comments

Comments
 (0)