ci: addresses issues with workflows mirroring changes to deployments (resolves #2361, #2362) #3616
Workflow file for this run
This file contains 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
name: Analyze PHP code | |
on: | |
push: | |
branches: [dev, staging, production] | |
pull_request: | |
branches: [dev, staging, production] | |
jobs: | |
php-analyze: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php: [8.2] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: greguintow/get-diff-action@v7 | |
id: git-diff | |
with: | |
patterns: | | |
composer.json | |
composer.lock | |
**/*.php | |
- uses: shivammathur/setup-php@v2 | |
if: steps.git-diff.outputs.diff | |
with: | |
php-version: ${{ matrix.php }} | |
coverage: none | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache composer dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install dependencies | |
if: steps.git-diff.outputs.diff | |
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | |
- name: Generate key | |
if: steps.git-diff.outputs.diff | |
run: echo "CIPHERSWEET_KEY=\"$(openssl rand -hex 32)\"" >> .env | |
- name: Perform static analysis | |
if: steps.git-diff.outputs.diff | |
run: composer analyze |