From 62a552d896811314f4c37d2f504296b683e42d77 Mon Sep 17 00:00:00 2001 From: Asher Date: Thu, 7 May 2026 11:03:14 -0800 Subject: [PATCH] Check for updates on a schedule --- .github/workflows/update.yaml | 52 +++++++++++++++++++++++++++++------ ci/build/update-vscode.sh | 8 +++--- 2 files changed, 48 insertions(+), 12 deletions(-) diff --git a/.github/workflows/update.yaml b/.github/workflows/update.yaml index 02aecb3fa..97878a4e5 100644 --- a/.github/workflows/update.yaml +++ b/.github/workflows/update.yaml @@ -6,31 +6,67 @@ on: version: type: string required: true + schedule: + - cron: "23 * * * *" jobs: update: runs-on: ubuntu-latest env: - VERSION: ${{ inputs.version }} + TAG: ${{ inputs.version }} GH_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} steps: + - name: Fetch latest tag + if: env.TAG == '' + run: | + tag=$(curl -fsSLI -o /dev/null -w "%{url_effective}" https://github.com/microsoft/vscode/releases/latest) + tag="${tag#https://github.com/microsoft/vscode/releases/tag/}" + echo "TAG=$tag" >> $GITHUB_ENV + + - name: Remove leading v from tag + run: | + echo "VERSION=${TAG#v}" >> $GITHUB_ENV + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 with: - node-version-file: .node-version + submodules: true + + - name: Check current version + id: check + run: | + commit="$(git -C lib/vscode rev-parse HEAD)" + if [[ $(git -C lib/vscode ls-remote --tags | grep "$commit") == */"$VERSION" ]] ; then + echo "$VERSION update has already been merged into $(git rev-parse --abbrev-ref HEAD)" + echo done=true >> $GITHUB_OUTPUT + elif git ls-remote --exit-code --heads origin "update/$VERSION" ; then + echo "There is already a PR for updating to $VERSION" + echo done=true >> $GITHUB_OUTPUT + else + echo "$VERSION update has not started yet" + echo done=false >> $GITHUB_OUTPUT + fi + + - uses: awalsh128/cache-apt-pkgs-action@2c09a5e66da6c8016428a2172bd76e5e4f14bb17 # latest + if: steps.check.outputs.done == 'false' + with: + packages: quilt + version: 1.0 - run: ./ci/build/update-vscode.sh + if: steps.check.outputs.done == 'false' - name: Open PR + if: steps.check.outputs.done == 'false' run: | git config --global user.name cdrci git config --global user.email opensource@coder.com - git checkout -b update/${{ env.VERSION }} + git checkout -b "update/$VERSION" git add . - git commit -m "Update VS Code to ${{ env.VERSION }}" - git push -u origin $(git branch --show) - gh pr create --repo coder/code-server-aur \ - --title "Update VS Code to ${{ env.VERSION }}" \ + git commit -m "Update VS Code to $VERSION" + git push -u origin "$(git branch --show)" + gh pr create \ + --repo coder/code-server \ + --title "Update VS Code to $VERSION" \ --body-file .cache/checklist \ --draft diff --git a/ci/build/update-vscode.sh b/ci/build/update-vscode.sh index e2c3b2bff..a0b290eb8 100755 --- a/ci/build/update-vscode.sh +++ b/ci/build/update-vscode.sh @@ -42,7 +42,7 @@ function refresh_patches() { function update_node() { local node_version node_version=$(cat .node-version) - if [[ $node_version == $target_node_version ]] ; then + if [[ $node_version == "$target_node_version" ]] ; then echo "$node_version already matches $target_node_version" else echo "Updating from $node_version to $target_node_version..." @@ -52,11 +52,11 @@ function update_node() { function get-webview-script-hash() { local html - html=$(<$1) + html=$(<"$1") local start_tag='" - html=${html##*$start_tag} - html=${html%%$end_tag*} + html=${html##*"$start_tag"} + html=${html%%"$end_tag"*} echo -n "$html" | openssl sha256 -binary | openssl base64 }