Skip to content

Commit 7873aa7

Browse files
committed
chore: rename variables
1 parent eaf35e0 commit 7873aa7

1 file changed

Lines changed: 30 additions & 30 deletions

File tree

scripts/deploy-qa.sh

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -281,32 +281,32 @@ fi
281281
# =============================================================================
282282
MAIN_ORG="boostorg"
283283
MAIN_REPO="website-v2"
284-
MY_ORG="cppalliance"
285-
MY_REPO="website-v2-qa"
286-
TARGET_BRANCH="cppal-dev" # the important branch we merge/reset into
284+
QA_ORG="cppalliance"
285+
QA_REPO="website-v2-qa"
286+
TARGET_QA_BRANCH="cppal-dev" # the important branch we merge/reset into
287287

288288
MAIN_REMOTE_NAME="upstream" # name given to the mainorg/mainrepo remote locally
289-
MY_REMOTE_URL="https://github.com/${MY_ORG}/${MY_REPO}.git"
289+
QA_REMOTE_URL="https://github.com/${QA_ORG}/${QA_REPO}.git"
290290
MAIN_REMOTE_URL="https://github.com/${MAIN_ORG}/${MAIN_REPO}.git"
291291

292292
QA_ROOT="${HOME}/qa-automation"
293-
WORK_DIR="${QA_ROOT}/${MY_ORG}/${MY_REPO}"
293+
WORK_DIR="${QA_ROOT}/${QA_ORG}/${QA_REPO}"
294294
# =============================================================================
295295

