Skip to content

Sonarcloud GitHub action for PHP library #3

Sonarcloud GitHub action for PHP library

Sonarcloud GitHub action for PHP library #3

name: SonarCloud Analysis
on: [push, pull_request, pull_request_target]
permissions:
contents: read
jobs:
analyse:
name: Analyse
if: github.repository == 'web-eid/web-eid-authtoken-validation-php'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run SonarCloud Scan
uses: sonarsource/[email protected]
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: https://sonarcloud.io