diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d7ebdbf..5fd269d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,16 +1,20 @@ version: 2 updates: - # Maintain dependencies for GitHub Actions. - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "daily" - # Too noisy. See https://github.community/t/increase-if-necessary-for-github-actions-in-dependabot/179581 - open-pull-requests-limit: 0 + # Maintain dependencies for GitHub Actions. + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + cooldown: + default-days: 7 + ignore: + - dependency-name: "yiisoft/*" - # Maintain dependencies for Composer - - package-ecosystem: "composer" - directory: "/" - schedule: - interval: "daily" - versioning-strategy: increase-if-necessary + # Maintain dependencies for Composer + - package-ecosystem: "composer" + directory: "/" + schedule: + interval: "daily" + versioning-strategy: increase-if-necessary + cooldown: + default-days: 7 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 16de44f..090bbdf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,6 +20,13 @@ on: name: build +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + jobs: codeception: name: PHP ${{ matrix.php }}-${{ matrix.os }} @@ -45,10 +52,12 @@ jobs: steps: - name: Checkout. - uses: actions/checkout@v4 + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + with: + persist-credentials: false - name: Install PHP with extensions. - uses: shivammathur/setup-php@v2 + uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2 with: coverage: false extensions: fileinfo, intl @@ -56,7 +65,7 @@ jobs: php-version: ${{ matrix.php }} - name: Install Composer dependencies - uses: ramsey/composer-install@v3 + uses: ramsey/composer-install@a8d0d959dab41457692a5e2041bd9b757a119e3f # 3.2.1 - name: Run codeception build. run: vendor/bin/codecept build @@ -72,7 +81,7 @@ jobs: - name: Upload coverage to Codecov. if: matrix.os == 'ubuntu-latest' - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 with: token: ${{ secrets.CODECOV_TOKEN }} files: runtime/tests/_output/coverage.xml diff --git a/.github/workflows/composer-dependency-analyzer.yml b/.github/workflows/composer-dependency-analyzer.yml index 973be4b..2ef3d7c 100644 --- a/.github/workflows/composer-dependency-analyzer.yml +++ b/.github/workflows/composer-dependency-analyzer.yml @@ -22,6 +22,13 @@ on: name: Composer dependency analyzer +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + jobs: analyzer: name: PHP ${{ matrix.php }}-${{ matrix.os }} @@ -40,17 +47,19 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + with: + persist-credentials: false - name: Install PHP with extensions - uses: shivammathur/setup-php@v2 + uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2 with: coverage: none php-version: ${{ matrix.php }} tools: composer:v2, cs2pr - name: Install Composer dependencies - uses: ramsey/composer-install@v3 + uses: ramsey/composer-install@a8d0d959dab41457692a5e2041bd9b757a119e3f # 3.2.1 - name: Run composer dependency analyzer run: vendor/bin/composer-dependency-analyser --config=composer-dependency-analyser.php diff --git a/.github/workflows/cs.yml b/.github/workflows/cs.yml index d258a46..a8ee45f 100644 --- a/.github/workflows/cs.yml +++ b/.github/workflows/cs.yml @@ -1,5 +1,12 @@ name: Code Style +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + on: pull_request: paths-ignore: @@ -12,22 +19,25 @@ on: jobs: cs-fix: + name: PHP CS Fixer and Rector runs-on: ubuntu-latest permissions: - contents: write + contents: write # Required to push automated CS fixes to the pull request branch. steps: - name: Checkout code - uses: actions/checkout@v6 + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + with: + persist-credentials: false - name: Install PHP - uses: shivammathur/setup-php@v2 + uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2 with: php-version: 8.2 tools: composer:v2 coverage: none - name: Install Composer dependencies - uses: "ramsey/composer-install@v4" + uses: ramsey/composer-install@a8d0d959dab41457692a5e2041bd9b757a119e3f # 3.2.1 - name: Run PHP CS Fixer run: ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php @@ -35,9 +45,20 @@ jobs: - name: Run Rector run: ./vendor/bin/rector --output-format=github + - name: Configure Git credentials + env: + GH_TOKEN: ${{ github.token }} + run: git config --global credential.helper '!f() { echo username=x-access-token; echo password=$GH_TOKEN; }; f' + - name: Commit changes - uses: stefanzweifel/git-auto-commit-action@v7 - with: - commit_message: "Apply PHP CS Fixer and Rector changes (CI)" - file_pattern: '*.php' - disable_globbing: true + run: | + git add -- '*.php' + + if git diff --cached --quiet; then + exit 0 + fi + + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git commit -m "Apply PHP CS Fixer and Rector changes (CI)" + git push diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 5eba8a9..ff81524 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -20,6 +20,13 @@ on: name: static analysis +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + jobs: psalm: name: PHP ${{ matrix.php }}-${{ matrix.os }} @@ -37,17 +44,21 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + with: + persist-credentials: false - name: Install PHP with extensions - uses: shivammathur/setup-php@v2 + uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2 with: coverage: none php-version: ${{ matrix.php }} tools: composer:v2, cs2pr - name: Install Composer dependencies - uses: ramsey/composer-install@v3 + uses: ramsey/composer-install@a8d0d959dab41457692a5e2041bd9b757a119e3f # 3.2.1 - name: Static analysis - run: vendor/bin/psalm --shepherd --stats --output-format=checkstyle --no-cache --php-version=${{ matrix.php }} | cs2pr --graceful-warnings --colorize + env: + PHP_VERSION: ${{ matrix.php }} + run: vendor/bin/psalm --shepherd --stats --output-format=checkstyle --no-cache --php-version="${PHP_VERSION}" | cs2pr --graceful-warnings --colorize diff --git a/.github/workflows/zizmor.yml b/.github/workflows/zizmor.yml new file mode 100644 index 0000000..430255d --- /dev/null +++ b/.github/workflows/zizmor.yml @@ -0,0 +1,22 @@ +name: GitHub Actions Security Analysis with zizmor 🌈 + +on: + push: + branches: + - master + - main + paths: + - '.github/**.yml' + - '.github/**.yaml' + pull_request: + paths: + - '.github/**.yml' + - '.github/**.yaml' + +permissions: + actions: read # Required by zizmor when reading workflow metadata through the API. + contents: read # Required to read workflow files. + +jobs: + zizmor: + uses: yiisoft/actions/.github/workflows/zizmor.yml@master