296296
usage() {
297297
cat <<EOF
298298
Usage: $(basename "$0") [OPTIONS] <PR_NUMBER>
299299
300300
Check out a pull request from ${MAIN_ORG}/${MAIN_REPO} and apply it to the
301-
local '${TARGET_BRANCH}' branch in ${MY_ORG}/${MY_REPO}.
301+
local '${TARGET_QA_BRANCH}' branch in ${QA_ORG}/${QA_REPO}.
302302
303303
Arguments:
304304
PR_NUMBER The pull request number from ${MAIN_ORG}/${MAIN_REPO}
305305
306306
Options:
307307
--bundle Build the DeployQA macOS GUI app and exit.
308308
--merge Perform a standard merge and regular git push.
309-
Without this flag the script hard-resets '${TARGET_BRANCH}'
309+
Without this flag the script hard-resets '${TARGET_QA_BRANCH}'
310310
to the PR's commit SHA and performs a force push instead.
311311
--yes Skip the confirmation prompt before pushing.
312312
--verbose Show Git error/warning messages (suppressed by default).
@@ -315,10 +315,10 @@ Options:
315315
Workflow:
316316
1. Ensures \$HOME/qa-automation directory structure exists and the repo is cloned.
317317
2. Fetches the PR from ${MAIN_ORG}/${MAIN_REPO} into a local tracking branch.
318-
3. Switches to '${TARGET_BRANCH}'.
319-
4. Without --merge: hard-resets '${TARGET_BRANCH}' to the PR commit SHA,
318+
3. Switches to '${TARGET_QA_BRANCH}'.
319+
4. Without --merge: hard-resets '${TARGET_QA_BRANCH}' to the PR commit SHA,
320320
then force-pushes to origin.
321-
With --merge: merges the PR branch into '${TARGET_BRANCH}',
321+
With --merge: merges the PR branch into '${TARGET_QA_BRANCH}',
322322
then pushes normally to origin.
323323
5. Prompts before any push so you stay in control.
324324
@@ -399,9 +399,9 @@ ensure_repo() {
399399
mkdir -p "${QA_ROOT}"
400400

401401
if [[ ! -d "${WORK_DIR}/.git" ]]; then
402-
echo "==> Cloning ${MY_ORG}/${MY_REPO} into ${WORK_DIR}"
402+
echo "==> Cloning ${QA_ORG}/${QA_REPO} into ${WORK_DIR}"
403403
mkdir -p "$(dirname "${WORK_DIR}")"
404-
eval "git clone \"${MY_REMOTE_URL}\" \"${WORK_DIR}\" ${ERR_REDIRECT}"
404+
eval "git clone \"${QA_REMOTE_URL}\" \"${WORK_DIR}\" ${ERR_REDIRECT}"
405405
fi
406406

407407
cd "${WORK_DIR}"
@@ -422,26 +422,26 @@ cd "${WORK_DIR}"
422422
PR_REF="refs/pull/${PR_NUMBER}/head"
423423
LOCAL_PR_BRANCH="pr/${PR_NUMBER}"
424424

425-
echo "==> Switching to '${TARGET_BRANCH}' before fetching ..."
426-
if git show-ref --quiet "refs/heads/${TARGET_BRANCH}"; then
427-
eval "git checkout \"${TARGET_BRANCH}\" ${ERR_REDIRECT}"
425+
echo "==> Switching to '${TARGET_QA_BRANCH}' before fetching ..."
426+
if git show-ref --quiet "refs/heads/${TARGET_QA_BRANCH}"; then
427+
eval "git checkout \"${TARGET_QA_BRANCH}\" ${ERR_REDIRECT}"
428428

429429
# Check if local branch has diverged from remote (rebased scenario)
430-
if git ls-remote --exit-code origin "refs/heads/${TARGET_BRANCH}" &>/dev/null; then
430+
if git ls-remote --exit-code origin "refs/heads/${TARGET_QA_BRANCH}" &>/dev/null; then
431431
# Get the commit SHAs for comparison
432432
LOCAL_SHA=$(git rev-parse "HEAD")
433-
REMOTE_SHA=$(git rev-parse "origin/${TARGET_BRANCH}" 2>/dev/null || echo "")
433+
REMOTE_SHA=$(git rev-parse "origin/${TARGET_QA_BRANCH}" 2>/dev/null || echo "")
434434

435435
if [[ -n "$REMOTE_SHA" && "$LOCAL_SHA" != "$REMOTE_SHA" ]]; then
436436
echo "==> Local branch has diverged from remote (likely rebased). Resetting to remote..."
437-
eval "git reset --hard \"origin/${TARGET_BRANCH}\" ${ERR_REDIRECT}"
437+
eval "git reset --hard \"origin/${TARGET_QA_BRANCH}\" ${ERR_REDIRECT}"
438438
fi
439439
fi
440440
else
441-
if git ls-remote --exit-code origin "refs/heads/${TARGET_BRANCH}" &>/dev/null; then
442-
eval "git checkout -b \"${TARGET_BRANCH}\" \"origin/${TARGET_BRANCH}\" ${ERR_REDIRECT}"
441+
if git ls-remote --exit-code origin "refs/heads/${TARGET_QA_BRANCH}" &>/dev/null; then
442+
eval "git checkout -b \"${TARGET_QA_BRANCH}\" \"origin/${TARGET_QA_BRANCH}\" ${ERR_REDIRECT}"
443443
else
444-
eval "git checkout -b \"${TARGET_BRANCH}\" ${ERR_REDIRECT}"
444+
eval "git checkout -b \"${TARGET_QA_BRANCH}\" ${ERR_REDIRECT}"
445445
fi
446446
fi
447447

@@ -455,48 +455,48 @@ if [[ "$DO_MERGE" == true ]]; then
455455
# -----------------------------------------------------------------------
456456
# MERGE mode: standard merge then normal push
457457
# -----------------------------------------------------------------------
458-
echo "==> Merging '${LOCAL_PR_BRANCH}' into '${TARGET_BRANCH}' …"
458+
echo "==> Merging '${LOCAL_PR_BRANCH}' into '${TARGET_QA_BRANCH}' …"
459459
eval "git merge \"${LOCAL_PR_BRANCH}\" --no-edit ${ERR_REDIRECT}"
460460

461461
SHOULD_PUSH=false
462462
if [[ "$PUSH_AUTO" == true ]]; then
463463
SHOULD_PUSH=true
464464
else
465-
printf "\nPush the PR to the branch '%s'? (y/n) " "${TARGET_BRANCH}"
465+
printf "\nPush the PR to the branch '%s'? (y/n) " "${TARGET_QA_BRANCH}"
466466
read -r ANSWER
467467
if [[ "$ANSWER" =~ ^[Yy]$ ]]; then
468468
SHOULD_PUSH=true
469469
fi
470470
fi
471471

472472
if [[ "$SHOULD_PUSH" == true ]]; then
473-
echo "==> Pushing to origin/${TARGET_BRANCH}"
474-
eval "git push origin \"${TARGET_BRANCH}\" ${ERR_REDIRECT}"
473+
echo "==> Pushing to origin/${TARGET_QA_BRANCH}"
474+
eval "git push origin \"${TARGET_QA_BRANCH}\" ${ERR_REDIRECT}"
475475
echo "Done."
476476
else
477477
echo "Push skipped."
478478
fi
479479
else
480480
# -----------------------------------------------------------------------
481-
# FORCE-PUSH mode: hard-reset TARGET_BRANCH to the PR SHA, then force-push
481+
# FORCE-PUSH mode: hard-reset TARGET_QA_BRANCH to the PR SHA, then force-push
482482
# -----------------------------------------------------------------------
483-
echo "==> Hard-resetting '${TARGET_BRANCH}' to PR commit ${PR_SHA}"
483+
echo "==> Hard-resetting '${TARGET_QA_BRANCH}' to PR commit ${PR_SHA}"
484484
eval "git reset --hard \"${PR_SHA}\" ${ERR_REDIRECT}"
485485

486486
SHOULD_PUSH=false
487487
if [[ "$PUSH_AUTO" == true ]]; then
488488
SHOULD_PUSH=true
489489
else
490-
printf "\nForce push the PR to the branch '%s'? (y/n) " "${TARGET_BRANCH}"
490+
printf "\nForce push the PR to the branch '%s'? (y/n) " "${TARGET_QA_BRANCH}"
491491
read -r ANSWER
492492
if [[ "$ANSWER" =~ ^[Yy]$ ]]; then
493493
SHOULD_PUSH=true
494494
fi
495495
fi
496496

497497
if [[ "$SHOULD_PUSH" == true ]]; then
498-
echo "==> Force-pushing to origin/${TARGET_BRANCH}"
499-
eval "git push --force origin \"${TARGET_BRANCH}\" ${ERR_REDIRECT}"
498+
echo "==> Force-pushing to origin/${TARGET_QA_BRANCH}"
499+
eval "git push --force origin \"${TARGET_QA_BRANCH}\" ${ERR_REDIRECT}"
500500
echo "Done."
501501
else
502502
echo "Force push skipped."

0 commit comments

Comments
 (0)