Skip to content

Commit 11a2d9f

Browse files
committed
feat: update PR body in update-vscode script
1 parent ad33606 commit 11a2d9f

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

ci/dev/update-vscode.sh

+28-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4+
# This function expects two arguments
5+
# 1. the vscode version we're updating to
6+
# 2. the list of merge conflict files
7+
make_pr_body(){
8+
local BODY="This PR updates vscode to $1
9+
10+
## TODOS
11+
12+
- [ ] test editor locally
13+
- [ ] test terminal locally
14+
- [ ] make notes about any significant changes in docs/CONTRIBUTING.md#notes-about-changes
15+
16+
## Files with conflicts (fix these)
17+
$2"
18+
echo "$BODY"
19+
}
20+
421
main() {
522
cd "$(dirname "$0")/../.."
623

@@ -64,19 +81,27 @@ main() {
6481
echo "Going to try to update vscode for you..."
6582
echo -e "Running: git subtree pull --prefix lib/vscode vscode release/${VSCODE_VERSION_TO_UPDATE} --squash\n"
6683
# Try to run subtree update command
67-
git subtree pull --prefix lib/vscode vscode release/"${VSCODE_VERSION_TO_UPDATE}" --squash --message "chore(vscode): update to $VSCODE_EXACT_VERSION"
84+
# Note: we add `|| true` because we want the script to keep running even if the squash fails
85+
# We know the squash fails everytime because there will always be merge conflicts
86+
git subtree pull --prefix lib/vscode vscode release/"${VSCODE_VERSION_TO_UPDATE}" --squash || true
87+
88+
# Get the files with conflicts before we commit them
89+
# so we can list them in the PR body
90+
CONFLICTS=$(git diff --name-only --diff-filter=U | while read line; do echo "- $line"; done)
91+
92+
PR_BODY=$(make_pr_body $VSCODE_EXACT_VERSION $CONFLICTS)
6893
6994
echo "Forcing a commit with conflicts"
7095
echo "Note: this is intentional"
7196
echo "If we don't do this, code review is impossible."
7297
echo "For more info, see docs: docs/CONTRIBUTING.md#updating-vs-code"
73-
git add . && git commit -am "chore(vscode): commit conflicts from $VSCODE_EXACT_VERSION update"
98+
git add . && git commit -am "chore(vscode): update to $VSCODE_EXACT_VERSION"
7499
75100
# Note: we can't open a draft PR unless their are changes.
76101
# Hence why we do this after the subtree update.
77102
echo "Opening a draft PR on GitHub"
78103
# To read about these flags, visit the docs: https://cli.github.com/manual/gh_pr_create
79-
gh pr create --base master --title "feat(vscode): update to version $VSCODE_EXACT_VERSION" --body "This PR updates vscode to version: $VSCODE_EXACT_VERSION" --reviewer @cdr/code-server-reviewers --repo cdr/code-server --draft
104+
gh pr create --base master --title "feat(vscode): update to version $VSCODE_EXACT_VERSION" --body $PR_BODY --reviewer @cdr/code-server-reviewers --repo cdr/code-server --draft
80105
}
81106
82107
main "$@"

0 commit comments

Comments
 (0)