Make WordPress Core

Changeset 49781


Ignore:
Timestamp:
12/09/2020 08:05:01 PM (3 years ago)
Author:
desrosj
Message:

Build/Test Tools: Disable GitHub Action workflow runs triggered on push for forks and mirrors.

In the current state, the workflows run regardless of the repository context. This results many needless workflow runs that waste resources.

Workflow runs for private repositories are not free (accounts have a finite allotment of minutes for private repositories). This becomes problematic in private repositories that also mirror the WordPress develop repository, as any workflow runs will draw from a user’s or organization’s allotted action minutes.

Without blanket disabling the workflow manually for all event triggers, or modifying the workflow files in the forked/mirrored repository, there is no way to tune when the workflows run.

This change introduces a conditional statement into all GitHub Action workflows that prevents them from running on forked/mirrored repositories that are not wordpress-develop, except when a pull request is being submitted to that repository.

The exception to this is the Welcome workflow that posts a helpful message to first time contributors to wordpress-develop. This message is specific to this repository, so should only run when a PR is submitted to that repository.

See #50401.

Location:
trunk/.github/workflows
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/coding-standards.yml

    r49369 r49781  
    2828    name: PHP coding standards
    2929    runs-on: ubuntu-latest
     30    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
     31
    3032    steps:
    3133      - name: Checkout repository
     
    8688    name: JavaScript coding standards
    8789    runs-on: ubuntu-latest
     90    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    8891    env:
    8992      PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
     93
    9094    steps:
    9195      - name: Checkout repository
  • trunk/.github/workflows/end-to-end-tests.yml

    r49371 r49781  
    3535    name: E2E Tests
    3636    runs-on: ubuntu-latest
     37    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
     38
    3739    steps:
    3840      - name: Cancel previous runs of this workflow (pull requests only)
  • trunk/.github/workflows/javascript-tests.yml

    r49371 r49781  
    2424    name: QUnit Tests
    2525    runs-on: ubuntu-latest
     26    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
     27
    2628    steps:
    2729      - name: Cancel previous runs of this workflow (pull requests only)
  • trunk/.github/workflows/php-compatibility.yml

    r49175 r49781  
    2828    name: Check PHP compatibility
    2929    runs-on: ubuntu-latest
     30    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    3031
    3132    steps:
  • trunk/.github/workflows/phpunit-tests.yml

    r49371 r49781  
    3636    name: Setup WordPress
    3737    runs-on: ubuntu-latest
     38    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
    3839
    3940    steps:
  • trunk/.github/workflows/verify-npm-on-windows.yml

    r49371 r49781  
    2525    name: Tests NPM on Windows
    2626    runs-on: windows-latest
     27    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
     28
    2729    steps:
    2830      - name: Cancel previous runs of this workflow (pull requests only)
  • trunk/.github/workflows/welcome-new-contributors.yml

    r49548 r49781  
    99  post-welcome-message:
    1010    runs-on: ubuntu-latest
     11    if: ${{ github.repository == 'WordPress/wordpress-develop' }}
    1112
    1213    steps:
Note: See TracChangeset for help on using the changeset viewer.