Users should be able to update the Test-only changes file pattern

Migrated issue

Reported by: codebymikey

Related to !396 !388 (merged)

Problem/Motivation

The test-only script has a hard-coded pattern of file paths that it allows to be exempt from reverts.

<?php
PATTERN
='(tests/|composer\.json|\.info\.yml|phpunit\.xml|\.gitlab-ci\.yml)'
?>

However there are some specific cases where a particular change requires a specific file to not be reverted in order to test the behaviour properly, so should be supported.

e.g. #3521812: Take non-Clean URL requests into account

Proposed resolution

Introduce a new optional _TEST_ONLY_FILE_PATTERN variable that adds additional file patterns to the existing pattern list.

It's now also possible to trigger test-only changes jobs without needing to create a MR - this is useful if you need to test a feature branch without creating a MR before it's ready.

It works through a new optional _TEST_ONLY_TARGET_BRANCH variable that it compares against to determine if there are tests to run.

Remaining tasks

N/A

Related issue: Issue #3521812

Edited by drupalbot