Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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"
interval: "weekly"

- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "daily"
allow:
- dependency-type: "production"
versioning-strategy: "increase"
40 changes: 35 additions & 5 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,48 @@ 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 }}

# 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 }}
Expand Down
38 changes: 34 additions & 4 deletions .github/workflows/tests-backward-compat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand Down
53 changes: 44 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand Down Expand Up @@ -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
Expand Down
Loading