Skip to content

Comments

Add validation for ref variable in install-wp-tests.sh#361

Merged
swissspidy merged 2 commits intotry/322-refreshfrom
copilot/sub-pr-356
Jan 20, 2026
Merged

Add validation for ref variable in install-wp-tests.sh#361
swissspidy merged 2 commits intotry/322-refreshfrom
copilot/sub-pr-356

Conversation

Copy link
Contributor

Copilot AI commented Jan 20, 2026

The ref variable is set from WP_TESTS_TAG via parameter expansion but lacks validation before use in download URLs. If WP_TESTS_TAG is malformed (e.g., "tags/", "branches/", or empty), the parameter expansion produces an empty ref, causing download failures with unclear errors.

Changes

  • Added empty-string validation for ref after parameter expansion in install_test_suite()
  • Added empty-string validation for ref before downloading wp-tests-config-sample.php
  • Both validations exit with descriptive error messages including the problematic WP_TESTS_TAG value

Example

# Before: unclear curl/wget failure when ref is empty
download https://raw.githubusercontent.com/.../wordpress-develop/${ref}/wp-tests-config-sample.php

# After: clear error message
if [ -z "$ref" ]; then
    echo -e "${RED}Error:${RESET} Unable to determine git reference from WP_TESTS_TAG: $WP_TESTS_TAG"
    exit 1
fi

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@github-actions github-actions bot added command:scaffold-plugin-tests Related to 'scaffold plugin-tests' command help-wanted Extra attention is needed scope:testing Related to testing labels Jan 20, 2026
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP Address feedback on light updates to the install-wp-tests.sh script Add validation for ref variable in install-wp-tests.sh Jan 20, 2026
Copilot AI requested a review from swissspidy January 20, 2026 10:36
@swissspidy swissspidy marked this pull request as ready for review January 20, 2026 10:38
@swissspidy swissspidy requested a review from a team as a code owner January 20, 2026 10:38
@swissspidy swissspidy merged commit 2495daf into try/322-refresh Jan 20, 2026
9 checks passed
@swissspidy swissspidy deleted the copilot/sub-pr-356 branch January 20, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:scaffold-plugin-tests Related to 'scaffold plugin-tests' command help-wanted Extra attention is needed scope:testing Related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants