Files
Adnan Khan 3777bfa3da Scope down GitHub Token Permissions (#7640)
* Scope down GitHub token permissions for writeme.yml, yaml-lint.yml, lint-php.yml, lint-ruby.yml, lint-kotlin.yml, and lint-javascript.yml
2025-10-21 12:22:49 +01:00

44 lines
1.1 KiB
YAML

name: "PHP Linter"
on: # yamllint disable-line rule:truthy
workflow_dispatch:
pull_request:
paths:
- "**.php"
- ".github/linters/phpcs.xml"
- ".github/workflows/php-lint.yml"
permissions:
contents: read
jobs:
phpcs:
name: "PHP Linter"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@e9772d140489982e0e3704fea5ee93d536f1e275
with:
files: "/php/**/*.php"
- name: Install PHP_CodeSniffer
if: steps.changed-files.outputs.any_changed == 'true'
run: |
curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
php phpcs.phar --version
- name: Run PHPCS
uses: thenabeel/action-phpcs@v8
if: steps.changed-files.outputs.any_changed == 'true'
with:
files: "**.php"
phpcs_path: php phpcs.phar
standard: ".github/linters/phpcs.xml"