|
1 | 1 | #!/usr/bin/env bash
|
| 2 | +# Description: This is a script to make the process of updating vscode versions easier |
| 3 | +# Run it with `yarn update:vscode` and it will do the following: |
| 4 | +# 1. Check that you have a remote called `vscode` |
| 5 | +# 2. Ask you which version you want to upgrade to |
| 6 | +# 3. Grab the exact version from the package.json i.e. 1.53.2 |
| 7 | +# 4. Fetch the vscode remote branches to run the subtree update |
| 8 | +# 5. Run the subtree update and pull in the vscode update |
| 9 | +# 6. Commit the changes (including merge conflicts) |
| 10 | +# 7. Open a draft PR |
| 11 | + |
2 | 12 | set -euo pipefail
|
3 | 13 |
|
4 | 14 | # This function expects two arguments
|
5 | 15 | # 1. the vscode version we're updating to
|
6 | 16 | # 2. the list of merge conflict files
|
7 |
| -make_pr_body(){ |
| 17 | +make_pr_body() { |
8 | 18 | local BODY="This PR updates vscode to $1
|
9 | 19 |
|
10 | 20 | ## TODOS
|
@@ -87,21 +97,20 @@ main() {
|
87 | 97 |
|
88 | 98 | # Get the files with conflicts before we commit them
|
89 | 99 | # 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) |
| 100 | + CONFLICTS=$(git diff --name-only --diff-filter=U | while read -r line; do echo "- $line"; done) |
| 101 | + PR_BODY=$(make_pr_body "$VSCODE_EXACT_VERSION" "$CONFLICTS") |
93 | 102 |
|
94 |
| - echo "Forcing a commit with conflicts" |
| 103 | + echo -e "\nForcing a commit with conflicts" |
95 | 104 | echo "Note: this is intentional"
|
96 | 105 | echo "If we don't do this, code review is impossible."
|
97 |
| - echo "For more info, see docs: docs/CONTRIBUTING.md#updating-vs-code" |
| 106 | + echo -e "For more info, see docs: docs/CONTRIBUTING.md#updating-vs-code\n" |
98 | 107 | git add . && git commit -am "chore(vscode): update to $VSCODE_EXACT_VERSION"
|
99 | 108 |
|
100 | 109 | # Note: we can't open a draft PR unless their are changes.
|
101 | 110 | # Hence why we do this after the subtree update.
|
102 | 111 | echo "Opening a draft PR on GitHub"
|
103 | 112 | # To read about these flags, visit the docs: https://cli.github.com/manual/gh_pr_create
|
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 |
| 113 | + 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 |
105 | 114 | }
|
106 | 115 |
|
107 | 116 | main "$@"
|
0 commit comments