Repository navigation
41 lines (38 loc) · 2.3 KB
/
Copy pathrector.yml
File metadata and controls
41 lines (38 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
on:
pull_request:
types: [ opened, labeled, synchronize ]
name: Inspections
# Cancel superseded runs for the same branch. The group is named explicitly
# rather than derived from github.workflow: several files share the workflow
# name `Inspections` and would otherwise cancel each other.
concurrency:
group: formidable-rector-${{ github.ref }}-${{ ((contains(github.event.pull_request.labels.*.name, 'run analysis') || contains(github.event.pull_request.labels.*.name, 'full automated qa')) && (github.event.action != 'labeled' || github.event.label.name == 'run analysis' || github.event.label.name == 'full automated qa')) && 'active' || github.run_id }}
cancel-in-progress: true
jobs:
runRectorInspection:
if: >-
(contains(github.event.pull_request.labels.*.name, 'run analysis') || contains(github.event.pull_request.labels.*.name, 'full automated qa'))
&& (github.event.action != 'labeled' || github.event.label.name == 'run analysis' || github.event.label.name == 'full automated qa')
name: Run Rector inspection
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
# Install only what this job runs, instead of every require-dev package.
# phpstan/phpstan is here for its exact pin, which is what holds Rector at
# 2.3.5 - resolving without it picks Rector 2.6.2, which fails this job on
# deprecated-rule warnings. phpunit-polyfills supplies the PHPUnit classes
# that rector.php's withAutoloadPaths() ends up loading.
# The guard fails the job if a package is renamed or dropped from
# composer.json, rather than silently narrowing to nothing.
- name: Install Rector
run: |
NEED='rector/rector phpstan/phpstan yoast/phpunit-polyfills'
for pkg in $NEED; do
jq -e --arg pkg "$pkg" '."require-dev" | has($pkg)' composer.json > /dev/null \
|| { echo "::error::composer.json has no require-dev entry for $pkg"; exit 1; }
done
jq '{require, autoload, config, "require-dev": (."require-dev" | with_entries(select(.key as $k | $ARGS.positional | index($k))))}' \
composer.json --args $NEED > composer.ci.json
COMPOSER=composer.ci.json composer install --prefer-dist --no-progress
- name: Rector check
run: ./vendor/bin/rector process --dry-run