You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[minor] address bug with too much in the PRs (#12)
* 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
* debug the passed branch
* more debugging
* use the remote default branch if it doesn't exist locally
* output the contents of the changed files if we're dry-running
this way we can see what's being changed
* remove debugging from the test workflow
* add newline
* move the newline before the cat
formats nicer
if git show-ref --verify --quiet "refs/remotes/origin/$BRANCH";then
15
+
echo"Branch '$BRANCH' exists on remote. Checking out from remote."
16
+
git checkout -b "$BRANCH""origin/$BRANCH"
17
+
else
18
+
echo"Error: Branch '$BRANCH' does not exist."
19
+
exit 1
20
+
fi
21
+
else
22
+
echo"Checking out branch $BRANCH"
23
+
git checkout "$BRANCH"
24
+
fi
25
+
fi
26
+
6
27
# If $PLUGIN_PATH is defined, echo it.
7
28
if [[ -n"${PLUGIN_PATH:-}" ]];then
8
-
PLUGIN_PATH=${WORKFLOW_PATH}/${PLUGIN_PATH}
29
+
PLUGIN_PATH=${WORKFLOW_PATH}/${PLUGIN_PATH}
9
30
echo"Plugin path: $PLUGIN_PATH"
10
31
else
11
32
local PLUGIN_PATH
@@ -89,6 +110,11 @@ main() {
89
110
full_path="${PLUGIN_PATH}/${trimmed_filename}"
90
111
if [[ -f"$full_path" ]];then
91
112
git add "$full_path"
113
+
# If we're dry-running, output the contents of the changed files.
114
+
if [[ "${DRY_RUN}"=="true" ]];then
115
+
echo -e "\n"
116
+
cat "$full_path"
117
+
fi
92
118
fi
93
119
done
94
120
@@ -108,7 +134,11 @@ main() {
108
134
git commit -m "Update Tested Up To version to $CURRENT_WP_VERSION"
109
135
git push origin "$BRANCH_NAME"
110
136
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"
137
+
# Determine the base branch for the PR
138
+
BASE_BRANCH="${BRANCH:-$DEFAULT_BRANCH}"
139
+
140
+
echo"Creating a pull request with base branch $BASE_BRANCH."
141
+
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"
0 commit comments