Code Scanning #167
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This workflow uses actions that are not certified by GitHub. | |
| # They are provided by a third-party and are governed by | |
| # separate terms of service, privacy policy, and support | |
| # documentation. | |
| # PHPMD is a spin-off project of PHP Depend and | |
| # aims to be a PHP equivalent of the well known Java tool PMD. | |
| # What PHPMD does is: It takes a given PHP source code base | |
| # and look for several potential problems within that source. | |
| # These problems can be things like: | |
| # Possible bugs | |
| # Suboptimal code | |
| # Overcomplicated expressions | |
| # Unused parameters, methods, properties | |
| # More details at https://phpmd.org/ | |
| name: Code Scanning | |
| on: | |
| push: | |
| branches: [ 6.0 ] | |
| pull_request: | |
| branches: [ 6.0 ] | |
| schedule: | |
| - cron: '35 13 * * 4' | |
| permissions: | |
| contents: read | |
| jobs: | |
| PHPMD: | |
| name: Run PHPMD SARIF scan | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| security-events: write | |
| actions: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup PHP and PHPMD | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| coverage: none | |
| tools: phpmd | |
| - name: Run PHPMD | |
| run: phpmd src sarif .phpmd.xml.dist --reportfile phpmd-results.sarif | |
| continue-on-error: true | |
| - name: Validate SARIF | |
| id: validate_sarif | |
| if: always() && hashFiles('phpmd-results.sarif') != '' | |
| run: jq empty phpmd-results.sarif | |
| continue-on-error: true | |
| - name: Upload analysis results to GitHub | |
| if: always() && steps.validate_sarif.outcome == 'success' | |
| uses: github/codeql-action/upload-sarif@v4 | |
| with: | |
| sarif_file: phpmd-results.sarif | |
| wait-for-processing: true |