diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 410f5b7bc..335760f0a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,8 +1,16 @@ -# Configures Dependabot to update packages used in GitHub Actions +# Configures Dependabot to update packages used in GitHub Actions and Composer # https://docs.github.com/en/code-security/how-tos/secure-your-supply-chain/secure-your-dependencies/keeping-your-actions-up-to-date-with-dependabot version: 2 updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "weekly" \ No newline at end of file + interval: "weekly" + + - package-ecosystem: "composer" + directory: "/" + schedule: + interval: "daily" + allow: + - dependency-type: "production" + versioning-strategy: "increase" \ No newline at end of file diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 7e25bfa73..362045e72 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -11,6 +11,29 @@ on: - main jobs: + dependabot-metadata: + # Name. + name: Dependabot Metadata + + # Virtual Environment to use. + # @see: https://github.com/actions/virtual-environments + runs-on: ubuntu-latest + + # Don't run if the PR is not from Dependabot. + if: github.actor == 'dependabot[bot]' + + # Outputs. + outputs: + package-ecosystem: ${{ steps.metadata.outputs.package-ecosystem }} + + # Steps to fetch Dependabot metadata. + steps: + - name: Fetch Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@v2 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + tests: # Name. name: Coding Standards / WordPress ${{ matrix.wp-versions }} / PHP ${{ matrix.php-versions }} @@ -18,11 +41,18 @@ jobs: # Virtual Environment to use. # @see: https://github.com/actions/virtual-environments runs-on: ubuntu-latest - - # Don't run if the PR is from Dependabot, as it doesn't have access to the repository's secrets. - # Dependabot also only checks for GitHub action dependencies, so it's not necessary to run - # Plugin tests. - if: github.actor != 'dependabot[bot]' + + # Requieres the dependabot-metadata job to have run successfully. + needs: [dependabot-metadata] + + # Always allow non-Dependabot PRs and pushes. + # For Dependabot PRs, only run when the update is for composer (skip github-actions updates). + if: | + always() && + ( + github.actor != 'dependabot[bot]' || + needs.dependabot-metadata.outputs.package-ecosystem == 'composer' + ) # Environment Variables. # Accessible by using ${{ env.NAME }} diff --git a/.github/workflows/tests-backward-compat.yml b/.github/workflows/tests-backward-compat.yml index 99b7e593a..ba9e2a9af 100644 --- a/.github/workflows/tests-backward-compat.yml +++ b/.github/workflows/tests-backward-compat.yml @@ -11,6 +11,29 @@ on: - main jobs: + dependabot-metadata: + # Name. + name: Dependabot Metadata + + # Virtual Environment to use. + # @see: https://github.com/actions/virtual-environments + runs-on: ubuntu-latest + + # Don't run if the PR is not from Dependabot. + if: github.actor == 'dependabot[bot]' + + # Outputs. + outputs: + package-ecosystem: ${{ steps.metadata.outputs.package-ecosystem }} + + # Steps to fetch Dependabot metadata. + steps: + - name: Fetch Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@v2 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + tests: # Name. name: ${{ matrix.test-groups }} / WordPress ${{ matrix.wp-versions }} / PHP ${{ matrix.php-versions }} @@ -19,10 +42,17 @@ jobs: # @see: https://github.com/actions/virtual-environments runs-on: ubuntu-latest - # Don't run if the PR is from Dependabot, as it doesn't have access to the repository's secrets. - # Dependabot also only checks for GitHub action dependencies, so it's not necessary to run - # Plugin tests. - if: github.actor != 'dependabot[bot]' + # Requieres the dependabot-metadata job to have run successfully. + needs: [dependabot-metadata] + + # Always allow non-Dependabot PRs and pushes. + # For Dependabot PRs, only run when the update is for composer (skip github-actions updates). + if: | + always() && + ( + github.actor != 'dependabot[bot]' || + needs.dependabot-metadata.outputs.package-ecosystem == 'composer' + ) # Environment Variables. # Accessible by using ${{ env.NAME }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1cac107e7..86aa579eb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,6 +11,29 @@ on: - main jobs: + dependabot-metadata: + # Name. + name: Dependabot Metadata + + # Virtual Environment to use. + # @see: https://github.com/actions/virtual-environments + runs-on: ubuntu-latest + + # Don't run if the PR is not from Dependabot. + if: github.actor == 'dependabot[bot]' + + # Outputs. + outputs: + package-ecosystem: ${{ steps.metadata.outputs.package-ecosystem }} + + # Steps to fetch Dependabot metadata. + steps: + - name: Fetch Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@v2 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + tests: # Name. name: ${{ matrix.test-groups }} / WordPress ${{ matrix.wp-versions }} / PHP ${{ matrix.php-versions }} @@ -19,10 +42,17 @@ jobs: # @see: https://github.com/actions/virtual-environments runs-on: ubuntu-latest - # Don't run if the PR is from Dependabot, as it doesn't have access to the repository's secrets. - # Dependabot also only checks for GitHub action dependencies, so it's not necessary to run - # Plugin tests. - if: github.actor != 'dependabot[bot]' + # Requieres the dependabot-metadata job to have run successfully. + needs: [dependabot-metadata] + + # Always allow non-Dependabot PRs and pushes. + # For Dependabot PRs, only run when the update is for composer (skip github-actions updates). + if: | + always() && + ( + github.actor != 'dependabot[bot]' || + needs.dependabot-metadata.outputs.package-ecosystem == 'composer' + ) # Environment Variables. # Accessible by using ${{ env.NAME }} @@ -396,11 +426,16 @@ jobs: build-and-deploy: name: WordPress Playground - # Require the tests workflow to have run successfully. - needs: tests - - # Only run on pull requests, not when merging to main branch - if: github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' + # Require the dependabot-metadata and tests workflows to have run successfully. + needs: [dependabot-metadata, tests] + if: | + always() && + github.event_name == 'pull_request' && + needs.tests.result == 'success' && + ( + github.actor != 'dependabot[bot]' || + needs.dependabot-metadata.outputs.package-ecosystem == 'composer' + ) # Virtual Environment to use. # @see: https://github.com/actions/virtual-environments