From 481bdeebdf5b88fcf51b12e87fd5976582f0a838 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 2 Mar 2021 19:57:15 +0000 Subject: [PATCH] Build/Test Tools: Add path detection when running GitHub Actions on `pull_request`. This change adds a list of paths to check when determining which workflows to run on `pull_request`. This will prevent certain workflows from running unnecessarily when the files updated are not related to the tests and checks being performed. Props peterwilsoncc, johnbillion. Fixes #52667. git-svn-id: https://develop.svn.wordpress.org/trunk@50479 602fd350-edb4-49c9-b593-d223f7449a82 --- .github/workflows/coding-standards.yml | 14 ++++++++++++++ .github/workflows/javascript-tests.yml | 13 +++++++++++++ .github/workflows/php-compatibility.yml | 9 +++++++++ .github/workflows/verify-npm-on-windows.yml | 10 ++++++++++ 4 files changed, 46 insertions(+) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 5a7f4aaa93..3c4d9c0cb7 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -18,6 +18,20 @@ on: - trunk - '3.[89]' - '[4-9].[0-9]' + paths: + # Any change to a PHP or JavaScript file should run checks. + - '**.js' + - '**.php' + # These files configure NPM. Changes could affect the outcome. + - 'package*.json' + # These files configure Composer. Changes could affect the outcome. + - 'composer.*' + # This file configures JSHint. Changes could affect the outcome. + - '.jshintrc' + # This file configures PHPCS. Changes could affect the outcome. + - 'phpcs.xml.dist' + # Changes to workflow files should always verify all workflows are successful. + - '.github/workflows/*.yml' jobs: # Runs PHP coding standards checks. diff --git a/.github/workflows/javascript-tests.yml b/.github/workflows/javascript-tests.yml index 57dfbc25b9..315d6c4885 100644 --- a/.github/workflows/javascript-tests.yml +++ b/.github/workflows/javascript-tests.yml @@ -17,6 +17,19 @@ on: - trunk - '3.[89]' - '[4-9].[0-9]' + paths: + # Any change to a JavaScript file should run tests. + - '**.js' + # These files configure NPM. Changes could affect the outcome. + - 'package*.json' + # This file configures ESLint. Changes could affect the outcome. + - '.eslintignore' + # This file configures JSHint. Changes could affect the outcome. + - '.jshintrc' + # Any change to the QUnit directory should run tests. + - 'tests/qunit/**' + # Changes to workflow files should always verify all workflows are successful. + - '.github/workflows/*.yml' jobs: # Runs the QUnit tests for WordPress. diff --git a/.github/workflows/php-compatibility.yml b/.github/workflows/php-compatibility.yml index fcb2100eda..5656b8c5fa 100644 --- a/.github/workflows/php-compatibility.yml +++ b/.github/workflows/php-compatibility.yml @@ -17,6 +17,15 @@ on: - trunk - '5.[5-9]' - '[6-9].[0-9]' + paths: + # This workflow only scans PHP files. + - '**.php' + # These files configure Composer. Changes could affect the outcome. + - 'composer.*' + # This file configures PHP Compatibility scanning. Changes could affect the outcome. + - 'phpcompat.xml.dist' + # Changes to workflow files should always verify all workflows are successful. + - '.github/workflows/*.yml' jobs: diff --git a/.github/workflows/verify-npm-on-windows.yml b/.github/workflows/verify-npm-on-windows.yml index a1f47b0fd3..829f572fdf 100644 --- a/.github/workflows/verify-npm-on-windows.yml +++ b/.github/workflows/verify-npm-on-windows.yml @@ -13,6 +13,16 @@ on: - trunk - '3.[7-9]' - '[4-9].[0-9]' + paths: + # These files configure NPM. Changes could affect the outcome. + - 'package*.json' + # JavaScript files are built using NPM. + - '**.js' + # CSS and SCSS files are built using NPM. + - '**.scss' + - '**.css' + # Changes to workflow files should always verify all workflows are successful. + - '.github/workflows/**.yml' env: PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}