From e20103f6e6b004a3d02fb56fbeacf9ead52ca6eb Mon Sep 17 00:00:00 2001 From: PN Scripts Date: Sun, 8 Nov 2026 19:39:56 +0200 Subject: [PATCH] CI audits the dependencies; pinned actions; grouped Dependabot updates CI resolves the newest versions the constraints allow on every run but never checked them against the advisories. It now runs composer audit on that resolution (PHP 8.4), and composer check does the same first. Actions are pinned to commit hashes (checkout 7.0.1, setup-php 2.40.0) and a newer push cancels the run it replaces. Dependabot widens the constraints weekly in one grouped pull request per ecosystem and raises security updates at once. Checked locally: composer check (audit clean, php-cs-fixer, PHPStan, 832 tests). Co-Authored-By: Claude Opus 5.5 --- .github/dependabot.yml | 39 +++++++++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 19 +++++++++++++++---- composer.json | 1 + 3 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..51cecd8 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,39 @@ +# A library commits no composer.lock, so CI resolves the newest versions on +# every run and audits them; Dependabot watches the constraints in +# composer.json and the actions. Minor and patch updates come once a week in +# one pull request per ecosystem; security updates as soon as they are +# published. +version: 2 +updates: + - package-ecosystem: composer + directory: / + schedule: + interval: weekly + day: monday + time: '06:00' + timezone: Europe/Sofia + open-pull-requests-limit: 5 + versioning-strategy: widen + groups: + composer: + applies-to: version-updates + update-types: [minor, patch] + composer-security: + applies-to: security-updates + patterns: ['*'] + + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + day: monday + time: '06:00' + timezone: Europe/Sofia + open-pull-requests-limit: 5 + groups: + actions: + applies-to: version-updates + update-types: [minor, patch] + actions-security: + applies-to: security-updates + patterns: ['*'] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b285fa9..eeef8e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,11 @@ on: permissions: contents: read +# A newer push to the same branch or pull request replaces a run still in progress. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: tests: name: PHP ${{ matrix.php }} @@ -17,9 +22,9 @@ jobs: matrix: php: ['8.3', '8.4', '8.5'] steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - uses: shivammathur/setup-php@v2 + - uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0 with: php-version: ${{ matrix.php }} extensions: bcmath, dom, libxml @@ -31,6 +36,12 @@ jobs: - name: Install dependencies run: composer update --no-interaction --no-progress --prefer-dist + # The newest versions the constraints allow, checked against the + # advisories: what a new install of this library gets. + - name: Composer audit + if: matrix.php == '8.4' + run: composer audit + - name: Coding standard if: matrix.php == '8.4' run: vendor/bin/php-cs-fixer fix --dry-run --diff @@ -48,8 +59,8 @@ jobs: name: Lowest dependencies (PHP 8.3) runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 - - uses: shivammathur/setup-php@v2 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0 with: php-version: '8.3' extensions: bcmath, dom, libxml diff --git a/composer.json b/composer.json index ed13dd3..4cdf7b8 100644 --- a/composer.json +++ b/composer.json @@ -53,6 +53,7 @@ "cs": "php-cs-fixer fix --dry-run --diff", "cs:fix": "php-cs-fixer fix", "check": [ + "@composer audit", "@cs", "@analyse", "@test"