Skip to content

Commit e91a288

Browse files
committed
address bug with too much in the PRs
sets the default branch and checks out the passed branch if it exists uses those as the base previously $BRANCH was not being set
1 parent a2dd835 commit e91a288

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

bin/validate-plugin-version.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ set -euo pipefail
33
IFS=$'\n\t'
44

55
main() {
6+
# Determine the default branch
7+
DEFAULT_BRANCH=$(git remote show origin | grep 'HEAD branch' | cut -d' ' -f5)
8+
echo "Default branch is $DEFAULT_BRANCH"
9+
10+
# Check out the specified branch if $BRANCH is set
11+
if [[ -n "${BRANCH:-}" ]]; then
12+
echo "Checking out branch $BRANCH"
13+
git checkout "$BRANCH"
14+
fi
15+
616
# If $PLUGIN_PATH is defined, echo it.
717
if [[ -n "${PLUGIN_PATH:-}" ]]; then
818
PLUGIN_PATH=${WORKFLOW_PATH}/${PLUGIN_PATH}
@@ -108,7 +118,11 @@ main() {
108118
git commit -m "Update Tested Up To version to $CURRENT_WP_VERSION"
109119
git push origin "$BRANCH_NAME"
110120

111-
gh pr create --title "Update Tested Up To version to $CURRENT_WP_VERSION" --body "This pull request updates the \"Tested up to\" version in specified files (${FILENAMES}) to match the current WordPress version $CURRENT_WP_VERSION." --base "$BRANCH"
121+
# Determine the base branch for the PR
122+
BASE_BRANCH="${BRANCH:-$DEFAULT_BRANCH}"
123+
124+
echo "Creating a pull request with base branch $BASE_BRANCH."
125+
gh pr create --title "Update Tested Up To version to $CURRENT_WP_VERSION" --body "This pull request updates the \"Tested up to\" version in specified files (${FILENAMES}) to match the current WordPress version $CURRENT_WP_VERSION." --base "$BASE_BRANCH"
112126
}
113127

114128
main

0 commit comments

Comments
 (0)